CompleteBundleOSX.cmake.in 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. set(app "${CMAKE_INSTALL_PREFIX}/@EXE@")
  2. set(weprocess "${app}/Contents/Frameworks/QtWebEngineCore.framework/Versions/Current/Helpers/QtWebEngineProcess.app")
  3. set(args ${app})
  4. list(APPEND args "-verbose=2")
  5. list(APPEND args "-qmldir=@SOURCE_ROOT@/src/ui")
  6. foreach(BIN ${BINS})
  7. list(APPEND args "-executable=${app}/${BIN}")
  8. endforeach(BIN ${BINS})
  9. set(ENV{DYLD_LIBRARY_PATH} @QTROOT@/lib:@DEPENDENCY_ROOT@/lib)
  10. set(ENV{DYLD_FRAMEWORK_PATH} @QTROOT@/lib:@DEPENDENCY_ROOT@/lib)
  11. execute_process(
  12. COMMAND ${CMAKE_COMMAND} -E remove "${app}/Contents/Resources/qt.conf"
  13. COMMAND "@QTROOT@/bin/macdeployqt" ${args}
  14. WORKING_DIRECTORY "@QTROOT@/bin"
  15. )
  16. #set(ENTITLEMENTS --entitlements @SOURCE_ROOT@/bundle/osx/Konvergo.entitlements)
  17. #set(CODESIGN codesign ${ENTITLEMENTS} --force --sign "Developer ID Application: Plex Inc.")
  18. macro(sign_binary BIN)
  19. message(STATUS "Signing: ${BIN}")
  20. execute_process(
  21. COMMAND ${CODESIGN} "${BIN}"
  22. RESULT_VARIABLE result
  23. )
  24. if(NOT ${result} EQUAL 0)
  25. message(FATAL_ERROR "Failed to sign ${BIN}")
  26. endif(NOT ${result} EQUAL 0)
  27. endmacro(sign_binary BIN)
  28. if(@DO_SIGN@)
  29. sign_binary(${weprocess})
  30. file(GLOB_RECURSE LIBS
  31. FOLLOW_SYMLINKS
  32. "${app}/*.dylib"
  33. )
  34. file(GLOB FRAMEWORKS FOLLOW_SYMLINKS LIST_DIRECTORIES true "${app}/Contents/Frameworks/*")
  35. foreach(LIB ${LIBS} ${FRAMEWORKS})
  36. sign_binary(${LIB})
  37. endforeach(LIB ${LIBS})
  38. foreach(BIN ${BINS})
  39. sign_binary(${app}/${BIN})
  40. endforeach(BIN ${BINS})
  41. sign_binary(${app})
  42. message("Verifing signature")
  43. execute_process(
  44. COMMAND codesign --verbose=4 --verify "${CMAKE_INSTALL_PREFIX}/@EXE@"
  45. RESULT_VARIABLE result
  46. )
  47. if(NOT ${result} EQUAL 0)
  48. message(FATAL_ERROR "Failed to verify binary!")
  49. endif(NOT ${result} EQUAL 0)
  50. execute_process(
  51. COMMAND spctl --verbose=4 --assess --type execute "${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. endif(@DO_SIGN@)