CompleteBundleOSX.cmake.in 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #set(ENTITLEMENTS --entitlements @SOURCE_ROOT@/bundle/osx/Konvergo.entitlements)
  19. #set(CODESIGN codesign ${ENTITLEMENTS} --force --sign "Developer ID Application: Plex Inc.")
  20. macro(sign_binary BIN)
  21. message(STATUS "Signing: ${BIN}")
  22. execute_process(
  23. COMMAND ${CODESIGN} "${BIN}"
  24. RESULT_VARIABLE result
  25. )
  26. if(NOT ${result} EQUAL 0)
  27. message(FATAL_ERROR "Failed to sign ${BIN}")
  28. endif(NOT ${result} EQUAL 0)
  29. endmacro(sign_binary BIN)
  30. if(@DO_SIGN@)
  31. sign_binary(${weprocess})
  32. file(GLOB_RECURSE LIBS
  33. FOLLOW_SYMLINKS
  34. "${app}/*.dylib"
  35. )
  36. file(GLOB FRAMEWORKS FOLLOW_SYMLINKS LIST_DIRECTORIES true "${app}/Contents/Frameworks/*")
  37. foreach(LIB ${LIBS} ${FRAMEWORKS})
  38. sign_binary(${LIB})
  39. endforeach(LIB ${LIBS})
  40. foreach(BIN ${BINS})
  41. sign_binary(${app}/${BIN})
  42. endforeach(BIN ${BINS})
  43. sign_binary(${app})
  44. message("Verifing signature")
  45. execute_process(
  46. COMMAND codesign --verbose=4 --verify "${CMAKE_INSTALL_PREFIX}/@EXE@"
  47. RESULT_VARIABLE result
  48. )
  49. if(NOT ${result} EQUAL 0)
  50. message(FATAL_ERROR "Failed to verify binary!")
  51. endif(NOT ${result} EQUAL 0)
  52. execute_process(
  53. COMMAND spctl --verbose=4 --assess --type execute "${CMAKE_INSTALL_PREFIX}/@EXE@"
  54. RESULT_VARIABLE result
  55. )
  56. if(NOT ${result} EQUAL 0)
  57. message(FATAL_ERROR "Failed to verify binary!")
  58. endif(NOT ${result} EQUAL 0)
  59. endif(@DO_SIGN@)