CompleteBundleOSX.cmake.in 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. set(app "@EXE@")
  2. list(APPEND BINS "Contents/Resources/updater")
  3. list(APPEND BINS "Contents/Resources/@HELPER_NAME@")
  4. set(args ${app})
  5. list(APPEND args "-verbose=2")
  6. list(APPEND args "-qmldir=@SOURCE_ROOT@/src/ui")
  7. foreach(BIN ${BINS})
  8. list(APPEND args "-executable=${app}/${BIN}")
  9. endforeach(BIN ${BINS})
  10. execute_process(
  11. COMMAND @QTROOT@/bin/macdeployqt ${args}
  12. WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
  13. )
  14. #set(ENTITLEMENTS --entitlements @SOURCE_ROOT@/bundle/osx/Konvergo.entitlements)
  15. set(CODESIGN codesign ${ENTITLEMENTS} --force --sign "Developer ID Application: Plex Inc.")
  16. macro(sign_binary BIN)
  17. message(STATUS "Signing: ${BIN}")
  18. execute_process(
  19. COMMAND ${CODESIGN} "${BIN}"
  20. RESULT_VARIABLE result
  21. )
  22. if(NOT ${result} EQUAL 0)
  23. message(FATAL_ERROR "Failed to sign ${BIN}")
  24. endif(NOT ${result} EQUAL 0)
  25. endmacro(sign_binary BIN)
  26. if(@DO_SIGN@)
  27. # we need to sign the webengine helper before the framework
  28. # add --entitlements @SOURCE_ROOT@/bundle/osx/WebEngine.entitlements when we want to sandbox
  29. set(WEB_PROC "${CMAKE_INSTALL_PREFIX}/${app}/Contents/Frameworks/QtWebEngineCore.framework/Versions/Current/Helpers/QtWebEngineProcess.app")
  30. sign_binary(${WEB_PROC})
  31. file(GLOB_RECURSE LIBS
  32. FOLLOW_SYMLINKS
  33. "${CMAKE_INSTALL_PREFIX}/${app}/*.dylib"
  34. )
  35. file(GLOB FRAMEWORKS FOLLOW_SYMLINKS LIST_DIRECTORIES true "${CMAKE_INSTALL_PREFIX}/${app}/Contents/Frameworks/*")
  36. foreach(LIB ${LIBS} ${FRAMEWORKS})
  37. sign_binary(${LIB})
  38. endforeach(LIB ${LIBS})
  39. foreach(BIN ${BINS})
  40. sign_binary(${CMAKE_INSTALL_PREFIX}/${app}/${BIN})
  41. endforeach(BIN ${BINS})
  42. sign_binary(${CMAKE_INSTALL_PREFIX}/${app})
  43. message("Verifing signature")
  44. execute_process(
  45. COMMAND codesign --verbose=4 --verify "${CMAKE_INSTALL_PREFIX}/@EXE@"
  46. RESULT_VARIABLE result
  47. )
  48. if(NOT ${result} EQUAL 0)
  49. message(FATAL_ERROR "Failed to verify binary!")
  50. endif(NOT ${result} EQUAL 0)
  51. execute_process(
  52. COMMAND spctl --verbose=4 --assess --type execute "${CMAKE_INSTALL_PREFIX}/@EXE@"
  53. RESULT_VARIABLE result
  54. )
  55. if(NOT ${result} EQUAL 0)
  56. message(FATAL_ERROR "Failed to verify binary!")
  57. endif(NOT ${result} EQUAL 0)
  58. endif(@DO_SIGN@)