build: Replace CMAKE_SYSTEM_PROCESSOR with BUILD_ARCHITECTURE, on windows CMAKE_SYSTEM_PROCESSOR is flawed so when possible use the vcpkg info or default to x64 Adjust the vcruntime check to use the BUILD_ARCHITECTURE to check the proper version is installed for the architecture the app is build for
This commit is contained in:
parent
eab87e3869
commit
4034302bfb
5 changed files with 16 additions and 13 deletions
|
|
@ -95,6 +95,16 @@ set(REQUIRED_LIBEI_VERSION 1.3)
|
||||||
set(REQUIRED_LIBPORTAL_VERSION 0.8)
|
set(REQUIRED_LIBPORTAL_VERSION 0.8)
|
||||||
set(REQUIRED_QT_VERSION 6.7.0)
|
set(REQUIRED_QT_VERSION 6.7.0)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
if ("$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "")
|
||||||
|
set (BUILD_ARCHITECTURE x64)
|
||||||
|
else()
|
||||||
|
set (BUILD_ARCHITECTURE $ENV{VSCMD_ARG_TGT_ARCH})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set (BUILD_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# On Windows, require that the same MSVC runtime is used as on the host.
|
# On Windows, require that the same MSVC runtime is used as on the host.
|
||||||
# Mitigates things like access violations caused by accidental ABI-compatibility breakage.
|
# Mitigates things like access violations caused by accidental ABI-compatibility breakage.
|
||||||
|
|
@ -102,7 +112,7 @@ if (MSVC)
|
||||||
cmake_host_system_information(
|
cmake_host_system_information(
|
||||||
RESULT REQUIRED_MSVC_RUNTIME_MINOR
|
RESULT REQUIRED_MSVC_RUNTIME_MINOR
|
||||||
QUERY WINDOWS_REGISTRY
|
QUERY WINDOWS_REGISTRY
|
||||||
"HKLM/SOFTWARE/Microsoft/VisualStudio/${REQUIRED_MSVC_RUNTIME_MAJOR}.0/VC/Runtimes/x64"
|
"HKLM/SOFTWARE/Microsoft/VisualStudio/${REQUIRED_MSVC_RUNTIME_MAJOR}.0/VC/Runtimes/${BUILD_ARCHITECTURE}"
|
||||||
VALUE "Minor")
|
VALUE "Minor")
|
||||||
if (REQUIRED_MSVC_RUNTIME_MINOR)
|
if (REQUIRED_MSVC_RUNTIME_MINOR)
|
||||||
message(STATUS "MSVC runtime: ${REQUIRED_MSVC_RUNTIME_MAJOR}.${REQUIRED_MSVC_RUNTIME_MINOR}")
|
message(STATUS "MSVC runtime: ${REQUIRED_MSVC_RUNTIME_MAJOR}.${REQUIRED_MSVC_RUNTIME_MINOR}")
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
if("${DISTRO_NAME}" STREQUAL "")
|
if("${DISTRO_NAME}" STREQUAL "")
|
||||||
set(DISTRO_NAME "linux")
|
set(DISTRO_NAME "linux")
|
||||||
endif()
|
endif()
|
||||||
set(OS_STRING "${DISTRO_NAME}-${CN_STRING}${CMAKE_SYSTEM_PROCESSOR}")
|
set(OS_STRING "${DISTRO_NAME}-${CN_STRING}${BUILD_ARCHITECTURE}")
|
||||||
|
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD")
|
||||||
message(STATUS "BSD packaging not yet supported")
|
message(STATUS "BSD packaging not yet supported")
|
||||||
set(OS_STRING ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
set(OS_STRING ${CMAKE_SYSTEM_NAME}-${BUILD_ARCHITECTURE})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ install(CODE "execute_process(COMMAND
|
||||||
-timestamp -codesign=-
|
-timestamp -codesign=-
|
||||||
)")
|
)")
|
||||||
|
|
||||||
set(OS_STRING "macos-${CMAKE_SYSTEM_PROCESSOR}")
|
set(OS_STRING "macos-${BUILD_ARCHITECTURE}")
|
||||||
set(CPACK_PACKAGE_ICON "${MY_DIR}/dmg-volume.icns")
|
set(CPACK_PACKAGE_ICON "${MY_DIR}/dmg-volume.icns")
|
||||||
set(CPACK_DMG_BACKGROUND_IMAGE "${MY_DIR}/dmg-background.tiff")
|
set(CPACK_DMG_BACKGROUND_IMAGE "${MY_DIR}/dmg-background.tiff")
|
||||||
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${MY_DIR}/generate_ds_store.applescript")
|
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${MY_DIR}/generate_ds_store.applescript")
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,7 @@ set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/pre-cpack.cmake)
|
||||||
configure_file(${MY_DIR}/cpack-options.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cpack-options.cmake @ONLY)
|
configure_file(${MY_DIR}/cpack-options.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cpack-options.cmake @ONLY)
|
||||||
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/cpack-options.cmake)
|
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/cpack-options.cmake)
|
||||||
|
|
||||||
# Setup OS_STRING
|
set(OS_STRING "win-${BUILD_ARCHITECTURE}")
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES AMD64)
|
|
||||||
set(OS_STRING "win-x64")
|
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES ARM64)
|
|
||||||
set(OS_STRING "win-arm64")
|
|
||||||
else()
|
|
||||||
set(OS_STRING "win-${CMAKE_SYSTEM_PROCESSOR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND CPACK_GENERATOR "7Z")
|
list(APPEND CPACK_GENERATOR "7Z")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
<RegistrySearch
|
<RegistrySearch
|
||||||
Id="FindVCRedist"
|
Id="FindVCRedist"
|
||||||
Root="HKLM"
|
Root="HKLM"
|
||||||
Key="SOFTWARE\Microsoft\VisualStudio\@REQUIRED_MSVC_RUNTIME_MAJOR@.0\VC\Runtimes\x64"
|
Key="SOFTWARE\Microsoft\VisualStudio\@REQUIRED_MSVC_RUNTIME_MAJOR@.0\VC\Runtimes\@BUILD_ARCHITECTURE@"
|
||||||
Name="Installed"
|
Name="Installed"
|
||||||
Type="raw" />
|
Type="raw" />
|
||||||
</Property>
|
</Property>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue