1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00
Files
vcmi/osx/CMakeLists.txt

44 lines
1.6 KiB
CMake
Raw Normal View History

# 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)
set(bundleDir "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}")
set(bundleContentsDir "${bundleDir}/Contents")
set(executablesDir "${bundleContentsDir}/MacOS")
set(macdeployqtParams "\"${bundleDir}\"")
if(ENABLE_EDITOR)
string(APPEND macdeployqtParams " \"-executable=${executablesDir}/vcmieditor\"")
endif()
# note: cross-compiled Qt 5 builds macdeployqt for target platform instead of host
vcmi_deploy_qt(macdeployqt "${macdeployqtParams}")
2022-09-13 15:27:44 +03:00
# perform ad-hoc codesigning
# Intel Macs don't need it
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
return()
endif()
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} \"${executablesDir}/vcmibuilder\"
2022-09-13 15:27:44 +03:00
)
foreach(executable ${executablesToSign})
2022-09-13 15:27:44 +03:00
execute_process(COMMAND
${codesignCommandWithEntitlements} --identifier eu.vcmi.\${executable} \"${executablesDir}/\${executable}\"
2022-09-13 15:27:44 +03:00
)
endforeach()
")
endif()