2020-12-02 05:37:26 +08:00
#[===[.md:
# vcpkg_configure_cmake
2021-03-01 05:17:19 +08:00
* * T h i s f u n c t i o n h a s b e e n d e p r e c a t e d i n f a v o r o f ` v c p k g _ c m a k e _ c o n f i g u r e ` f r o m t h e v c p k g - c m a k e p o r t . * *
2020-12-02 05:37:26 +08:00
C o n f i g u r e C M a k e f o r D e b u g a n d R e l e a s e b u i l d s o f a p r o j e c t .
## Usage
` ` ` c m a k e
vcpkg_configure_cmake (
S O U R C E _ P A T H < $ { S O U R C E _ P A T H } >
[ P R E F E R _ N I N J A ]
[ D I S A B L E _ P A R A L L E L _ C O N F I G U R E ]
[ N O _ C H A R S E T _ F L A G ]
[ G E N E R A T O R < " N M a k e M a k e f i l e s " > ]
[ O P T I O N S < - D U S E _ T H I S _ I N _ A L L _ B U I L D S = 1 > . . . ]
[ O P T I O N S _ R E L E A S E < - D O P T I M I Z E = 1 > . . . ]
[ O P T I O N S _ D E B U G < - D D E B U G G A B L E = 1 > . . . ]
)
` ` `
## Parameters
### SOURCE_PATH
S p e c i f i e s t h e d i r e c t o r y c o n t a i n i n g t h e ` C M a k e L i s t s . t x t ` .
B y c o n v e n t i o n , t h i s i s u s u a l l y s e t i n t h e p o r t f i l e a s t h e v a r i a b l e ` S O U R C E _ P A T H ` .
### PREFER_NINJA
I n d i c a t e s t h a t , w h e n a v a i l a b l e , V c p k g s h o u l d u s e N i n j a t o p e r f o r m t h e b u i l d .
T h i s s h o u l d b e s p e c i f i e d u n l e s s t h e p o r t i s k n o w n t o n o t w o r k u n d e r N i n j a .
### DISABLE_PARALLEL_CONFIGURE
D i s a b l e s r u n n i n g t h e C M a k e c o n f i g u r e s t e p i n p a r a l l e l .
T h i s i s n e e d e d f o r l i b r a r i e s w h i c h w r i t e b a c k i n t o t h e i r s o u r c e d i r e c t o r y d u r i n g c o n f i g u r e .
T h i s a l s o d i s a b l e s C M A K E _ D I S A B L E _ S O U R C E _ C H A N G E S .
### NO_CHARSET_FLAG
D i s a b l e s p a s s i n g ` u t f - 8 ` a s t h e d e f a u l t c h a r a c t e r s e t t o ` C M A K E _ C _ F L A G S ` a n d ` C M A K E _ C X X _ F L A G S ` .
T h i s i s n e e d e d f o r l i b r a r i e s t h a t s e t t h e i r o w n s o u r c e c o d e ' s c h a r a c t e r s e t .
### GENERATOR
S p e c i f i e s t h e p r e c i s e g e n e r a t o r t o u s e .
T h i s i s u s e f u l i f s o m e p r o j e c t - s p e c i f i c b u i l d s y s t e m h a s b e e n w r a p p e d i n a c m a k e s c r i p t t h a t w o n ' t p e r f o r m a n a c t u a l b u i l d .
I f u s e d f o r t h i s p u r p o s e , i t s h o u l d b e s e t t o ` " N M a k e M a k e f i l e s " ` .
### OPTIONS
A d d i t i o n a l o p t i o n s p a s s e d t o C M a k e d u r i n g t h e c o n f i g u r a t i o n .
### OPTIONS_RELEASE
A d d i t i o n a l o p t i o n s p a s s e d t o C M a k e d u r i n g t h e R e l e a s e c o n f i g u r a t i o n . T h e s e a r e i n a d d i t i o n t o ` O P T I O N S ` .
### OPTIONS_DEBUG
A d d i t i o n a l o p t i o n s p a s s e d t o C M a k e d u r i n g t h e D e b u g c o n f i g u r a t i o n . T h e s e a r e i n a d d i t i o n t o ` O P T I O N S ` .
### LOGNAME
N a m e o f t h e l o g t o w r i t e t h e o u t p u t o f t h e c o n f i g u r e c a l l t o .
## Notes
T h i s c o m m a n d s u p p l i e s m a n y c o m m o n a r g u m e n t s t o C M a k e . T o s e e t h e f u l l l i s t , e x a m i n e t h e s o u r c e .
## Examples
* [ z l i b ] ( 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 / b l o b / m a s t e r / p o r t s / z l i b / p o r t f i l e . c m a k e )
* [ c p p r e s t s d k ] ( 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 / b l o b / m a s t e r / p o r t s / c p p r e s t s d k / p o r t f i l e . c m a k e )
* [ p o c o ] ( 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 / b l o b / m a s t e r / p o r t s / p o c o / p o r t f i l e . c m a k e )
* [ o p e n c v ] ( 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 / b l o b / m a s t e r / p o r t s / o p e n c v / p o r t f i l e . c m a k e )
#]===]
2016-09-19 11:50:08 +08:00
function ( vcpkg_configure_cmake )
2021-03-01 05:17:19 +08:00
if ( Z_VCPKG_CMAKE_CONFIGURE_GUARD )
message ( FATAL_ERROR "The ${PORT} port already depends on vcpkg-cmake; using both vcpkg-cmake and vcpkg_configure_cmake in the same port is unsupported." )
endif ( )
cmake_parse_arguments ( PARSE_ARGV 0 arg
2019-07-10 05:53:48 +08:00
" P R E F E R _ N I N J A ; D I S A B L E _ P A R A L L E L _ C O N F I G U R E ; N O _ C H A R S E T _ F L A G "
2020-10-16 02:01:00 +08:00
" S O U R C E _ P A T H ; G E N E R A T O R ; L O G N A M E "
2019-07-10 05:53:48 +08:00
" O P T I O N S ; O P T I O N S _ D E B U G ; O P T I O N S _ R E L E A S E "
)
2016-09-19 11:50:08 +08:00
2017-01-25 10:55:41 +08:00
if ( NOT VCPKG_PLATFORM_TOOLSET )
2019-07-10 05:53:48 +08:00
message ( FATAL_ERROR "Vcpkg has been updated with VS2017 support; "
" h o w e v e r , v c p k g . e x e m u s t b e r e b u i l t b y r e - r u n n i n g b o o t s t r a p - v c p k g . b a t \ n " )
2017-04-23 15:11:42 +08:00
endif ( )
2021-03-01 05:17:19 +08:00
if ( NOT arg_LOGNAME )
set ( arg_LOGNAME config- ${ TARGET_TRIPLET } )
2020-10-16 02:01:00 +08:00
endif ( )
2018-08-09 01:51:33 +08:00
if ( CMAKE_HOST_WIN32 )
2019-07-10 05:53:48 +08:00
if ( DEFINED ENV{PROCESSOR_ARCHITEW6432} )
2021-03-01 05:17:19 +08:00
set ( arg_HOST_ARCHITECTURE $ENV{ PROCESSOR_ARCHITEW6432 } )
2019-07-10 05:53:48 +08:00
else ( )
2021-03-01 05:17:19 +08:00
set ( arg_HOST_ARCHITECTURE $ENV{ PROCESSOR_ARCHITECTURE } )
2019-07-10 05:53:48 +08:00
endif ( )
2018-08-09 01:51:33 +08:00
endif ( )
2018-03-04 05:09:55 +08:00
set ( NINJA_CAN_BE_USED ON ) # Ninja as generator
set ( NINJA_HOST ON ) # Ninja as parallel configurator
2019-07-10 05:53:48 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" )
set ( _TARGETTING_UWP 1 )
endif ( )
2021-03-01 05:17:19 +08:00
if ( arg_HOST_ARCHITECTURE STREQUAL "x86" )
2018-01-04 07:19:52 +08:00
# Prebuilt ninja binaries are only provided for x64 hosts
set ( NINJA_CAN_BE_USED OFF )
2018-03-04 05:09:55 +08:00
set ( NINJA_HOST OFF )
2019-07-10 05:53:48 +08:00
elseif ( _TARGETTING_UWP )
2018-01-04 07:19:52 +08:00
# Ninja and MSBuild have many differences when targetting UWP, so use MSBuild to maximize existing compatibility
set ( NINJA_CAN_BE_USED OFF )
endif ( )
2021-03-01 05:17:19 +08:00
if ( arg_GENERATOR )
set ( GENERATOR ${ arg_GENERATOR } )
elseif ( arg_PREFER_NINJA AND NINJA_CAN_BE_USED )
2018-01-04 07:19:52 +08:00
set ( GENERATOR "Ninja" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE OR ( VCPKG_CMAKE_SYSTEM_NAME AND NOT _TARGETTING_UWP ) )
2017-02-04 00:16:13 +08:00
set ( GENERATOR "Ninja" )
2018-01-04 07:19:52 +08:00
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v120" )
2017-09-02 22:48:29 +08:00
set ( GENERATOR "Visual Studio 12 2013" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v120" )
2017-09-02 22:48:29 +08:00
set ( GENERATOR "Visual Studio 12 2013 Win64" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v120" )
2017-09-02 22:48:29 +08:00
set ( GENERATOR "Visual Studio 12 2013 ARM" )
2018-01-04 07:19:52 +08:00
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v140" )
2016-09-19 11:50:08 +08:00
set ( GENERATOR "Visual Studio 14 2015" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v140" )
2016-09-19 11:50:08 +08:00
set ( GENERATOR "Visual Studio 14 2015 Win64" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v140" )
2017-03-14 08:59:41 +08:00
set ( GENERATOR "Visual Studio 14 2015 ARM" )
2017-01-24 11:25:47 +08:00
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v141" )
2017-01-24 11:25:47 +08:00
set ( GENERATOR "Visual Studio 15 2017" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v141" )
2017-01-24 11:25:47 +08:00
set ( GENERATOR "Visual Studio 15 2017 Win64" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v141" )
2017-03-14 08:59:41 +08:00
set ( GENERATOR "Visual Studio 15 2017 ARM" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v141" )
2017-09-24 21:01:37 +08:00
set ( GENERATOR "Visual Studio 15 2017" )
set ( ARCH "ARM64" )
2019-03-17 00:40:31 +08:00
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v142" )
2019-03-17 00:40:31 +08:00
set ( GENERATOR "Visual Studio 16 2019" )
2019-03-17 00:53:31 +08:00
set ( ARCH "Win32" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v142" )
2019-03-17 00:53:31 +08:00
set ( GENERATOR "Visual Studio 16 2019" )
set ( ARCH "x64" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v142" )
2019-03-17 00:53:31 +08:00
set ( GENERATOR "Visual Studio 16 2019" )
set ( ARCH "ARM" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET STREQUAL "v142" )
2019-03-17 00:53:31 +08:00
set ( GENERATOR "Visual Studio 16 2019" )
set ( ARCH "ARM64" )
2019-03-17 00:40:31 +08:00
2017-10-17 02:22:21 +08:00
else ( )
2019-03-06 06:42:07 +08:00
if ( NOT VCPKG_CMAKE_SYSTEM_NAME )
set ( VCPKG_CMAKE_SYSTEM_NAME Windows )
endif ( )
2019-07-10 05:53:48 +08:00
message ( FATAL_ERROR "Unable to determine appropriate generator for: "
" $ { V C P K G _ C M A K E _ S Y S T E M _ N A M E } - $ { V C P K G _ T A R G E T _ A R C H I T E C T U R E } - $ { V C P K G _ P L A T F O R M _ T O O L S E T } " )
2016-09-19 11:50:08 +08:00
endif ( )
2018-03-02 00:31:14 +08:00
2017-02-04 00:16:13 +08:00
# If we use Ninja, make sure it's on PATH
2020-09-06 01:45:48 +08:00
if ( GENERATOR STREQUAL "Ninja" AND NOT DEFINED ENV{VCPKG_FORCE_SYSTEM_BINARIES} )
2017-02-04 00:16:13 +08:00
vcpkg_find_acquire_program ( NINJA )
get_filename_component ( NINJA_PATH ${ NINJA } DIRECTORY )
2019-09-20 18:52:33 +08:00
vcpkg_add_to_path ( "${NINJA_PATH}" )
2021-03-01 05:17:19 +08:00
list ( APPEND arg_OPTIONS "-DCMAKE_MAKE_PROGRAM=${NINJA}" )
2017-02-04 00:16:13 +08:00
endif ( )
2016-09-19 11:50:08 +08:00
file ( REMOVE_RECURSE ${ CURRENT_BUILDTREES_DIR } / ${ TARGET_TRIPLET } -rel ${ CURRENT_BUILDTREES_DIR } / ${ TARGET_TRIPLET } -dbg )
2016-10-07 04:46:41 +08:00
if ( DEFINED VCPKG_CMAKE_SYSTEM_NAME )
2021-03-01 05:17:19 +08:00
list ( APPEND arg_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}" )
2019-07-10 05:53:48 +08:00
if ( _TARGETTING_UWP AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION )
2018-11-21 08:28:12 +08:00
set ( VCPKG_CMAKE_SYSTEM_VERSION 10.0 )
2020-11-19 07:45:05 +08:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION )
set ( VCPKG_CMAKE_SYSTEM_VERSION 21 )
2018-11-21 08:28:12 +08:00
endif ( )
2016-10-07 04:46:41 +08:00
endif ( )
2019-07-10 05:53:48 +08:00
2016-10-07 04:46:41 +08:00
if ( DEFINED VCPKG_CMAKE_SYSTEM_VERSION )
2021-03-01 05:17:19 +08:00
list ( APPEND arg_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}" )
2016-10-07 04:46:41 +08:00
endif ( )
2017-10-17 02:22:21 +08:00
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" )
2021-03-01 05:17:19 +08:00
list ( APPEND arg_OPTIONS -DBUILD_SHARED_LIBS=ON )
2017-10-17 02:22:21 +08:00
elseif ( VCPKG_LIBRARY_LINKAGE STREQUAL "static" )
2021-03-01 05:17:19 +08:00
list ( APPEND arg_OPTIONS -DBUILD_SHARED_LIBS=OFF )
2017-10-17 02:22:21 +08:00
else ( )
2019-07-10 05:53:48 +08:00
message ( FATAL_ERROR
" I n v a l i d s e t t i n g f o r V C P K G _ L I B R A R Y _ L I N K A G E : \ " $ { V C P K G _ L I B R A R Y _ L I N K A G E } \ " . "
" I t m u s t b e \ " s t a t i c \ " o r \ " d y n a m i c \ " " )
2017-05-31 03:24:21 +08:00
endif ( )
2020-01-18 07:36:08 +08:00
2019-07-10 05:53:48 +08:00
macro ( check_both_vars_are_set var1 var2 )
if ( ( NOT DEFINED ${ var1 } OR NOT DEFINED ${ var2 } ) AND ( DEFINED ${ var1 } OR DEFINED ${ var2 } ) )
message ( FATAL_ERROR "Both ${var1} and ${var2} must be set." )
endif ( )
endmacro ( )
2020-01-18 07:36:08 +08:00
2019-07-10 05:53:48 +08:00
check_both_vars_are_set ( VCPKG_CXX_FLAGS_DEBUG VCPKG_C_FLAGS_DEBUG )
check_both_vars_are_set ( VCPKG_CXX_FLAGS_RELEASE VCPKG_C_FLAGS_RELEASE )
check_both_vars_are_set ( VCPKG_CXX_FLAGS VCPKG_C_FLAGS )
2019-07-01 00:31:22 +08:00
set ( VCPKG_SET_CHARSET_FLAG ON )
2021-03-01 05:17:19 +08:00
if ( arg_NO_CHARSET_FLAG )
2019-07-01 00:31:22 +08:00
set ( VCPKG_SET_CHARSET_FLAG OFF )
endif ( )
2016-10-07 04:46:41 +08:00
2019-07-10 05:53:48 +08:00
if ( NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE )
if ( NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR _TARGETTING_UWP )
2019-09-13 14:52:52 +08:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" )
2019-09-13 14:52:52 +08:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/linux.cmake" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android" )
2019-09-13 14:52:52 +08:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/android.cmake" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
2019-09-13 14:52:52 +08:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/osx.cmake" )
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 ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS" )
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/ios.cmake" )
2019-07-10 05:53:48 +08:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
2019-09-13 14:52:52 +08:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake" )
2020-11-24 01:43:23 +08:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" )
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/openbsd.cmake" )
2020-01-18 07:36:08 +08:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW" )
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake" )
2019-07-10 05:53:48 +08:00
endif ( )
2017-10-17 02:22:21 +08:00
endif ( )
2019-07-01 00:31:22 +08:00
2021-03-01 05:17:19 +08:00
list ( APPEND arg_OPTIONS
2019-07-10 05:53:48 +08:00
" - D 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 _ C H A I N L O A D _ T O O L C H A I N _ F I L E } "
2017-03-31 15:35:40 +08:00
" - D V C P K G _ T A R G E T _ T R I P L E T = $ { T A R G E T _ T R I P L E T } "
2019-07-01 00:31:22 +08:00
" - D V C P K G _ S E T _ C H A R S E T _ F L A G = $ { V C P K G _ S E T _ C H A R S E T _ F L A G } "
2018-04-03 11:40:25 +08:00
" - D V C P K G _ P L A T F O R M _ T O O L S E T = $ { V C P K G _ P L A T F O R M _ T O O L S E T } "
2016-12-06 17:26:21 +08:00
" - D C M A K E _ E X P O R T _ N O _ P A C K A G E _ R E G I S T R Y = O N "
" - D C M A K E _ F I N D _ P A C K A G E _ N O _ P A C K A G E _ R E G I S T R Y = O N "
" - D C M A K E _ F I N D _ P A C K A G E _ N O _ S Y S T E M _ P A C K A G E _ R E G I S T R Y = O N "
2017-03-07 02:35:03 +08:00
" - D C M A K E _ I N S T A L L _ S Y S T E M _ R U N T I M E _ L I B S _ S K I P = T R U E "
" - D C M A K E _ V E R B O S E _ M A K E F I L E = O N "
2017-03-21 16:48:40 +08:00
" - D V C P K G _ A P P L O C A L _ D E P S = O F F "
2019-09-13 14:52:52 +08:00
" - D C M A K E _ T O O L C H A I N _ F I L E = $ { S C R I P T S } / b u i l d s y s t e m s / v c p k g . c m a k e "
2017-03-21 16:48:40 +08:00
" - D C M A K E _ E R R O R _ O N _ A B S O L U T E _ I N S T A L L _ D E S T I N A T I O N = O N "
2018-03-07 01:57:37 +08:00
" - D V C P K G _ C X X _ F L A G S = $ { V C P K G _ C X X _ F L A G S } "
" - D V C P K G _ C X X _ F L A G S _ R E L E A S E = $ { V C P K G _ C X X _ F L A G S _ R E L E A S E } "
" - D V C P K G _ C X X _ F L A G S _ D E B U G = $ { V C P K G _ C X X _ F L A G S _ D E B U G } "
" - D V C P K G _ C _ F L A G S = $ { V C P K G _ C _ F L A G S } "
" - D V C P K G _ C _ F L A G S _ R E L E A S E = $ { V C P K G _ C _ F L A G S _ R E L E A S E } "
" - D V C P K G _ C _ F L A G S _ D E B U G = $ { V C P K G _ C _ F L A G S _ D E B U G } "
" - D V C P K G _ C R T _ L I N K A G E = $ { V C P K G _ C R T _ L I N K A G E } "
" - D V C P K G _ L I N K E R _ F L A G S = $ { V C P K G _ L I N K E R _ F L A G S } "
2020-09-04 02:00:35 +08:00
" - D V C P K G _ L I N K E R _ F L A G S _ R E L E A S E = $ { V C P K G _ L I N K E R _ F L A G S _ R E L E A S E } "
" - D V C P K G _ L I N K E R _ F L A G S _ D E B U G = $ { V C P K G _ L I N K E R _ F L A G S _ D E B U G } "
2019-06-15 04:09:38 +08:00
" - D V C P K G _ T A R G E T _ A R C H I T E C T U R E = $ { V C P K G _ T A R G E T _ A R C H I T E C T U R E } "
2018-03-24 07:23:37 +08:00
" - D C M A K E _ I N S T A L L _ L I B D I R : S T R I N G = l i b "
" - D C M A K E _ I N S T A L L _ B I N D I R : S T R I N G = b i n "
2020-06-04 10:31:28 +08:00
" - D _ V C P K G _ R O O T _ D I R = $ { V C P K G _ R O O T _ D I R } "
" - D _ V C P K G _ 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 } "
[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
" - D V C P K G _ M A N I F E S T _ I N S T A L L = O F F "
2016-10-12 01:32:40 +08:00
)
2017-05-31 03:24:21 +08:00
2017-09-24 21:01:37 +08:00
if ( DEFINED ARCH )
2021-03-01 05:17:19 +08:00
list ( APPEND arg_OPTIONS
2017-09-24 21:01:37 +08:00
" - A $ { A R C H } "
)
endif ( )
2018-10-24 07:49:48 +08:00
# Sets configuration variables for macOS builds
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
foreach ( config_var INSTALL_NAME_DIR OSX_DEPLOYMENT_TARGET OSX_SYSROOT OSX_ARCHITECTURES )
2019-07-10 05:53:48 +08:00
if ( DEFINED VCPKG_ ${ config_var } )
2021-03-01 05:17:19 +08:00
list ( APPEND arg_OPTIONS "-DCMAKE_${config_var}=${VCPKG_${config_var}}" )
2019-07-10 05:53:48 +08:00
endif ( )
endforeach ( )
2018-10-24 07:49:48 +08:00
2018-02-08 08:57:47 +08:00
set ( rel_command
2021-03-01 05:17:19 +08:00
$ { C M A K E _ C O M M A N D } $ { a r g _ S O U R C E _ P A T H } " $ { a r g _ O P T I O N S } " " $ { a r g _ O P T I O N S _ R E L E A S E } "
2018-02-08 08:57:47 +08:00
- G $ { G E N E R A T O R }
- D C M A K E _ B U I L D _ T Y P E = R e l e a s e
- D C M A K E _ I N S T A L L _ P R E F I X = $ { C U R R E N T _ P A C K A G E S _ D I R } )
set ( dbg_command
2021-03-01 05:17:19 +08:00
$ { C M A K E _ C O M M A N D } $ { a r g _ S O U R C E _ P A T H } " $ { a r g _ O P T I O N S } " " $ { a r g _ O P T I O N S _ D E B U G } "
2018-02-08 08:57:47 +08:00
- G $ { G E N E R A T O R }
- D C M A K E _ B U I L D _ T Y P E = D e b u g
- D C M A K E _ I N S T A L L _ P R E F I X = $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g )
2021-03-01 05:17:19 +08:00
if ( NINJA_HOST AND CMAKE_HOST_WIN32 AND NOT arg_DISABLE_PARALLEL_CONFIGURE )
list ( APPEND arg_OPTIONS "-DCMAKE_DISABLE_SOURCE_CHANGES=ON" )
2018-02-08 08:57:47 +08:00
vcpkg_find_acquire_program ( NINJA )
get_filename_component ( NINJA_PATH ${ NINJA } DIRECTORY )
2019-09-20 18:52:33 +08:00
vcpkg_add_to_path ( "${NINJA_PATH}" )
2018-02-08 08:57:47 +08:00
#parallelize the configure step
set ( _contents
" r u l e C r e a t e P r o c e s s \ n c o m m a n d = $ p r o c e s s \ n \ n "
2017-11-26 07:25:18 +08:00
)
2016-09-19 11:50:08 +08:00
2019-07-10 05:53:48 +08:00
macro ( _build_cmakecache whereat build_type )
set ( ${ build_type } _line "build ${whereat}/CMakeCache.txt: CreateProcess\n process = cmd /c \" cd ${ whereat } && " )
foreach ( arg ${ ${build_type } _command} )
set ( ${ build_type } _line "${${build_type}_line} \" ${ arg } \"")
2018-02-08 08:57:47 +08:00
endforeach ( )
2019-07-10 05:53:48 +08:00
set ( _contents "${_contents}${${build_type}_line}\" \n\n")
endmacro ( )
2018-02-08 08:57:47 +08:00
2019-07-10 05:53:48 +08:00
if ( NOT DEFINED VCPKG_BUILD_TYPE )
_build_cmakecache ( ".." "rel" )
_build_cmakecache ( "../../${TARGET_TRIPLET}-dbg" "dbg" )
elseif ( VCPKG_BUILD_TYPE STREQUAL "release" )
_build_cmakecache ( ".." "rel" )
elseif ( VCPKG_BUILD_TYPE STREQUAL "debug" )
_build_cmakecache ( "../../${TARGET_TRIPLET}-dbg" "dbg" )
2018-02-08 08:57:47 +08:00
endif ( )
file ( MAKE_DIRECTORY ${ CURRENT_BUILDTREES_DIR } / ${ TARGET_TRIPLET } -rel/vcpkg-parallel-configure )
file ( WRITE ${ CURRENT_BUILDTREES_DIR } / ${ TARGET_TRIPLET } -rel/vcpkg-parallel-configure/build.ninja "${_contents}" )
message ( STATUS "Configuring ${TARGET_TRIPLET}" )
2017-11-26 07:25:18 +08:00
vcpkg_execute_required_process (
2018-02-08 08:57:47 +08:00
C O M M A N D n i n j a - v
W O R K I N G _ D I R E C T O R Y $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / v c p k g - p a r a l l e l - c o n f i g u r e
2021-03-01 05:17:19 +08:00
L O G N A M E $ { a r g _ L O G N A M E }
2017-11-26 07:25:18 +08:00
)
2018-02-08 08:57:47 +08:00
else ( )
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" )
message ( STATUS "Configuring ${TARGET_TRIPLET}-dbg" )
file ( MAKE_DIRECTORY ${ CURRENT_BUILDTREES_DIR } / ${ TARGET_TRIPLET } -dbg )
vcpkg_execute_required_process (
C O M M A N D $ { d b g _ c o m m a n d }
W O R K I N G _ D I R E C T O R Y $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g
2021-03-01 05:17:19 +08:00
L O G N A M E $ { a r g _ L O G N A M E } - d b g
2018-02-08 08:57:47 +08:00
)
endif ( )
2018-03-02 00:31:14 +08:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release" )
message ( STATUS "Configuring ${TARGET_TRIPLET}-rel" )
file ( MAKE_DIRECTORY ${ CURRENT_BUILDTREES_DIR } / ${ TARGET_TRIPLET } -rel )
vcpkg_execute_required_process (
C O M M A N D $ { r e l _ c o m m a n d }
W O R K I N G _ D I R E C T O R Y $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l
2021-03-01 05:17:19 +08:00
L O G N A M E $ { a r g _ L O G N A M E } - r e l
2018-03-02 00:31:14 +08:00
)
endif ( )
2017-11-26 07:25:18 +08:00
endif ( )
2017-10-06 08:49:28 +08:00
2021-03-01 05:17:19 +08:00
set ( Z_VCPKG_CMAKE_GENERATOR "${GENERATOR}" PARENT_SCOPE )
2018-03-02 00:31:14 +08:00
endfunction ( )