diff --git a/CMake/ScmRevGen.cmake b/CMake/ScmRevGen.cmake index 5ec3041134..65aa8c78c5 100644 --- a/CMake/ScmRevGen.cmake +++ b/CMake/ScmRevGen.cmake @@ -42,11 +42,20 @@ if(NOT DOLPHIN_WC_REVISION) set(DOLPHIN_WC_COMMITS_AHEAD_MASTER 0) endif() -configure_file( - "${PROJECT_SOURCE_DIR}/Source/Core/Common/scmrev.h.in" - "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp" -) +function(configure_source_file path) + configure_file( + "${PROJECT_SOURCE_DIR}/${path}.in" + "${PROJECT_BINARY_DIR}/${path}.tmp" + ) -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp" "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_BINARY_DIR}/${path}.tmp" "${PROJECT_BINARY_DIR}/${path}") -file(REMOVE "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp") + file(REMOVE "${PROJECT_BINARY_DIR}/${path}.tmp") +endfunction() + +configure_source_file("Source/Core/Common/scmrev.h") + +if(APPLE) + configure_source_file("Source/Core/DolphinQt/Info.plist") + configure_source_file("Source/Core/MacUpdater/Info.plist") +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index f62ce48ed2..5b246b193b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -788,14 +788,26 @@ if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h) file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h) endif() +if(APPLE) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/DolphinQt) + if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/DolphinQt/Info.plist) + file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/DolphinQt/Info.plist) + endif() + + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/MacUpdater) + if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/MacUpdater/Info.plist) + file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/MacUpdater/Info.plist) + endif() +endif() + find_package(Git) if(NOT GIT_FOUND) set(GIT_EXECUTABLE "") endif() add_custom_target( dolphin_scmrev - ${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -DDISTRIBUTOR=${DISTRIBUTOR} -DDOLPHIN_DEFAULT_UPDATE_TRACK=${DOLPHIN_DEFAULT_UPDATE_TRACK} -DGIT_FOUND=${GIT_FOUND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DDOLPHIN_WC_REVISION=${DOLPHIN_WC_REVISION} -DDOLPHIN_WC_DESCRIBE=${DOLPHIN_WC_DESCRIBE} -DDOLPHIN_WC_BRANCH=${DOLPHIN_WC_BRANCH} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/ScmRevGen.cmake - BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h + ${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -DDISTRIBUTOR=${DISTRIBUTOR} -DDOLPHIN_DEFAULT_UPDATE_TRACK=${DOLPHIN_DEFAULT_UPDATE_TRACK} -DGIT_FOUND=${GIT_FOUND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DDOLPHIN_WC_REVISION=${DOLPHIN_WC_REVISION} -DDOLPHIN_WC_DESCRIBE=${DOLPHIN_WC_DESCRIBE} -DDOLPHIN_WC_BRANCH=${DOLPHIN_WC_BRANCH} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/ScmRevGen.cmake + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/DolphinQt/Info.plist" "${CMAKE_CURRENT_BINARY_DIR}/Source/Core/MacUpdater/Info.plist" VERBATIM ) diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 8085b49a60..25a3c0daa8 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -571,7 +571,7 @@ if(APPLE) # Ask for an application bundle. set_target_properties(dolphin-emu PROPERTIES MACOSX_BUNDLE true - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist" XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/DolphinEmu.entitlements" XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--deep --options=runtime" OUTPUT_NAME Dolphin diff --git a/Source/Core/MacUpdater/CMakeLists.txt b/Source/Core/MacUpdater/CMakeLists.txt index 3a9a9b8d0e..7ce5a58a5f 100644 --- a/Source/Core/MacUpdater/CMakeLists.txt +++ b/Source/Core/MacUpdater/CMakeLists.txt @@ -16,9 +16,11 @@ set(MacUpdater_NAME "Dolphin Updater") set(MacUpdater_BIN_DIR ${CMAKE_BINARY_DIR}/Binaries) set(MacUpdater_BUNDLE_PATH ${MacUpdater_BIN_DIR}/${MacUpdater_NAME}.app) +add_dependencies(MacUpdater dolphin_scmrev) + set_target_properties(MacUpdater PROPERTIES MACOSX_BUNDLE true - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist" OUTPUT_NAME ${MacUpdater_NAME}) target_compile_options(MacUpdater PRIVATE -x objective-c++)