CompleteBundleOSX.cmake.in 2.3 KB

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