CompleteBundleOSX.cmake.in 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. execute_process(
  14. COMMAND ${CMAKE_COMMAND} -E remove ${app}/Contents/Resources/qt.conf
  15. COMMAND @QTROOT@/bin/macdeployqt ${args}
  16. WORKING_DIRECTORY @QTROOT@/bin
  17. )
  18. # Run the macdeploy command again to be able to fixup the linked paths for QtWebEngineProcess that
  19. # is deployed by the first run.
  20. execute_process(
  21. COMMAND @QTROOT@/bin/macdeployqt ${app} -executable=${weprocess}/Contents/MacOS/QtWebEngineProcess
  22. WORKING_DIRECTORY @QTROOT@/bin
  23. )
  24. #set(ENTITLEMENTS --entitlements @SOURCE_ROOT@/bundle/osx/Konvergo.entitlements)
  25. set(CODESIGN codesign ${ENTITLEMENTS} --force --sign "Developer ID Application: Plex Inc.")
  26. macro(sign_binary BIN)
  27. message(STATUS "Signing: ${BIN}")
  28. execute_process(
  29. COMMAND ${CODESIGN} "${BIN}"
  30. RESULT_VARIABLE result
  31. )
  32. if(NOT ${result} EQUAL 0)
  33. message(FATAL_ERROR "Failed to sign ${BIN}")
  34. endif(NOT ${result} EQUAL 0)
  35. endmacro(sign_binary BIN)
  36. if(@DO_SIGN@)
  37. sign_binary(${weprocess})
  38. file(GLOB_RECURSE LIBS
  39. FOLLOW_SYMLINKS
  40. "${app}/*.dylib"
  41. )
  42. file(GLOB FRAMEWORKS FOLLOW_SYMLINKS LIST_DIRECTORIES true "${app}/Contents/Frameworks/*")
  43. foreach(LIB ${LIBS} ${FRAMEWORKS})
  44. sign_binary(${LIB})
  45. endforeach(LIB ${LIBS})
  46. foreach(BIN ${BINS})
  47. sign_binary(${app}/${BIN})
  48. endforeach(BIN ${BINS})
  49. sign_binary(${app})
  50. message("Verifing signature")
  51. execute_process(
  52. COMMAND codesign --verbose=4 --verify "${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. execute_process(
  59. COMMAND spctl --verbose=4 --assess --type execute "${CMAKE_INSTALL_PREFIX}/@EXE@"
  60. RESULT_VARIABLE result
  61. )
  62. if(NOT ${result} EQUAL 0)
  63. message(FATAL_ERROR "Failed to verify binary!")
  64. endif(NOT ${result} EQUAL 0)
  65. endif(@DO_SIGN@)