mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-01 07:19:00 +08:00
9ccd693f1b
* [toolchain windows] set CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR In specific, I did this for the cpuinfo PR - I realized the reason that cpuinfo doesn't support arm64 windows cross compilation is because we don't set CMAKE_SYSTEM_PROCESSOR. * correctly set CMAKE_CROSSCOMPILING * start fixin libraries * more changes: - gainput: remove line - glog: remove try_run when cross compiling - windows.cmake: set CMAKE_SYSTEM_VERSION * more patches - mapnik: set BOOST_REGEX_HAS_ICU to avoid check_cxx_source_runs - orc: set HAS_PRE_1970 and HAS_POST_2038 for same - seal: change out check_cxx_source_runs for check_cxx_source_compiles * more changes * fix x86-windows * fix qpid-proton, glog * build corrade-rc * fix x64-uwp ports * forgot to _actually_ always build corrade-rc .,. * Replay #22831 * Dedupe CMAKE_SYSTEM_NAME settings. * Add quotes for corrade_rc_param Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * Update version DB. Co-authored-by: nicole mazzuca <mazzucan@outlook.com> Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com> Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
74 lines
3.6 KiB
CMake
74 lines
3.6 KiB
CMake
if(NOT _VCPKG_WINDOWS_TOOLCHAIN)
|
|
set(_VCPKG_WINDOWS_TOOLCHAIN 1)
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<STREQUAL:${VCPKG_CRT_LINKAGE},dynamic>:DLL>" CACHE STRING "")
|
|
|
|
set(CMAKE_SYSTEM_NAME Windows CACHE STRING "")
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
|
set(CMAKE_SYSTEM_PROCESSOR x86 CACHE STRING "")
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
|
set(CMAKE_SYSTEM_PROCESSOR AMD64 CACHE STRING "")
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
|
|
set(CMAKE_SYSTEM_PROCESSOR ARM CACHE STRING "")
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
|
set(CMAKE_SYSTEM_PROCESSOR ARM64 CACHE STRING "")
|
|
endif()
|
|
|
|
if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
|
|
set(CMAKE_SYSTEM_VERSION "${VCPKG_CMAKE_SYSTEM_VERSION}" CACHE STRING "" FORCE)
|
|
endif()
|
|
|
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
|
|
set(CMAKE_CROSSCOMPILING OFF CACHE STRING "")
|
|
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
|
# any of the four platforms can run x86 binaries
|
|
set(CMAKE_CROSSCOMPILING OFF CACHE STRING "")
|
|
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "ARM64")
|
|
# arm64 can run binaries of any of the four platforms after Windows 11
|
|
set(CMAKE_CROSSCOMPILING OFF CACHE STRING "")
|
|
endif()
|
|
|
|
if(NOT DEFINED CMAKE_SYSTEM_VERSION)
|
|
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}" CACHE STRING "")
|
|
endif()
|
|
endif()
|
|
|
|
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
|
|
if(NOT _CMAKE_IN_TRY_COMPILE)
|
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
|
set(VCPKG_CRT_LINK_FLAG_PREFIX "/MD")
|
|
elseif(VCPKG_CRT_LINKAGE STREQUAL "static")
|
|
set(VCPKG_CRT_LINK_FLAG_PREFIX "/MT")
|
|
else()
|
|
message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"")
|
|
endif()
|
|
|
|
set(CHARSET_FLAG "/utf-8")
|
|
if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120")
|
|
# VS 2013 does not support /utf-8
|
|
set(CHARSET_FLAG)
|
|
endif()
|
|
|
|
set(CMAKE_CXX_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "")
|
|
set(CMAKE_C_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /MP ${VCPKG_C_FLAGS}" CACHE STRING "")
|
|
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "")
|
|
|
|
unset(CHARSET_FLAG)
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "")
|
|
set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "")
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "")
|
|
set(CMAKE_C_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "")
|
|
|
|
string(APPEND CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT " /nologo ")
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" CACHE STRING "")
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" CACHE STRING "")
|
|
|
|
string(APPEND CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT " /nologo ")
|
|
string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG} ")
|
|
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG} ")
|
|
endif()
|
|
endif()
|