2017-08-12 21:58:09 +03:00
|
|
|
# We need to keep this code into separate directory so CMake will execute it after all other subdirectories install code
|
|
|
|
|
# Otherwise we can't fix Mac bundle dependencies since binaries wouldn't be there when this code executed
|
2025-08-30 21:50:00 +03:00
|
|
|
if(MACOS)
|
2022-08-30 17:29:00 +03:00
|
|
|
set(bundleDir "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}")
|
|
|
|
|
set(bundleContentsDir "${bundleDir}/Contents")
|
|
|
|
|
|
2022-10-22 16:59:26 +03:00
|
|
|
if(ENABLE_LAUNCHER OR ENABLE_EDITOR)
|
2025-03-07 11:32:36 +03:00
|
|
|
# note: cross-compiled Qt 5 builds macdeployqt for target platform instead of host
|
|
|
|
|
vcmi_deploy_qt(macdeployqt "\"${bundleDir}\"")
|
2017-08-12 21:58:09 +03:00
|
|
|
endif()
|
|
|
|
|
|
2022-09-13 15:27:44 +03:00
|
|
|
# perform ad-hoc codesigning
|
2024-12-25 12:35:36 +03:00
|
|
|
# Intel Macs don't need it
|
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
|
|
|
|
return()
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-10-22 16:57:41 +03:00
|
|
|
set(executablesToSign vcmiserver)
|
|
|
|
|
if(ENABLE_EDITOR)
|
|
|
|
|
list(APPEND executablesToSign vcmieditor)
|
|
|
|
|
endif()
|
|
|
|
|
# main executable must be last
|
|
|
|
|
list(APPEND executablesToSign vcmiclient)
|
|
|
|
|
if(ENABLE_LAUNCHER)
|
|
|
|
|
list(APPEND executablesToSign vcmilauncher)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-09-13 15:27:44 +03:00
|
|
|
set(codesignCommand "codesign --verbose=4 --force --options=runtime --timestamp=none --sign -")
|
|
|
|
|
set(codesignCommandWithEntitlements "${codesignCommand} --entitlements \"${CMAKE_SOURCE_DIR}/osx/entitlements.plist\"")
|
|
|
|
|
install(CODE "
|
|
|
|
|
execute_process(COMMAND
|
|
|
|
|
${codesignCommand} \"${bundleContentsDir}/MacOS/vcmibuilder\"
|
|
|
|
|
)
|
2022-10-22 16:57:41 +03:00
|
|
|
foreach(executable ${executablesToSign})
|
2022-09-13 15:27:44 +03:00
|
|
|
execute_process(COMMAND
|
2022-10-22 16:58:12 +03:00
|
|
|
${codesignCommandWithEntitlements} --identifier eu.vcmi.\${executable} \"${bundleContentsDir}/MacOS/\${executable}\"
|
2022-09-13 15:27:44 +03:00
|
|
|
)
|
|
|
|
|
endforeach()
|
|
|
|
|
")
|
2021-03-01 11:38:21 +03:00
|
|
|
endif()
|