forked from qt-creator/qt-creator
wininterrupt: Build for x86, x64 and arm64 at once
When wininterrupt is opened standalone, then the build will build itself with MSBuild for x86, x64 and amr64 architectures. The architecture list can be specified with the WININTERRUPT_BUILD_ARCHS (arm64 win32 x64) CMake parameter. Task-number: QTCREATORBUG-31345 Change-Id: I97228c6fd650a3811451ac527d41e5eb7783044d Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -13,6 +13,49 @@ if (NOT QT_CREATOR_API_DEFINED)
|
||||
include(QtCreatorIDEBranding)
|
||||
include(QtCreatorAPI)
|
||||
qtc_handle_compiler_cache_support()
|
||||
|
||||
# Compile for x86, x64 and arm64
|
||||
if (NOT ${PROJECT_NAME}-MultiBuild)
|
||||
include(ExternalProject)
|
||||
|
||||
set(generator "Visual Studio 16 2019")
|
||||
if(CMAKE_CXX_COMPILER MATCHES "Microsoft Visual Studio/2022/")
|
||||
set(generator "Visual Studio 17 2022")
|
||||
endif()
|
||||
|
||||
macro (setup_executable arch)
|
||||
ExternalProject_Add(${arch}-bld
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
CMAKE_GENERATOR "${generator}"
|
||||
CMAKE_GENERATOR_PLATFORM "${arch}"
|
||||
CMAKE_ARGS
|
||||
-D${PROJECT_NAME}-MultiBuild=ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
|
||||
INSTALL_COMMAND
|
||||
${CMAKE_COMMAND} --install . --config ${CMAKE_BUILD_TYPE}
|
||||
--prefix "${CMAKE_BINARY_DIR}" --component wininterrupt
|
||||
)
|
||||
endmacro()
|
||||
|
||||
if (NOT WININTERRUPT_BUILD_ARCHS)
|
||||
set(WININTERRUPT_BUILD_ARCHS arm64 win32 x64)
|
||||
endif()
|
||||
foreach(arch IN LISTS WININTERRUPT_BUILD_ARCHS)
|
||||
setup_executable(${arch})
|
||||
endforeach()
|
||||
|
||||
list(LENGTH WININTERRUPT_BUILD_ARCHS build_archs_length)
|
||||
if (build_archs_length GREATER 0)
|
||||
install(
|
||||
DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||
DESTINATION .
|
||||
COMPONENT wininterrupt
|
||||
)
|
||||
endif()
|
||||
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
|
Reference in New Issue
Block a user