CompleteBundleOSX.cmake.in 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. set(app "${CMAKE_INSTALL_PREFIX}/@EXE@")
  2. set(weprocess "${app}/Contents/Frameworks/QtWebEngineCore.framework/Versions/Current/Helpers/QtWebEngineProcess.app")
  3. list(APPEND BINS "Contents/Resources/updater")
  4. list(APPEND BINS "Contents/Resources/@HELPER_NAME@")
  5. set(args ${app})
  6. list(APPEND args "-verbose=2")
  7. list(APPEND args "-qmldir=@SOURCE_ROOT@/src/ui")
  8. foreach(BIN ${BINS})
  9. list(APPEND args "-executable=${app}/${BIN}")
  10. endforeach(BIN ${BINS})
  11. set(ENV{DYLD_LIBRARY_PATH} @QTROOT@/lib:@DEPENDENCY_ROOT@/lib)
  12. set(ENV{DYLD_FRAMEWORK_PATH} @QTROOT@/lib:@DEPENDENCY_ROOT@/lib)
  13. # Write qt.conf in the Qt depends directory so that the Qt tools can find QML files
  14. set(QTCONFCONTENT "[Paths]
  15. Prefix=@QTROOT@
  16. ")
  17. file(WRITE @QTROOT@/bin/qt.conf ${QTCONFCONTENT})
  18. execute_process(
  19. COMMAND @QTROOT@/bin/macdeployqt ${args}
  20. WORKING_DIRECTORY @QTROOT@/bin
  21. )
  22. # Run the macdeploy command again to be able to fixup the linked paths for QtWebEngineProcess that
  23. # is deployed by the first run.
  24. execute_process(
  25. COMMAND @QTROOT@/bin/macdeployqt ${app} -executable=${weprocess}/Contents/MacOS/QtWebEngineProcess
  26. WORKING_DIRECTORY @QTROOT@/bin
  27. )
  28. #set(ENTITLEMENTS --entitlements @SOURCE_ROOT@/bundle/osx/Konvergo.entitlements)
  29. set(CODESIGN codesign ${ENTITLEMENTS} --force --sign "Developer ID Application: Plex Inc.")
  30. macro(sign_binary BIN)
  31. message(STATUS "Signing: ${BIN}")
  32. execute_process(
  33. COMMAND ${CODESIGN} "${BIN}"
  34. RESULT_VARIABLE result
  35. )
  36. if(NOT ${result} EQUAL 0)
  37. message(FATAL_ERROR "Failed to sign ${BIN}")
  38. endif(NOT ${result} EQUAL 0)
  39. endmacro(sign_binary BIN)
  40. if(@DO_SIGN@)
  41. sign_binary(${weprocess})
  42. file(GLOB_RECURSE LIBS
  43. FOLLOW_SYMLINKS
  44. "${app}/*.dylib"
  45. )
  46. file(GLOB FRAMEWORKS FOLLOW_SYMLINKS LIST_DIRECTORIES true "${app}/Contents/Frameworks/*")
  47. foreach(LIB ${LIBS} ${FRAMEWORKS})
  48. sign_binary(${LIB})
  49. endforeach(LIB ${LIBS})
  50. foreach(BIN ${BINS})
  51. sign_binary(${app}/${BIN})
  52. endforeach(BIN ${BINS})
  53. sign_binary(${app})
  54. message("Verifing signature")
  55. execute_process(
  56. COMMAND codesign --verbose=4 --verify "${CMAKE_INSTALL_PREFIX}/@EXE@"
  57. RESULT_VARIABLE result
  58. )
  59. if(NOT ${result} EQUAL 0)
  60. message(FATAL_ERROR "Failed to verify binary!")
  61. endif(NOT ${result} EQUAL 0)
  62. execute_process(
  63. COMMAND spctl --verbose=4 --assess --type execute "${CMAKE_INSTALL_PREFIX}/@EXE@"
  64. RESULT_VARIABLE result
  65. )
  66. if(NOT ${result} EQUAL 0)
  67. message(FATAL_ERROR "Failed to verify binary!")
  68. endif(NOT ${result} EQUAL 0)
  69. endif(@DO_SIGN@)