зеркало из https://github.com/microsoft/vcpkg.git
Add initial iOS support (#6275)
* Add iOS community triplets and toolchain support Added an iOS toolchain to enable building packages for iOS. The toolchain is used when a triplet's VCPKG_CMAKE_SYSTEM_NAME is set to iOS. To configure which architecture should be built, as well as other iOS specifics, the following triplet variables can be set: - VCPKG_TARGET_ARCHITECTURE - VCPKG_OSX_SYSROOT - VCPKG_OSX_DEPLOYMENT_TARGET - VCPKG_OSX_ARCHITECTURES The following VCPKG_TARGET_ARCHITECTURE values are currently supported: - arm, arm64, x64, x86. The following VCPKG_OSX_SYSROOT values are currently supported: - iphoneos, iphonesimulator, or an absolute path to the device or simulator Xcode SDK. VCPKG_OSX_DEPLOYMENT_TARGET can be set to control the minimum iOS delopyment target for the built libraries. CMAKE_OSX_ARCHITECTURES is derived from VCPKG_TARGET_ARCHITECTURE, so generally it should not be set. In case if someone needs to target a more specific architecture (like armv7k or arm64e), it can be set in the triplet via VCPKG_OSX_ARCHITECTURES. Note that only certain combinations of the architecture and sysroot will work: simulator SDKs only provide x86-based libraries, etc. The toolchain also sets CMAKE_SYSTEM_PROCESSOR for certain configurations, because certain packages (like libpng) depend on the processor type. Added 4 community iOS triplets that build static libraries: - arm-ios, arm64-ios, x86-ios, x64-ios. The non-arm triplets target the iOS simulator. The triplets build static libraries because they are easiest to integrate into an iOS project. Dynamic libraries or frameworks require code signing on iOS, which complicates integration. Added heuristics to try and automatically detect what iOS triplet to use when building your own CMake project (so when a CMake project sets CMAKE_TOOLCHAIN_FILE to buildsystems/vcpkg.cmake), if no explicit triplet is provided (VCPKG_TARGET_TRIPLET is undefined). The heuristic checks for the values of CMAKE_SYSTEM_NAME and CMAKE_OSX_ARCHITECTURES. Note that for this to work, CMAKE_OSX_ARCHITECTURES needs to be set before the first project() call in your CMake project. Added workaround so find_package finds vcpkg installed packages when targeting iOS. This is done by saving / restoring the value of CMAKE_FIND_ROOT_PATH while also adding the vcpkg package root in the find_package override macro. The workaround can be removed once vcpkg upgrades to CMake 3.15.0 or higher where the issue is fixed. Fixes: #6003 * Fix building libpng and pcre2 targetting iOS Fixes: #6003
This commit is contained in:
Родитель
4db554b937
Коммит
c5f01e1dee
|
@ -308,6 +308,10 @@ __pycache__/
|
||||||
!triplets/community/x86-android.cmake
|
!triplets/community/x86-android.cmake
|
||||||
!triplets/community/arm-android.cmake
|
!triplets/community/arm-android.cmake
|
||||||
!triplets/community/arm64-android.cmake
|
!triplets/community/arm64-android.cmake
|
||||||
|
!triplets/community/arm64-ios.cmake
|
||||||
|
!triplets/community/arm-ios.cmake
|
||||||
|
!triplets/community/x64-ios.cmake
|
||||||
|
!triplets/community/x86-ios.cmake
|
||||||
!triplets/arm-uwp.cmake
|
!triplets/arm-uwp.cmake
|
||||||
!triplets/x64-uwp.cmake
|
!triplets/x64-uwp.cmake
|
||||||
!triplets/x64-windows.cmake
|
!triplets/x64-windows.cmake
|
||||||
|
|
|
@ -140,6 +140,10 @@ Sets the minimum macOS version for compiled binaries. This also changes what ver
|
||||||
### VCPKG_OSX_SYSROOT
|
### VCPKG_OSX_SYSROOT
|
||||||
Set the name or path of the macOS platform SDK that will be used by CMake. See the CMake documentation for [CMAKE_OSX_SYSROOT](https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html) for more information.
|
Set the name or path of the macOS platform SDK that will be used by CMake. See the CMake documentation for [CMAKE_OSX_SYSROOT](https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html) for more information.
|
||||||
|
|
||||||
|
|
||||||
|
### VCPKG_OSX_ARCHITECTURES
|
||||||
|
Set the macOS / iOS target architecture which will be used by CMake. See the CMake documentation for [CMAKE_OSX_ARCHITECTURES](https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html) for more information.
|
||||||
|
|
||||||
## Per-port customization
|
## Per-port customization
|
||||||
The CMake Macro `PORT` will be set when interpreting the triplet file and can be used to change settings (such as `VCPKG_LIBRARY_LINKAGE`) on a per-port basis.
|
The CMake Macro `PORT` will be set when interpreting the triplet file and can be used to change settings (such as `VCPKG_LIBRARY_LINKAGE`) on a per-port basis.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Source: libpng
|
Source: libpng
|
||||||
Version: 1.6.37-6
|
Version: 1.6.37-7
|
||||||
Build-Depends: zlib
|
Build-Depends: zlib
|
||||||
Homepage: https://github.com/glennrp/libpng
|
Homepage: https://github.com/glennrp/libpng
|
||||||
Description: libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files.
|
Description: libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files.
|
||||||
|
|
|
@ -47,11 +47,17 @@ else()
|
||||||
set(PNG_SHARED_LIBS OFF)
|
set(PNG_SHARED_LIBS OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION )
|
||||||
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL iOS)
|
||||||
|
set(LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION "-DPNG_HARDWARE_OPTIMIZATIONS=OFF")
|
||||||
|
endif()
|
||||||
|
|
||||||
vcpkg_configure_cmake(
|
vcpkg_configure_cmake(
|
||||||
SOURCE_PATH ${SOURCE_PATH}
|
SOURCE_PATH ${SOURCE_PATH}
|
||||||
PREFER_NINJA
|
PREFER_NINJA
|
||||||
OPTIONS
|
OPTIONS
|
||||||
${LIBPNG_APNG_OPTION}
|
${LIBPNG_APNG_OPTION}
|
||||||
|
${LIBPNG_HARDWARE_OPTIMIZATIONS_OPTION}
|
||||||
-DPNG_STATIC=${PNG_STATIC_LIBS}
|
-DPNG_STATIC=${PNG_STATIC_LIBS}
|
||||||
-DPNG_SHARED=${PNG_SHARED_LIBS}
|
-DPNG_SHARED=${PNG_SHARED_LIBS}
|
||||||
-DPNG_TESTS=OFF
|
-DPNG_TESTS=OFF
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Source: pcre2
|
Source: pcre2
|
||||||
Version: 10.30-6
|
Version: 10.30-7
|
||||||
Homepage: https://pcre.org/
|
Homepage: https://pcre.org/
|
||||||
Description: PCRE2 is a re-working of the original Perl Compatible Regular Expressions library
|
Description: PCRE2 is a re-working of the original Perl Compatible Regular Expressions library
|
||||||
|
|
|
@ -14,7 +14,7 @@ vcpkg_extract_source_archive_ex(
|
||||||
fix-uwp.patch
|
fix-uwp.patch
|
||||||
)
|
)
|
||||||
|
|
||||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
set(JIT OFF)
|
set(JIT OFF)
|
||||||
else()
|
else()
|
||||||
set(JIT ON)
|
set(JIT ON)
|
||||||
|
|
|
@ -76,6 +76,37 @@ else()
|
||||||
set(_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
set(_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
||||||
elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$")
|
elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$")
|
||||||
set(_VCPKG_TARGET_TRIPLET_ARCH x86)
|
set(_VCPKG_TARGET_TRIPLET_ARCH x86)
|
||||||
|
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
|
||||||
|
if(arch_count EQUAL 0)
|
||||||
|
message(WARNING "Unable to determine target architecture. "
|
||||||
|
"Consider providing a value for the CMAKE_OSX_ARCHITECTURES cache variable. "
|
||||||
|
"Continuing without vcpkg.")
|
||||||
|
set(VCPKG_TOOLCHAIN ON)
|
||||||
|
return()
|
||||||
|
else()
|
||||||
|
if(arch_count GREATER 1)
|
||||||
|
message(WARNING "Detected more than one target architecture. Using the first one.")
|
||||||
|
endif()
|
||||||
|
list(GET CMAKE_OSX_ARCHITECTURES 0 target_arch)
|
||||||
|
if(target_arch STREQUAL arm64)
|
||||||
|
set(_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
||||||
|
elseif(target_arch STREQUAL arm64s)
|
||||||
|
set(_VCPKG_TARGET_TRIPLET_ARCH arm64s)
|
||||||
|
elseif(target_arch STREQUAL armv7s)
|
||||||
|
set(_VCPKG_TARGET_TRIPLET_ARCH armv7s)
|
||||||
|
elseif(target_arch STREQUAL armv7)
|
||||||
|
set(_VCPKG_TARGET_TRIPLET_ARCH arm)
|
||||||
|
elseif(target_arch STREQUAL x86_64)
|
||||||
|
set(_VCPKG_TARGET_TRIPLET_ARCH x64)
|
||||||
|
elseif(target_arch STREQUAL i386)
|
||||||
|
set(_VCPKG_TARGET_TRIPLET_ARCH x86)
|
||||||
|
else()
|
||||||
|
message(WARNING "Unable to determine target architecture, continuing without vcpkg.")
|
||||||
|
set(VCPKG_TOOLCHAIN ON)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
set(_VCPKG_TARGET_TRIPLET_ARCH x64)
|
set(_VCPKG_TARGET_TRIPLET_ARCH x64)
|
||||||
else()
|
else()
|
||||||
|
@ -96,6 +127,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HO
|
||||||
set(_VCPKG_TARGET_TRIPLET_PLAT linux)
|
set(_VCPKG_TARGET_TRIPLET_PLAT linux)
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin"))
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin"))
|
||||||
set(_VCPKG_TARGET_TRIPLET_PLAT osx)
|
set(_VCPKG_TARGET_TRIPLET_PLAT osx)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
|
set(_VCPKG_TARGET_TRIPLET_PLAT ios)
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows"))
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows"))
|
||||||
set(_VCPKG_TARGET_TRIPLET_PLAT windows)
|
set(_VCPKG_TARGET_TRIPLET_PLAT windows)
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD"))
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD"))
|
||||||
|
@ -146,6 +179,8 @@ else() #Release build: Put Release paths before Debug paths. Debug Paths are req
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(VCPKG_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
|
||||||
|
|
||||||
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
||||||
set(_PROGRAMFILESX86 "PROGRAMFILES(x86)")
|
set(_PROGRAMFILESX86 "PROGRAMFILES(x86)")
|
||||||
file(TO_CMAKE_PATH "$ENV{${_PROGRAMFILESX86}}" _programfiles_x86)
|
file(TO_CMAKE_PATH "$ENV{${_PROGRAMFILESX86}}" _programfiles_x86)
|
||||||
|
@ -235,7 +270,15 @@ if(NOT DEFINED VCPKG_OVERRIDE_FIND_PACKAGE_NAME)
|
||||||
set(VCPKG_OVERRIDE_FIND_PACKAGE_NAME find_package)
|
set(VCPKG_OVERRIDE_FIND_PACKAGE_NAME find_package)
|
||||||
endif()
|
endif()
|
||||||
macro(${VCPKG_OVERRIDE_FIND_PACKAGE_NAME} name)
|
macro(${VCPKG_OVERRIDE_FIND_PACKAGE_NAME} name)
|
||||||
|
# Workaround to set the ROOT_PATH until upstream CMake stops overriding
|
||||||
|
# the ROOT_PATH at apple OS initialization phase.
|
||||||
|
# See https://gitlab.kitware.com/cmake/cmake/merge_requests/3273
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
|
||||||
|
set(BACKUP_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
|
||||||
|
list(APPEND CMAKE_FIND_ROOT_PATH ${VCPKG_CMAKE_FIND_ROOT_PATH})
|
||||||
|
endif()
|
||||||
string(TOLOWER "${name}" _vcpkg_lowercase_name)
|
string(TOLOWER "${name}" _vcpkg_lowercase_name)
|
||||||
|
|
||||||
if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake")
|
if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake")
|
||||||
set(ARGS "${ARGV}")
|
set(ARGS "${ARGV}")
|
||||||
include(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake)
|
include(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake)
|
||||||
|
@ -285,6 +328,9 @@ macro(${VCPKG_OVERRIDE_FIND_PACKAGE_NAME} name)
|
||||||
else()
|
else()
|
||||||
_find_package(${ARGV})
|
_find_package(${ARGV})
|
||||||
endif()
|
endif()
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH "${BACKUP_CMAKE_FIND_ROOT_PATH}")
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
set(VCPKG_TOOLCHAIN ON)
|
set(VCPKG_TOOLCHAIN ON)
|
||||||
|
@ -301,13 +347,15 @@ if(NOT _CMAKE_IN_TRY_COMPILE)
|
||||||
file(TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir)
|
file(TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir)
|
||||||
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake"
|
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake"
|
||||||
"set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n"
|
"set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n"
|
||||||
|
"set(VCPKG_TARGET_ARCHITECTURE \"${VCPKG_TARGET_ARCHITECTURE}\" CACHE STRING \"\")\n"
|
||||||
"set(VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n"
|
"set(VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n"
|
||||||
"set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n"
|
"set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n"
|
||||||
"set(_VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n"
|
"set(_VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
|
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
|
||||||
VCPKG_TARGET_TRIPLET
|
VCPKG_TARGET_TRIPLET
|
||||||
|
VCPKG_TARGET_ARCHITECTURE
|
||||||
VCPKG_APPLOCAL_DEPS
|
VCPKG_APPLOCAL_DEPS
|
||||||
VCPKG_CHAINLOAD_TOOLCHAIN_FILE
|
VCPKG_CHAINLOAD_TOOLCHAIN_FILE
|
||||||
_VCPKG_ROOT_DIR
|
_VCPKG_ROOT_DIR
|
||||||
|
|
|
@ -202,6 +202,8 @@ function(vcpkg_configure_cmake)
|
||||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/android.cmake")
|
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/android.cmake")
|
||||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/osx.cmake")
|
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/osx.cmake")
|
||||||
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
|
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/ios.cmake")
|
||||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake")
|
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake")
|
||||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
|
||||||
|
@ -243,7 +245,7 @@ function(vcpkg_configure_cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Sets configuration variables for macOS builds
|
# Sets configuration variables for macOS builds
|
||||||
foreach(config_var INSTALL_NAME_DIR OSX_DEPLOYMENT_TARGET OSX_SYSROOT)
|
foreach(config_var INSTALL_NAME_DIR OSX_DEPLOYMENT_TARGET OSX_SYSROOT OSX_ARCHITECTURES)
|
||||||
if(DEFINED VCPKG_${config_var})
|
if(DEFINED VCPKG_${config_var})
|
||||||
list(APPEND _csc_OPTIONS "-DCMAKE_${config_var}=${VCPKG_${config_var}}")
|
list(APPEND _csc_OPTIONS "-DCMAKE_${config_var}=${VCPKG_${config_var}}")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
if(NOT _VCPKG_IOS_TOOLCHAIN)
|
||||||
|
set(_VCPKG_IOS_TOOLCHAIN 1)
|
||||||
|
|
||||||
|
# Set the CMAKE_SYSTEM_NAME for try_compile calls.
|
||||||
|
set(CMAKE_SYSTEM_NAME iOS CACHE STRING "")
|
||||||
|
|
||||||
|
macro(_vcpkg_setup_ios_arch arch)
|
||||||
|
unset(_vcpkg_ios_system_processor)
|
||||||
|
unset(_vcpkg_ios_sysroot)
|
||||||
|
unset(_vcpkg_ios_target_architecture)
|
||||||
|
|
||||||
|
if ("${arch}" STREQUAL "arm64")
|
||||||
|
set(_vcpkg_ios_system_processor "aarch64")
|
||||||
|
set(_vcpkg_ios_target_architecture "arm64")
|
||||||
|
elseif("${arch}" STREQUAL "arm")
|
||||||
|
set(_vcpkg_ios_system_processor "arm")
|
||||||
|
set(_vcpkg_ios_target_architecture "armv7")
|
||||||
|
elseif("${arch}" STREQUAL "x64")
|
||||||
|
set(_vcpkg_ios_sysroot "iphonesimulator")
|
||||||
|
set(_vcpkg_ios_target_architecture "x86_64")
|
||||||
|
elseif("${arch}" STREQUAL "x86")
|
||||||
|
set(_vcpkg_ios_sysroot "iphonesimulator")
|
||||||
|
set(_vcpkg_ios_target_architecture "i386")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Unknown VCPKG_TARGET_ARCHITECTURE value provided for triplet ${VCPKG_TARGET_TRIPLET}: ${arch}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
_vcpkg_setup_ios_arch("${VCPKG_TARGET_ARCHITECTURE}")
|
||||||
|
if(_vcpkg_ios_system_processor AND NOT CMAKE_SYSTEM_PROCESSOR)
|
||||||
|
set(CMAKE_SYSTEM_PROCESSOR ${_vcpkg_ios_system_processor})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# If VCPKG_OSX_ARCHITECTURES or VCPKG_OSX_SYSROOT is set in the triplet, they will take priority,
|
||||||
|
# so the following will be no-ops.
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "${_vcpkg_ios_target_architecture}" CACHE STRING "Build architectures for iOS")
|
||||||
|
if(_vcpkg_ios_sysroot)
|
||||||
|
set(CMAKE_OSX_SYSROOT ${_vcpkg_ios_sysroot} CACHE STRING "iOS sysroot")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
|
||||||
|
if(NOT _CMAKE_IN_TRY_COMPILE)
|
||||||
|
string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
|
||||||
|
string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ")
|
||||||
|
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")
|
||||||
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ")
|
||||||
|
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ")
|
||||||
|
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ")
|
||||||
|
|
||||||
|
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
|
||||||
|
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
|
||||||
|
endif()
|
||||||
|
endif()
|
|
@ -0,0 +1,4 @@
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE arm)
|
||||||
|
set(VCPKG_CRT_LINKAGE dynamic)
|
||||||
|
set(VCPKG_LIBRARY_LINKAGE static)
|
||||||
|
set(VCPKG_CMAKE_SYSTEM_NAME iOS)
|
|
@ -0,0 +1,4 @@
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE arm64)
|
||||||
|
set(VCPKG_CRT_LINKAGE dynamic)
|
||||||
|
set(VCPKG_LIBRARY_LINKAGE static)
|
||||||
|
set(VCPKG_CMAKE_SYSTEM_NAME iOS)
|
|
@ -0,0 +1,4 @@
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||||
|
set(VCPKG_CRT_LINKAGE dynamic)
|
||||||
|
set(VCPKG_LIBRARY_LINKAGE static)
|
||||||
|
set(VCPKG_CMAKE_SYSTEM_NAME iOS)
|
|
@ -0,0 +1,4 @@
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE x86)
|
||||||
|
set(VCPKG_CRT_LINKAGE dynamic)
|
||||||
|
set(VCPKG_LIBRARY_LINKAGE static)
|
||||||
|
set(VCPKG_CMAKE_SYSTEM_NAME iOS)
|
Загрузка…
Ссылка в новой задаче