2017-05-29 04:07:20 +08:00
# Mark variables as used so cmake doesn't complain about them
2017-10-17 02:22:21 +08:00
mark_as_advanced ( CMAKE_TOOLCHAIN_FILE )
2020-06-04 10:31:28 +08:00
# VCPKG toolchain options.
2020-01-10 07:26:27 +08:00
option ( VCPKG_VERBOSE "Enables messages from the VCPKG toolchain for debugging purposes." OFF )
mark_as_advanced ( VCPKG_VERBOSE )
2020-09-04 00:58:15 +08:00
include ( CMakeDependentOption )
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
function ( _vcpkg_get_directory_name_of_file_above OUT DIRECTORY FILENAME )
set ( _vcpkg_get_dir_candidate ${ DIRECTORY } )
while ( IS_DIRECTORY ${ _vcpkg_get_dir_candidate } AND NOT DEFINED _vcpkg_get_dir_out )
if ( EXISTS ${ _vcpkg_get_dir_candidate } / ${ FILENAME } )
set ( _vcpkg_get_dir_out ${ _vcpkg_get_dir_candidate } )
else ( )
get_filename_component ( _vcpkg_get_dir_candidate_tmp ${ _vcpkg_get_dir_candidate } DIRECTORY )
if ( _vcpkg_get_dir_candidate STREQUAL _vcpkg_get_dir_candidate_tmp ) # we've reached the root
set ( _vcpkg_get_dir_out "${OUT}-NOTFOUND" )
else ( )
set ( _vcpkg_get_dir_candidate ${ _vcpkg_get_dir_candidate_tmp } )
endif ( )
endif ( )
endwhile ( )
set ( ${ OUT } ${ _vcpkg_get_dir_out } CACHE INTERNAL "_vcpkg_get_directory_name_of_file_above: ${OUT}" )
endfunction ( )
2020-11-13 02:16:24 +08:00
#[===[
W e u s e t h i s s y s t e m , i n s t e a d o f ` message ( FATAL_ERROR ) ` ,
s i n c e c m a k e p r i n t s a l o t o f n o n s e n s e i f t h e t o o l c h a i n e r r o r s o u t b e f o r e i t ' s f o u n d t h e b u i l d t o o l s .
T h i s ` _ V C P K G _ H A S _ F A T A L _ E R R O R ` m u s t b e c h e c k e d b e f o r e a n y f i l e s y s t e m o p e r a t i o n s a r e d o n e ,
s i n c e o t h e r w i s e y o u m i g h t b e d o i n g s o m e t h i n g w i t h b a d v a r i a b l e s s e t u p .
#]===]
set ( _VCPKG_FATAL_ERROR )
set ( _VCPKG_HAS_FATAL_ERROR OFF )
function ( _vcpkg_add_fatal_error ERROR )
if ( NOT _VCPKG_HAS_FATAL_ERROR )
set ( _VCPKG_HAS_FATAL_ERROR ON PARENT_SCOPE )
set ( _VCPKG_FATAL_ERROR "${ERROR}" PARENT_SCOPE )
else ( )
string ( APPEND _VCPKG_FATAL_ERROR "\n${ERROR}" )
endif ( )
endfunction ( )
2020-08-22 17:04:16 +08:00
if ( NOT DEFINED VCPKG_MANIFEST_DIR )
if ( EXISTS "${CMAKE_SOURCE_DIR}/vcpkg.json" )
2020-08-23 13:12:51 +08:00
set ( _VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}" )
2020-08-22 17:04:16 +08:00
endif ( )
else ( )
set ( _VCPKG_MANIFEST_DIR ${ VCPKG_MANIFEST_DIR } )
endif ( )
2020-07-10 03:32:31 +08:00
if ( NOT DEFINED VCPKG_MANIFEST_MODE )
if ( _VCPKG_MANIFEST_DIR )
set ( VCPKG_MANIFEST_MODE ON )
else ( )
set ( VCPKG_MANIFEST_MODE OFF )
endif ( )
elseif ( VCPKG_MANIFEST_MODE AND NOT _VCPKG_MANIFEST_DIR )
2020-11-13 02:16:24 +08:00
_vcpkg_add_fatal_error (
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
" v c p k g m a n i f e s t m o d e w a s e n a b l e d , b u t w e c o u l d n ' t f i n d a m a n i f e s t file ( vcpkg.json ) "
" i n a n y d i r e c t o r i e s a b o v e $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } . P l e a s e a d d a m a n i f e s t , o r "
" d i s a b l e m a n i f e s t s b y t u r n i n g o f f V C P K G _ M A N I F E S T _ M O D E . " )
endif ( )
2020-09-04 00:58:15 +08:00
if ( NOT DEFINED _INTERNAL_CHECK_VCPKG_MANIFEST_MODE )
set ( _INTERNAL_CHECK_VCPKG_MANIFEST_MODE "${VCPKG_MANIFEST_MODE}"
C A C H E I N T E R N A L " M a k i n g s u r e V C P K G _ M A N I F E S T _ M O D E d o e s n ' t c h a n g e " )
endif ( )
if ( NOT VCPKG_MANIFEST_MODE STREQUAL _INTERNAL_CHECK_VCPKG_MANIFEST_MODE )
2020-11-13 02:16:24 +08:00
_vcpkg_add_fatal_error ( [[
2020-09-04 00:58:15 +08:00
v c p k g m a n i f e s t m o d e w a s e n a b l e d f o r a b u i l d d i r e c t o r y w h e r e i t w a s i n i t i a l l y d i s a b l e d .
T h i s i s n o t s u p p o r t e d . P l e a s e d e l e t e t h e b u i l d d i r e c t o r y a n d r e c o n f i g u r e .
] ] )
endif ( )
CMAKE_DEPENDENT_OPTION ( VCPKG_MANIFEST_INSTALL [[
2020-07-10 03:32:31 +08:00
I n s t a l l t h e d e p e n d e n c i e s l i s t e d i n y o u r m a n i f e s t :
I f t h i s i s o f f , y o u w i l l h a v e t o m a n u a l l y i n s t a l l y o u r d e p e n d e n c i e s .
S e e h t t p s : / / g i t h u b . c o m / m i c r o s o f t / v c p k g / t r e e / m a s t e r / d o c s / s p e c i f i c a t i o n s / m a n i f e s t s . m d f o r m o r e i n f o .
] ]
2020-09-04 00:58:15 +08:00
O N
" V C P K G _ M A N I F E S T _ M O D E "
O F F )
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
2019-09-24 04:43:52 +08:00
# Determine whether the toolchain is loaded during a try-compile configuration
get_property ( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
if ( ${ CMAKE_VERSION } VERSION_LESS "3.6.0" )
set ( _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES ON )
else ( )
set ( _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES OFF )
endif ( )
if ( _CMAKE_IN_TRY_COMPILE AND _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES )
include ( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL )
2017-11-26 03:49:15 +08:00
endif ( )
2017-10-17 02:22:21 +08:00
if ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE )
include ( "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" )
endif ( )
if ( VCPKG_TOOLCHAIN )
return ( )
endif ( )
2020-03-26 04:47:07 +08:00
#If CMake does not have a mapping for MinSizeRel and RelWithDebInfo in imported targets
#it will map those configuration to the first valid configuration in CMAKE_CONFIGURATION_TYPES or the targets IMPORTED_CONFIGURATIONS.
2020-06-04 10:31:28 +08:00
#In most cases this is the debug configuration which is wrong.
2020-03-26 04:47:07 +08:00
if ( NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL )
set ( CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;" )
if ( VCPKG_VERBOSE )
message ( STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL set to MinSizeRel;Release;" )
2020-01-10 07:26:27 +08:00
endif ( )
2020-03-26 04:47:07 +08:00
endif ( )
if ( NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO )
set ( CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;" )
if ( VCPKG_VERBOSE )
message ( STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO set to RelWithDebInfo;Release;" )
2020-01-10 07:26:27 +08:00
endif ( )
endif ( )
2017-10-17 02:22:21 +08:00
if ( VCPKG_TARGET_TRIPLET )
2020-10-13 06:09:20 +08:00
# This is required since a user might do: 'set(VCPKG_TARGET_TRIPLET somevalue)' [no CACHE] before the first project() call
# Latter within the toolchain file we do: 'set(VCPKG_TARGET_TRIPLET somevalue CACHE STRING "")' which
2020-11-02 09:12:49 +08:00
# will otherwise override the user setting of VCPKG_TARGET_TRIPLET in the current scope of the toolchain since the CACHE value
# did not exist previously. Since the value is newly created CMake will use the CACHE value within this scope since it is the more
2020-10-13 06:09:20 +08:00
# recently created value in directory scope. This 'strange' behaviour only happens on the very first configure call since subsequent
# configure call will see the user value as the more recent value. The same logic must be applied to all cache values within this file!
2020-11-02 09:12:49 +08:00
# The FORCE keyword is required to ALWAYS lift the user provided/previously set value into a CACHE value.
2020-10-13 06:09:20 +08:00
set ( VCPKG_TARGET_TRIPLET ${ VCPKG_TARGET_TRIPLET } CACHE STRING "Vcpkg target triplet (ex. x86-windows)" FORCE )
2017-10-17 02:22:21 +08:00
elseif ( CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH x86 )
elseif ( CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
elseif ( CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
2018-01-04 07:19:52 +08:00
elseif ( CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH arm64 )
2017-10-17 02:22:21 +08:00
else ( )
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 Win64$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$" )
2016-09-19 11:50:08 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x86 )
2017-10-17 02:22:21 +08:00
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$" )
2016-09-19 11:50:08 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
2017-12-20 08:18:13 +08:00
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$" )
2016-09-19 11:50:08 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
2017-12-20 08:18:13 +08:00
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$" )
2017-10-17 02:22:21 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x86 )
2019-04-12 14:03:35 +08:00
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 16 2019$" )
2020-01-25 04:26:35 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
2016-09-19 11:50:08 +08:00
else ( )
2017-10-17 02:22:21 +08:00
find_program ( _VCPKG_CL cl )
if ( _VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$" )
2016-09-19 11:50:08 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
2017-10-17 02:22:21 +08:00
elseif ( _VCPKG_CL MATCHES "arm/cl.exe$" )
2016-09-19 11:50:08 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
2018-01-04 07:19:52 +08:00
elseif ( _VCPKG_CL MATCHES "arm64/cl.exe$" )
2018-03-30 12:14:06 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH arm64 )
2017-10-17 02:22:21 +08:00
elseif ( _VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$" )
2016-11-19 14:33:31 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x86 )
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
2020-04-16 04:06:55 +08:00
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. "
" C o n s i d e r p r o v i d i n g a v a l u e f o r t h e C M A K E _ O S X _ A R C H I T E C T U R E S c a c h e v a r i a b l e . "
" C o n t i n u i n g w i t h o u t v c p k g . " )
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 ( )
2020-05-22 02:39:03 +08:00
elseif ( CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64" )
2017-11-26 07:53:32 +08:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
2020-07-24 05:16:01 +08:00
elseif ( CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "s390x" )
set ( _VCPKG_TARGET_TRIPLET_ARCH s390x )
2020-09-06 01:45:48 +08:00
elseif ( CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv7l" )
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
elseif ( CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64" )
set ( _VCPKG_TARGET_TRIPLET_ARCH arm64 )
2016-09-19 11:50:08 +08:00
else ( )
2019-02-07 05:08:57 +08:00
if ( _CMAKE_IN_TRY_COMPILE )
message ( STATUS "Unable to determine target architecture, continuing without vcpkg." )
else ( )
message ( WARNING "Unable to determine target architecture, continuing without vcpkg." )
endif ( )
set ( VCPKG_TOOLCHAIN ON )
return ( )
2016-09-19 11:50:08 +08:00
endif ( )
endif ( )
2017-10-17 02:22:21 +08:00
endif ( )
2016-09-19 11:50:08 +08:00
2017-10-17 02:22:21 +08:00
if ( CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" )
set ( _VCPKG_TARGET_TRIPLET_PLAT uwp )
2018-03-13 20:56:02 +08:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Linux" OR ( NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" ) )
2017-11-26 07:53:32 +08:00
set ( _VCPKG_TARGET_TRIPLET_PLAT linux )
2018-03-13 20:56:02 +08:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR ( NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" ) )
2018-03-03 00:59:17 +08:00
set ( _VCPKG_TARGET_TRIPLET_PLAT osx )
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
2020-04-16 04:06:55 +08:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "iOS" )
set ( _VCPKG_TARGET_TRIPLET_PLAT ios )
2018-03-13 20:56:02 +08:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Windows" OR ( NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" ) )
2017-10-17 02:22:21 +08:00
set ( _VCPKG_TARGET_TRIPLET_PLAT windows )
2018-03-13 20:56:02 +08:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR ( NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD" ) )
set ( _VCPKG_TARGET_TRIPLET_PLAT freebsd )
2017-10-17 02:22:21 +08:00
endif ( )
2016-09-19 11:50:08 +08:00
2017-10-17 02:22:21 +08:00
set ( VCPKG_TARGET_TRIPLET ${ _VCPKG_TARGET_TRIPLET_ARCH } - ${ _VCPKG_TARGET_TRIPLET_PLAT } CACHE STRING "Vcpkg target triplet (ex. x86-windows)" )
set ( _VCPKG_TOOLCHAIN_DIR ${ CMAKE_CURRENT_LIST_DIR } )
2017-04-21 07:19:39 +08:00
2017-12-09 14:03:03 +08:00
if ( NOT DEFINED _VCPKG_ROOT_DIR )
# Detect .vcpkg-root to figure VCPKG_ROOT_DIR
set ( _VCPKG_ROOT_DIR_CANDIDATE ${ CMAKE_CURRENT_LIST_DIR } )
while ( IS_DIRECTORY ${ _VCPKG_ROOT_DIR_CANDIDATE } AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root" )
get_filename_component ( _VCPKG_ROOT_DIR_TEMP ${ _VCPKG_ROOT_DIR_CANDIDATE } DIRECTORY )
if ( _VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE ) # If unchanged, we have reached the root of the drive
else ( )
SET ( _VCPKG_ROOT_DIR_CANDIDATE ${ _VCPKG_ROOT_DIR_TEMP } )
endif ( )
endwhile ( )
2017-12-10 09:25:12 +08:00
set ( _VCPKG_ROOT_DIR ${ _VCPKG_ROOT_DIR_CANDIDATE } CACHE INTERNAL "Vcpkg root directory" )
2017-12-09 14:03:03 +08:00
endif ( )
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
_vcpkg_get_directory_name_of_file_above ( _VCPKG_ROOT_DIR ${ CMAKE_CURRENT_LIST_DIR } ".vcpkg-root" )
if ( NOT _VCPKG_ROOT_DIR )
2020-11-13 02:16:24 +08:00
_vcpkg_add_fatal_error ( "Could not find .vcpkg-root" )
2020-06-04 10:31:28 +08:00
endif ( )
2017-10-17 02:22:21 +08:00
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
if ( NOT DEFINED _VCPKG_INSTALLED_DIR )
if ( _VCPKG_MANIFEST_DIR )
2020-07-10 03:32:31 +08:00
set ( _VCPKG_INSTALLED_DIR ${ CMAKE_BINARY_DIR } /vcpkg_installed )
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
else ( )
set ( _VCPKG_INSTALLED_DIR ${ _VCPKG_ROOT_DIR } /installed )
endif ( )
set ( _VCPKG_INSTALLED_DIR ${ _VCPKG_INSTALLED_DIR }
C A C H E P A T H
" T h e d i r e c t o r y w h i c h c o n t a i n s t h e i n s t a l l e d l i b r a r i e s f o r e a c h t r i p l e t " )
2018-02-24 08:50:32 +08:00
endif ( )
2019-05-25 07:35:40 +08:00
if ( CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_TYPE ) #Debug build: Put Debug paths before Release paths.
2016-09-19 11:50:08 +08:00
list ( APPEND CMAKE_PREFIX_PATH
2019-03-15 05:24:29 +08:00
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T }
2016-09-19 11:50:08 +08:00
)
2016-11-26 15:10:27 +08:00
list ( APPEND CMAKE_LIBRARY_PATH
2019-03-15 05:24:29 +08:00
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g / l i b / m a n u a l - l i n k $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / l i b / m a n u a l - l i n k
2016-11-26 15:10:27 +08:00
)
2017-11-26 03:49:15 +08:00
list ( APPEND CMAKE_FIND_ROOT_PATH
2019-03-15 05:24:29 +08:00
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T }
)
else ( ) #Release build: Put Release paths before Debug paths. Debug Paths are required so that CMake generates correct info in autogenerated target files.
list ( APPEND CMAKE_PREFIX_PATH
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g
)
list ( APPEND CMAKE_LIBRARY_PATH
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / l i b / m a n u a l - l i n k $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g / l i b / m a n u a l - l i n k
)
list ( APPEND CMAKE_FIND_ROOT_PATH
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g
2017-11-26 03:49:15 +08:00
)
2017-10-17 02:22:21 +08:00
endif ( )
2016-09-19 11:50:08 +08:00
2020-07-10 03:32:31 +08:00
# If one CMAKE_FIND_ROOT_PATH_MODE_* variables is set to ONLY, to make sure that ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
2020-07-08 06:01:01 +08:00
# and ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug are searched, it is not sufficient to just add them to CMAKE_FIND_ROOT_PATH,
2020-07-10 03:32:31 +08:00
# as CMAKE_FIND_ROOT_PATH specify "one or more directories to be prepended to all other search directories", so to make sure that
2020-07-08 06:01:01 +08:00
# the libraries are searched as they are, it is necessary to add "/" to the CMAKE_PREFIX_PATH
2020-07-10 03:32:31 +08:00
if ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE STREQUAL "ONLY" OR
2020-07-08 06:01:01 +08:00
C M A K E _ F I N D _ R O O T _ P A T H _ M O D E _ L I B R A R Y S T R E Q U A L " O N L Y " O R
C M A K E _ F I N D _ R O O T _ P A T H _ M O D E _ P A C K A G E S T R E Q U A L " O N L Y " )
list ( APPEND CMAKE_PREFIX_PATH "/" )
endif ( )
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
2020-04-16 04:06:55 +08:00
set ( VCPKG_CMAKE_FIND_ROOT_PATH ${ CMAKE_FIND_ROOT_PATH } )
2017-10-17 02:22:21 +08:00
file ( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles )
2019-05-13 15:11:07 +08:00
set ( _PROGRAMFILESX86 "PROGRAMFILES(x86)" )
file ( TO_CMAKE_PATH "$ENV{${_PROGRAMFILESX86}}" _programfiles_x86 )
2017-10-17 02:22:21 +08:00
set ( CMAKE_SYSTEM_IGNORE_PATH
" $ { _ p r o g r a m f i l e s } / O p e n S S L "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 3 2 "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 6 4 "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 3 2 / l i b / V C "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 6 4 / l i b / V C "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 3 2 / l i b / V C / s t a t i c "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 6 4 / l i b / V C / s t a t i c "
2019-05-13 09:37:02 +08:00
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 3 2 "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 6 4 "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 3 2 / l i b / V C "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 6 4 / l i b / V C "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 3 2 / l i b / V C / s t a t i c "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 6 4 / l i b / V C / s t a t i c "
2017-10-17 02:22:21 +08:00
" C : / O p e n S S L / "
" C : / O p e n S S L - W i n 3 2 / "
" C : / O p e n S S L - W i n 6 4 / "
" C : / O p e n S S L - W i n 3 2 / l i b / V C "
" C : / O p e n S S L - W i n 6 4 / l i b / V C "
" C : / O p e n S S L - W i n 3 2 / l i b / V C / s t a t i c "
" C : / O p e n S S L - W i n 6 4 / l i b / V C / s t a t i c "
)
2017-03-21 16:48:40 +08:00
2017-12-09 14:03:03 +08:00
list ( APPEND CMAKE_PROGRAM_PATH ${ _VCPKG_INSTALLED_DIR } / ${ VCPKG_TARGET_TRIPLET } /tools )
2017-10-17 02:22:21 +08:00
file ( GLOB _VCPKG_TOOLS_DIRS ${ _VCPKG_INSTALLED_DIR } / ${ VCPKG_TARGET_TRIPLET } /tools/* )
2020-11-02 09:12:49 +08:00
foreach ( _VCPKG_TOOLS_DIR IN LISTS _VCPKG_TOOLS_DIRS )
if ( IS_DIRECTORY "${_VCPKG_TOOLS_DIR}" )
list ( APPEND CMAKE_PROGRAM_PATH "${_VCPKG_TOOLS_DIR}" )
2017-10-17 02:22:21 +08:00
endif ( )
endforeach ( )
2016-11-26 15:10:27 +08:00
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
# CMAKE_EXECUTABLE_SUFFIX is not yet defined
if ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" )
2020-07-10 03:32:31 +08:00
set ( _VCPKG_EXECUTABLE "${_VCPKG_ROOT_DIR}/vcpkg.exe" )
set ( _VCPKG_BOOTSTRAP_SCRIPT "${_VCPKG_ROOT_DIR}/bootstrap-vcpkg.bat" )
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
else ( )
2020-07-10 03:32:31 +08:00
set ( _VCPKG_EXECUTABLE "${_VCPKG_ROOT_DIR}/vcpkg" )
set ( _VCPKG_BOOTSTRAP_SCRIPT "${_VCPKG_ROOT_DIR}/bootstrap-vcpkg.sh" )
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
endif ( )
2020-11-13 02:16:24 +08:00
if ( VCPKG_MANIFEST_MODE AND VCPKG_MANIFEST_INSTALL AND NOT _CMAKE_IN_TRY_COMPILE AND NOT _VCPKG_HAS_FATAL_ERROR )
2020-10-13 06:09:20 +08:00
set ( VCPKG_BOOTSTRAP_OPTIONS "${VCPKG_BOOTSTRAP_OPTIONS}" CACHE STRING "Additional options to bootstrap vcpkg" FORCE )
mark_as_advanced ( VCPKG_BOOTSTRAP_OPTIONS )
2020-07-10 03:32:31 +08:00
if ( NOT EXISTS "${_VCPKG_EXECUTABLE}" )
message ( STATUS "Bootstrapping vcpkg before install" )
2020-11-13 02:16:24 +08:00
file ( TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/vcpkg-bootstrap.log" _VCPKG_BOOTSTRAP_LOG )
2020-07-10 03:32:31 +08:00
execute_process (
2020-10-13 06:09:20 +08:00
C O M M A N D " $ { _ V C P K G _ B O O T S T R A P _ S C R I P T } " $ { V C P K G _ B O O T S T R A P _ O P T I O N S }
2020-11-13 02:16:24 +08:00
O U T P U T _ F I L E " $ { _ V C P K G _ B O O T S T R A P _ L O G } "
E R R O R _ F I L E " $ { _ V C P K G _ B O O T S T R A P _ L O G } "
2020-07-10 03:32:31 +08:00
R E S U L T _ V A R I A B L E _ V C P K G _ B O O T S T R A P _ R E S U L T )
2020-11-13 02:16:24 +08:00
if ( _VCPKG_BOOTSTRAP_RESULT EQUAL 0 )
message ( STATUS "Bootstrapping vcpkg before install - done" )
else ( )
message ( STATUS "Bootstrapping vcpkg before install - failed" )
_vcpkg_add_fatal_error ( "vcpkg install failed. See logs for more information: ${_VCPKG_BOOTSTRAP_LOG}" )
2020-07-10 03:32:31 +08:00
endif ( )
endif ( )
2020-11-13 02:16:24 +08:00
if ( NOT _VCPKG_HAS_FATAL_ERROR )
set ( VCPKG_OVERLAY_PORTS "${VCPKG_OVERLAY_PORTS}" CACHE STRING "Overlay ports to use for vcpkg install in manifest mode" FORCE )
mark_as_advanced ( VCPKG_OVERLAY_PORTS )
set ( VCPKG_OVERLAY_TRIPLETS "${VCPKG_OVERLAY_TRIPLETS}" CACHE STRING "Overlay triplets to use for vcpkg install in manifest mode" FORCE )
mark_as_advanced ( VCPKG_OVERLAY_TRIPLETS )
set ( VCPKG_INSTALL_OPTIONS "${VCPKG_INSTALL_OPTIONS}" CACHE STRING "Additional install options to pass to vcpkg" FORCE )
mark_as_advanced ( VCPKG_INSTALL_OPTIONS )
message ( STATUS "Running vcpkg install" )
set ( _VCPKG_ADDITIONAL_MANIFEST_PARAMS )
if ( VCPKG_OVERLAY_PORTS )
foreach ( _overlay_port IN LISTS VCPKG_OVERLAY_PORTS )
list ( APPEND _VCPKG_ADDITIONAL_MANIFEST_PARAMS "--overlay-ports=${_overlay_port}" )
endforeach ( )
endif ( )
if ( VCPKG_OVERLAY_TRIPLETS )
foreach ( _overlay_triplet IN LISTS VCPKG_OVERLAY_TRIPLETS )
list ( APPEND _VCPKG_ADDITIONAL_MANIFEST_PARAMS "--overlay-triplets=${_overlay_triplet}" )
endforeach ( )
endif ( )
2020-07-10 03:32:31 +08:00
2020-11-13 02:16:24 +08:00
foreach ( feature IN LISTS VCPKG_MANIFEST_FEATURES )
list ( APPEND _VCPKG_ADDITIONAL_MANIFEST_PARAMS "--x-feature=${feature}" )
2020-09-12 01:57:47 +08:00
endforeach ( )
2020-11-13 02:16:24 +08:00
if ( VCPKG_MANIFEST_NO_DEFAULT_FEATURES )
list ( APPEND _VCPKG_ADDITIONAL_MANIFEST_PARAMS "--x-no-default-features" )
endif ( )
2020-08-02 07:45:00 +08:00
2020-11-13 02:16:24 +08:00
file ( TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/vcpkg-manifest-install.log" _VCPKG_MANIFEST_INSTALL_LOG )
execute_process (
C O M M A N D " $ { _ V C P K G _ E X E C U T A B L E } " i n s t a l l
- - t r i p l e t " $ { V C P K G _ T A R G E T _ T R I P L E T } "
- - v c p k g - r o o t " $ { _ V C P K G _ R O O T _ D I R } "
" - - x - w a i t - f o r - l o c k "
" - - x - m a n i f e s t - r o o t = $ { _ V C P K G _ M A N I F E S T _ D I R } "
" - - x - i n s t a l l - r o o t = $ { _ V C P K G _ I N S T A L L E D _ D I R } "
$ { _ V C P K G _ A D D I T I O N A L _ M A N I F E S T _ P A R A M S }
$ { V C P K G _ I N S T A L L _ O P T I O N S }
O U T P U T _ F I L E " $ { _ V C P K G _ M A N I F E S T _ I N S T A L L _ L O G } "
E R R O R _ F I L E " $ { _ V C P K G _ M A N I F E S T _ I N S T A L L _ L O G } "
R E S U L T _ V A R I A B L E _ V C P K G _ I N S T A L L _ R E S U L T
)
2020-08-02 07:45:00 +08:00
2020-11-13 02:16:24 +08:00
if ( _VCPKG_INSTALL_RESULT EQUAL 0 )
message ( STATUS "Running vcpkg install - done" )
2020-07-10 03:32:31 +08:00
2020-11-13 02:16:24 +08:00
set_property ( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
" $ { _ V C P K G _ M A N I F E S T _ D I R } / v c p k g . j s o n "
" $ { _ V C P K G _ I N S T A L L E D _ D I R } / v c p k g / s t a t u s " )
else ( )
message ( STATUS "Running vcpkg install - failed" )
_vcpkg_add_fatal_error ( "vcpkg install failed. See logs for more information: ${_VCPKG_MANIFEST_INSTALL_LOG}" )
endif ( )
[vcpkg manifest] Manifest Implementation (#11757)
==== Changes Related to manifests ====
* Add the `manifests` feature flag
* This only says whether we look for a `vcpkg.json` in the cwd, not
whether we support parsing manifests (for ports, for example)
* Changes to the manifests RFC
* `"authors"` -> `"maintainers"`
* `--x-classic-mode` -> `-manifests` \in `vcpkg_feature_flags`
* reserve `"core"` in addition to `"default"`, since that's already
reserved for features
* Add a small helper note about what identifiers must look like
* `<license-string>`: SPDX v3.8 -> v3.9
* `"feature"."description"` is allowed to be an array of strings as well
* `"version"` -> `"version-string"` for forward-compat with versions
RFC
* Add the `--feature-flags` option
* Add the ability to turn off feature flags via passing
`-<feature-flag>` to `VCPKG_FEATURE_FLAGS` or `--feature-flags`
* Add CMake toolchain support for manifests
* Requires either:
* a feature flag of `manifests` in either `Env{VCPKG_FEATURE_FLAGS}`
or `VCPKG_FEATURE_FLAGS`
* Passing the `VCPKG_ENABLE_MANIFESTS` option
* The toolchain will install your packages to
`${VCPKG_MANIFEST_DIR}/vcpkg_installed`.
* Add MSBuild `vcpkg integrate install` support for manifests
* Requires `VcpkgEnableManifest` to be true
* `vcpkg create` creates a port that has a `vcpkg.json` instead of a
`CONTROL`
* argparse, abseil, 3fd, and avisynthplus ports switched to manifest
from CONTROL
* Add support for `--x-manifest-root`, as well as code for finding it if
not passed
* Add support for parsing manifests!
* Add a filesystem lock!
==== Important Changes which are somewhat unrelated to manifests ====
* Rename `logicexpression.{h,cpp}` to `platform-expression.{h,cpp}`
* Add `PlatformExpression` type which takes the place of the old logic
expression
* Split the parsing of platform expressions from checking whether
they're true or not
* Eagerly parse PlatformExpressions as opposed to leaving them as
strings
* Add checking for feature flag consistency
* i.e., if `-binarycaching` is passed, you shouldn't be passing
`--binarysource`
* Add the `Json::Reader` type which, with the help of user-defined
visitors, converts JSON to your internal type
* VcpkgArgParser: place the switch names into a constant as opposed to
using magic constants
* In general update the parsing code so that this ^ works
* Add `Port-Version` fields to CONTROL files
* This replaces the existing practice of
`Version: <my-version>-<port-version>`
==== Smaller changes ====
* small drive-by cleanups to some CMake
* `${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}` ->
`${CURRENT_INSTALLED_DIR}`
* Remove `-analyze` when compiling with clang-cl, since that's not a
supported flag (vcpkg's build system)
* Add a message about which compiler is detected by vcpkg's build
system machinery
* Fix `Expected::then`
* Convert `""` to `{}` for `std::string` and `fs::path`, to avoid a
`strlen` (additionally, `.empty()` instead of `== ""`, and `.clear()`)
* Add `Strings::strto` which converts strings to numeric types
* Support built-in arrays and `StringView` for `Strings::join`
* Add `operator<` and friends to `StringView`
* Add `substr` to `StringView`
* SourceParagraphParser gets some new errors
2020-07-01 01:40:18 +08:00
endif ( )
endif ( )
2017-10-17 02:22:21 +08:00
option ( VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON )
2020-10-20 10:52:36 +08:00
option ( X_VCPKG_APPLOCAL_DEPS_SERIALIZED "(experimental) Add USES_TERMINAL to VCPKG_APPLOCAL_DEPS to force serialization." OFF )
2020-10-28 11:48:14 +08:00
function ( _vcpkg_set_powershell_path )
# Attempt to use pwsh if it is present; otherwise use powershell
if ( NOT DEFINED _VCPKG_POWERSHELL_PATH )
find_program ( _VCPKG_PWSH_PATH pwsh )
2020-11-02 09:12:49 +08:00
if ( _VCPKG_PWSH_PATH )
set ( _VCPKG_POWERSHELL_PATH "${_VCPKG_PWSH_PATH}" CACHE INTERNAL "The path to the PowerShell implementation to use." )
else ( )
2020-10-28 11:48:14 +08:00
message ( DEBUG "vcpkg: Could not find PowerShell Core; falling back to PowerShell" )
find_program ( _VCPKG_BUILTIN_POWERSHELL_PATH powershell REQUIRED )
2020-11-02 09:12:49 +08:00
if ( _VCPKG_BUILTIN_POWERSHELL_PATH )
set ( _VCPKG_POWERSHELL_PATH "${_VCPKG_BUILTIN_POWERSHELL_PATH}" CACHE INTERNAL "The path to the PowerShell implementation to use." )
else ( )
message ( WARNING "vcpkg: Could not find PowerShell; using static string 'powershell.exe'" )
set ( _VCPKG_POWERSHELL_PATH "powershell.exe" CACHE INTERNAL "The path to the PowerShell implementation to use." )
endif ( )
2020-10-28 11:48:14 +08:00
endif ( )
endif ( ) # _VCPKG_POWERSHELL_PATH
endfunction ( )
2017-10-17 02:22:21 +08:00
function ( add_executable name )
_add_executable ( ${ ARGV } )
list ( FIND ARGV "IMPORTED" IMPORTED_IDX )
list ( FIND ARGV "ALIAS" ALIAS_IDX )
2019-05-19 14:33:16 +08:00
list ( FIND ARGV "MACOSX_BUNDLE" MACOSX_BUNDLE_IDX )
2017-10-17 02:22:21 +08:00
if ( IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1 )
2019-06-01 04:49:13 +08:00
if ( VCPKG_APPLOCAL_DEPS )
2019-05-17 04:24:03 +08:00
if ( _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" )
2020-10-28 11:48:14 +08:00
_vcpkg_set_powershell_path ( )
2020-10-20 10:52:36 +08:00
set ( EXTRA_OPTIONS "" )
if ( X_VCPKG_APPLOCAL_DEPS_SERIALIZED )
set ( EXTRA_OPTIONS USES_TERMINAL )
endif ( )
2019-05-17 04:24:03 +08:00
add_custom_command ( TARGET ${ name } POST_BUILD
2020-10-28 11:48:14 +08:00
C O M M A N D " $ { _ V C P K G _ P O W E R S H E L L _ P A T H } " - n o p r o f i l e - e x e c u t i o n p o l i c y B y p a s s - f i l e " $ { _ V C P K G _ T O O L C H A I N _ D I R } / m s b u i l d / a p p l o c a l . p s 1 "
2019-05-17 04:24:03 +08:00
- t a r g e t B i n a r y $ < T A R G E T _ F I L E : $ { n a m e } >
- i n s t a l l e d D i r " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ < $ < C O N F I G : D e b u g > : / d e b u g > / b i n "
- O u t V a r i a b l e o u t
2020-10-20 10:52:36 +08:00
$ { E X T R A _ O P T I O N S }
2019-05-17 04:24:03 +08:00
)
elseif ( _VCPKG_TARGET_TRIPLET_PLAT MATCHES "osx" )
2019-05-19 14:33:16 +08:00
if ( NOT MACOSX_BUNDLE_IDX EQUAL -1 )
2019-05-17 04:24:03 +08:00
add_custom_command ( TARGET ${ name } POST_BUILD
C O M M A N D p y t h o n $ { _ V C P K G _ T O O L C H A I N _ D I R } / o s x / a p p l o c a l . p y
$ < T A R G E T _ F I L E : $ { n a m e } >
" $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ < $ < C O N F I G : D e b u g > : / d e b u g > "
)
endif ( )
endif ( )
2017-07-29 02:44:54 +08:00
endif ( )
2017-10-17 02:22:21 +08:00
set_target_properties ( ${ name } PROPERTIES VS_USER_PROPS do_not_import_user.props )
set_target_properties ( ${ name } PROPERTIES VS_GLOBAL_VcpkgEnabled false )
endif ( )
endfunction ( )
2017-07-29 02:44:54 +08:00
2017-10-17 02:22:21 +08:00
function ( add_library name )
_add_library ( ${ ARGV } )
list ( FIND ARGV "IMPORTED" IMPORTED_IDX )
list ( FIND ARGV "INTERFACE" INTERFACE_IDX )
list ( FIND ARGV "ALIAS" ALIAS_IDX )
if ( IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1 )
2018-02-14 08:13:27 +08:00
get_target_property ( IS_LIBRARY_SHARED ${ name } TYPE )
2018-03-08 02:17:52 +08:00
if ( VCPKG_APPLOCAL_DEPS AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" AND ( IS_LIBRARY_SHARED STREQUAL "SHARED_LIBRARY" OR IS_LIBRARY_SHARED STREQUAL "MODULE_LIBRARY" ) )
2020-10-28 11:48:14 +08:00
_vcpkg_set_powershell_path ( )
2018-02-14 08:13:27 +08:00
add_custom_command ( TARGET ${ name } POST_BUILD
2020-10-28 11:48:14 +08:00
C O M M A N D " $ { _ V C P K G _ P O W E R S H E L L _ P A T H } " - n o p r o f i l e - e x e c u t i o n p o l i c y B y p a s s - f i l e " $ { _ V C P K G _ T O O L C H A I N _ D I R } / m s b u i l d / a p p l o c a l . p s 1 "
2018-02-14 08:13:27 +08:00
- t a r g e t B i n a r y $ < T A R G E T _ F I L E : $ { n a m e } >
- i n s t a l l e d D i r " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ < $ < C O N F I G : D e b u g > : / d e b u g > / b i n "
- O u t V a r i a b l e o u t
)
endif ( )
2017-10-17 02:22:21 +08:00
set_target_properties ( ${ name } PROPERTIES VS_USER_PROPS do_not_import_user.props )
set_target_properties ( ${ name } PROPERTIES VS_GLOBAL_VcpkgEnabled false )
endif ( )
endfunction ( )
2020-10-14 05:40:16 +08:00
# This is an experimental function to enable applocal install of dependencies as part of the `make install` process
# Arguments:
# TARGETS - a list of installed targets to have dependencies copied for
# DESTINATION - the runtime directory for those targets (usually `bin`)
function ( x_vcpkg_install_local_dependencies )
if ( _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" )
2020-11-02 09:12:49 +08:00
cmake_parse_arguments ( PARSE_ARGV __VCPKG_APPINSTALL "" "DESTINATION" "TARGETS" )
_vcpkg_set_powershell_path ( )
foreach ( TARGET IN LISTS __VCPKG_APPINSTALL_TARGETS )
2020-10-22 08:43:11 +08:00
install ( CODE "message(\" -- Installing app dependencies for ${ TARGET } ...\ " )
2020-11-02 09:12:49 +08:00
execute_process ( COMMAND \"${_VCPKG_POWERSHELL_PATH}\" -noprofile -executionpolicy Bypass -file \"${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1\"
2020-10-22 08:43:11 +08:00
- t a r g e t B i n a r y \ " \ $ { C M A K E _ I N S T A L L _ P R E F I X } / $ { _ _ V C P K G _ A P P I N S T A L L _ D E S T I N A T I O N } / $ < T A R G E T _ F I L E _ N A M E : $ { T A R G E T } > \ "
2020-10-14 05:40:16 +08:00
- i n s t a l l e d D i r \ " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ < $ < C O N F I G : D e b u g > : / d e b u g > / b i n \ "
- O u t V a r i a b l e o u t ) " )
endforeach ( )
endif ( )
endfunction ( )
2020-11-21 05:28:14 +08:00
set ( X_VCPKG_APPLOCAL_DEPS_INSTALL ${ X_VCPKG_APPLOCAL_DEPS_INSTALL } CACHE BOOL "(experimental) Automatically copy dependencies into the install target directory for executables." )
if ( X_VCPKG_APPLOCAL_DEPS_INSTALL )
function ( install )
_install ( ${ ARGV } )
if ( ARGV0 STREQUAL "TARGETS" )
# Will contain the list of targets
set ( PARSED_TARGETS "" )
# Destination - [RUNTIME] DESTINATION argument overrides this
set ( DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
# Parse arguments given to the install function to find targets and (runtime) destination
set ( MODIFIER "" ) # Modifier for the command in the argument
set ( LAST_COMMAND "" ) # Last command we found to process
foreach ( ARG ${ ARGN } )
if ( ARG MATCHES "ARCHIVE|LIBRARY|RUNTIME|OBJECTS|FRAMEWORK|BUNDLE|PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE" )
set ( MODIFIER ${ ARG } )
continue ( )
endif ( )
if ( ARG MATCHES "TARGETS|DESTINATION|PERMISSIONS|CONFIGURATIONS|COMPONENT|NAMELINK_COMPONENT|OPTIONAL|EXCLUDE_FROM_ALL|NAMELINK_ONLY|NAMELINK_SKIP" )
set ( LAST_COMMAND ${ ARG } )
continue ( )
endif ( )
if ( LAST_COMMAND STREQUAL "TARGETS" )
list ( APPEND PARSED_TARGETS "${ARG}" )
endif ( )
if ( LAST_COMMAND STREQUAL "DESTINATION" AND ( MODIFIER STREQUAL "" OR MODIFIER STREQUAL "RUNTIME" ) )
set ( DESTINATION "${ARG}" )
endif ( )
endforeach ( )
x_vcpkg_install_local_dependencies ( TARGETS ${ PARSED_TARGETS } DESTINATION ${ DESTINATION } )
endif ( )
endfunction ( )
endif ( )
2020-02-10 06:40:13 +08:00
if ( NOT DEFINED VCPKG_OVERRIDE_FIND_PACKAGE_NAME )
set ( VCPKG_OVERRIDE_FIND_PACKAGE_NAME find_package )
endif ( )
macro ( ${ VCPKG_OVERRIDE_FIND_PACKAGE_NAME } name )
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
2020-04-16 04:06:55 +08:00
# 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 ( )
2018-03-12 14:04:09 +08:00
string ( TOLOWER "${name}" _vcpkg_lowercase_name )
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
2020-04-16 04:06:55 +08:00
2018-03-12 14:04:09 +08:00
if ( EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake" )
set ( ARGS "${ARGV}" )
include ( ${ _VCPKG_INSTALLED_DIR } / ${ VCPKG_TARGET_TRIPLET } /share/ ${ _vcpkg_lowercase_name } /vcpkg-cmake-wrapper.cmake )
2018-03-14 20:08:35 +08:00
elseif ( "${name}" STREQUAL "Boost" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/boost" )
# Checking for the boost headers disables this wrapper unless the user has installed at least one boost library
2019-03-01 15:53:42 +08:00
set ( Boost_USE_STATIC_LIBS OFF )
set ( Boost_USE_MULTITHREADED ON )
2017-11-06 03:33:35 +08:00
unset ( Boost_USE_STATIC_RUNTIME )
2019-04-05 10:13:10 +08:00
set ( Boost_NO_BOOST_CMAKE ON )
2019-03-01 15:53:42 +08:00
unset ( Boost_USE_STATIC_RUNTIME CACHE )
2020-08-02 06:02:50 +08:00
if ( "${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v120" )
set ( Boost_COMPILER "-vc120" )
else ( )
set ( Boost_COMPILER "-vc140" )
2020-08-02 07:45:00 +08:00
endif ( )
2017-11-16 13:58:26 +08:00
_find_package ( ${ ARGV } )
2018-04-06 12:39:47 +08:00
elseif ( "${name}" STREQUAL "ICU" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/unicode/utf.h" )
2017-11-16 13:58:26 +08:00
function ( _vcpkg_find_in_list )
list ( FIND ARGV "COMPONENTS" COMPONENTS_IDX )
set ( COMPONENTS_IDX ${ COMPONENTS_IDX } PARENT_SCOPE )
endfunction ( )
_vcpkg_find_in_list ( ${ ARGV } )
if ( NOT COMPONENTS_IDX EQUAL -1 )
_find_package ( ${ ARGV } COMPONENTS data )
else ( )
_find_package ( ${ ARGV } )
endif ( )
2018-04-06 12:39:47 +08:00
elseif ( "${name}" STREQUAL "GSL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/gsl" )
2018-03-08 03:56:21 +08:00
_find_package ( ${ ARGV } )
if ( GSL_FOUND AND TARGET GSL::gsl )
set_property ( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
set_property ( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
if ( EXISTS "${GSL_LIBRARY_DEBUG}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG}" )
set_property ( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties ( GSL::gsl PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG}" )
set_property ( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties ( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" )
endif ( )
endif ( )
2018-04-06 12:39:47 +08:00
elseif ( "${name}" STREQUAL "CURL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/curl" )
2018-02-08 09:02:47 +08:00
_find_package ( ${ ARGV } )
if ( CURL_FOUND )
if ( EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib" )
list ( APPEND CURL_LIBRARIES
" d e b u g " " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g / l i b / n g h t t p 2 . l i b "
" o p t i m i z e d " " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / l i b / n g h t t p 2 . l i b " )
endif ( )
endif ( )
2018-04-19 09:13:11 +08:00
elseif ( "${_vcpkg_lowercase_name}" STREQUAL "grpc" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/grpc" )
_find_package ( gRPC ${ ARGN } )
2017-11-16 13:58:26 +08:00
else ( )
_find_package ( ${ ARGV } )
2017-11-16 10:56:44 +08:00
endif ( )
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
2020-04-16 04:06:55 +08:00
if ( CMAKE_SYSTEM_NAME STREQUAL iOS )
set ( CMAKE_FIND_ROOT_PATH "${BACKUP_CMAKE_FIND_ROOT_PATH}" )
endif ( )
2017-10-17 02:22:21 +08:00
endmacro ( )
2017-07-01 08:33:48 +08:00
2017-10-17 02:22:21 +08:00
set ( VCPKG_TOOLCHAIN ON )
2017-07-01 08:33:48 +08:00
set ( _UNUSED ${ CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION } )
set ( _UNUSED ${ CMAKE_EXPORT_NO_PACKAGE_REGISTRY } )
set ( _UNUSED ${ CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY } )
set ( _UNUSED ${ CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY } )
set ( _UNUSED ${ CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP } )
2017-10-17 02:22:21 +08:00
2019-09-24 04:43:52 +08:00
# Propogate these values to try-compile configurations so the triplet and toolchain load
2017-10-17 02:22:21 +08:00
if ( NOT _CMAKE_IN_TRY_COMPILE )
2019-09-24 04:43:52 +08:00
if ( _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES )
file ( TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file )
file ( TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir )
file ( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake"
" set ( VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n"
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
2020-04-16 04:06:55 +08:00
" set ( VCPKG_TARGET_ARCHITECTURE \"${VCPKG_TARGET_ARCHITECTURE}\" CACHE STRING \"\")\n"
2019-09-24 04:43:52 +08:00
" set ( VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n"
" set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n"
" set ( _VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n"
2017-12-09 14:03:03 +08:00
)
2019-09-24 04:43:52 +08:00
else ( )
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
2020-04-16 04:06:55 +08:00
list ( APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
2019-09-24 04:43:52 +08:00
V C P K G _ T A R G E T _ T R I P L E T
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
2020-04-16 04:06:55 +08:00
V C P K G _ T A R G E T _ A R C H I T E C T U R E
2019-09-24 04:43:52 +08:00
V C P K G _ A P P L O C A L _ D E P S
V C P K G _ C H A I N L O A D _ T O O L C H A I N _ F I L E
_ V C P K G _ R O O T _ D I R
)
endif ( )
2017-12-09 14:03:03 +08:00
endif ( )
2020-11-13 02:16:24 +08:00
if ( _VCPKG_HAS_FATAL_ERROR )
message ( FATAL_ERROR "${_VCPKG_FATAL_ERROR}" )
endif ( )