2021-05-09 19:47:21 +02:00
# DEPRECATED BY ports/vcpkg-cmake/vcpkg_cmake_configure
2020-12-01 13:37:26 -08:00
#[===[.md:
# vcpkg_configure_cmake
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 > . . . ]
2021-08-04 01:42:34 +08:00
[ M A Y B E _ U N U S E D _ V A R I A B L E S < O P T I O N _ N A M E > . . . ]
2020-12-01 13:37:26 -08:00
)
` ` `
## 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 ` .
2021-07-20 12:24:58 -05:00
### MAYBE_UNUSED_VARIABLES
A n y C M a k e v a r i a b l e s w h i c h a r e e x p l i c i t l y p a s s e d i n , b u t w h i c h m a y n o t b e u s e d o n a l l p l a t f o r m s .
2021-08-04 01:42:34 +08:00
F o r e x a m p l e :
` ` ` c m a k e
vcpkg_cmake_configure (
. . .
O P T I O N S
- D B U I L D _ E X A M P L E = O F F
. . .
M A Y B E _ U N U S E D _ V A R I A B L E S
B U I L D _ E X A M P L E
)
` ` `
2021-07-20 12:24:58 -05:00
2020-12-01 13:37:26 -08:00
### 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 )
#]===]
2021-11-05 16:55:14 -07:00
function ( z_vcpkg_configure_cmake_both_or_neither_set var1 var2 )
if ( DEFINED "${var1}" AND NOT DEFINED "${var2}" )
message ( FATAL_ERROR "If ${var1} is set, ${var2} must be set." )
endif ( )
if ( NOT DEFINED "${var1}" AND DEFINED "${var2}" )
message ( FATAL_ERROR "If ${var2} is set, ${var1} must be set." )
endif ( )
endfunction ( )
function ( z_vcpkg_configure_cmake_build_cmakecache out_var whereat build_type )
set ( line "build ${whereat}/CMakeCache.txt: CreateProcess\n process = cmd /c \" cd ${ whereat } && " )
foreach ( arg IN LISTS "${build_type}_command" )
string ( APPEND line " \" ${ arg } \"")
endforeach ( )
set ( "${out_var}" "${${out_var}}${line}\" \n\n" PARENT_SCOPE )
endfunction ( )
2016-09-18 20:50:08 -07:00
function ( vcpkg_configure_cmake )
2021-02-28 13:17:19 -08:00
cmake_parse_arguments ( PARSE_ARGV 0 arg
2021-07-29 11:47:35 -05: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 ; Z _ G E T _ C M A K E _ V A R S _ U S A G E "
2020-10-15 20:01:00 +02: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 "
2021-07-20 12:24:58 -05: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 ; M A Y B E _ U N U S E D _ V A R I A B L E S "
2019-07-09 16:53:48 -05:00
)
2016-09-18 20:50:08 -07:00
2021-07-29 11:47:35 -05:00
if ( NOT arg_Z_GET_CMAKE_VARS_USAGE AND 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 ( )
2021-11-05 16:55:14 -07:00
if ( DEFINED arg_UNPARSED_ARGUMENTS )
message ( WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}" )
2017-04-23 00:11:42 -07:00
endif ( )
2021-11-05 16:55:14 -07:00
if ( NOT DEFINED arg_SOURCE_PATH )
message ( FATAL_ERROR "SOURCE_PATH must be specified" )
endif ( )
if ( NOT DEFINED arg_LOGNAME )
set ( arg_LOGNAME "config-${TARGET_TRIPLET}" )
2020-10-15 20:01:00 +02:00
endif ( )
2021-11-05 16:55:14 -07:00
vcpkg_list ( SET manually_specified_variables )
2021-07-29 11:47:35 -05:00
if ( arg_Z_GET_CMAKE_VARS_USAGE )
set ( configuring_message "Getting CMake variables for ${TARGET_TRIPLET}" )
else ( )
set ( configuring_message "Configuring ${TARGET_TRIPLET}" )
2021-07-20 12:24:58 -05:00
foreach ( option IN LISTS arg_OPTIONS arg_OPTIONS_RELEASE arg_OPTIONS_DEBUG )
2021-11-05 16:55:14 -07:00
if ( "${option}" MATCHES "^-D([^:=]*)[:=]" )
vcpkg_list ( APPEND manually_specified_variables "${CMAKE_MATCH_1}" )
2021-07-20 12:24:58 -05:00
endif ( )
endforeach ( )
2021-11-05 16:55:14 -07:00
vcpkg_list ( REMOVE_DUPLICATES manually_specified_variables )
foreach ( maybe_unused_var IN LISTS arg_MAYBE_UNUSED_VARIABLES )
vcpkg_list ( REMOVE_ITEM manually_specified_variables "${maybe_unused_var}" )
endforeach ( )
2021-07-20 12:24:58 -05:00
debug_message ( "manually specified variables: ${manually_specified_variables}" )
endif ( )
2021-11-05 16:55:14 -07:00
set ( ninja_can_be_used ON ) # Ninja as generator
set ( ninja_host ON ) # Ninja as parallel configurator
if ( VCPKG_HOST_IS_WINDOWS )
2019-07-09 16:53:48 -05:00
if ( DEFINED ENV{PROCESSOR_ARCHITEW6432} )
2021-11-05 16:55:14 -07:00
set ( host_arch "$ENV{PROCESSOR_ARCHITEW6432}" )
2019-07-09 16:53:48 -05:00
else ( )
2021-11-05 16:55:14 -07:00
set ( host_arch "$ENV{PROCESSOR_ARCHITECTURE}" )
2019-07-09 16:53:48 -05:00
endif ( )
2018-08-08 10:51:33 -07:00
2021-11-05 16:55:14 -07:00
if ( "${host_arch}" STREQUAL "x86" )
# Prebuilt ninja binaries are only provided for x64 hosts
set ( ninja_can_be_used OFF )
set ( ninja_host OFF )
elseif ( VCPKG_TARGET_IS_UWP )
# Ninja and MSBuild have many differences when targeting UWP, so use MSBuild to maximize existing compatibility
set ( ninja_can_be_used OFF )
endif ( )
2019-07-09 16:53:48 -05:00
endif ( )
2021-11-05 16:55:14 -07:00
set ( generator "" )
set ( generator_arch "" )
if ( DEFINED arg_GENERATOR )
set ( generator "${arg_GENERATOR}" )
elseif ( arg_PREFER_NINJA AND ninja_can_be_used )
set ( generator "Ninja" )
elseif ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE OR NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW )
set ( generator "Ninja" )
2018-01-04 00:19:52 +01:00
2017-10-16 11:22:21 -07:00
else ( )
2021-11-05 16:55:14 -07:00
if ( "${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v120" AND NOT "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64" )
set ( generator "Visual Studio 12 2013" )
elseif ( "${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v140" AND NOT "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64" )
set ( generator "Visual Studio 14 2015" )
elseif ( "${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v141" )
set ( generator "Visual Studio 15 2017" )
elseif ( "${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v142" )
set ( generator "Visual Studio 16 2019" )
elseif ( "${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v143" )
set ( generator "Visual Studio 17 2022" )
endif ( )
if ( "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x86" )
set ( generator_arch "Win32" )
elseif ( "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x64" )
set ( generator_arch "x64" )
elseif ( "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm" )
set ( generator_arch "ARM" )
elseif ( "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64" )
set ( generator_arch "ARM64" )
endif ( )
if ( "${generator}" STREQUAL "" OR "${generator_arch}" STREQUAL "" )
message ( FATAL_ERROR
" U n a b l e t o d e t e r m i n e a p p r o p r i a t e g e n e r a t o r f o r t r i p l e t $ { T A R G E T _ T R I P L E T } :
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 }
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 } " )
2019-03-05 14:42:07 -08:00
endif ( )
2016-09-18 20:50:08 -07:00
endif ( )
2018-03-01 17:31:14 +01:00
2017-02-03 17:16:13 +01:00
# If we use Ninja, make sure it's on PATH
2021-11-05 16:55:14 -07:00
if ( "${generator}" STREQUAL "Ninja" AND NOT DEFINED ENV{VCPKG_FORCE_SYSTEM_BINARIES} )
2017-02-03 17:16:13 +01:00
vcpkg_find_acquire_program ( NINJA )
2021-11-05 16:55:14 -07:00
get_filename_component ( NINJA_PATH "${NINJA}" DIRECTORY )
2019-09-20 12:52:33 +02:00
vcpkg_add_to_path ( "${NINJA_PATH}" )
2021-11-05 16:55:14 -07:00
vcpkg_list ( APPEND arg_OPTIONS "-DCMAKE_MAKE_PROGRAM=${NINJA}" )
2017-02-03 17:16:13 +01:00
endif ( )
2016-09-18 20:50:08 -07:00
2021-11-05 16:55:14 -07:00
file ( REMOVE_RECURSE
" $ { 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 "
" $ { 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 " )
2016-09-18 20:50:08 -07:00
2016-10-06 13:46:41 -07:00
if ( DEFINED VCPKG_CMAKE_SYSTEM_NAME )
2021-11-05 16:55:14 -07:00
vcpkg_list ( APPEND arg_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}" )
if ( VCPKG_TARGET_IS_UWP AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION )
2018-11-20 16:28:12 -08:00
set ( VCPKG_CMAKE_SYSTEM_VERSION 10.0 )
2021-11-05 16:55:14 -07:00
elseif ( VCPKG_TARGET_IS_ANDROID AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION )
2020-11-19 00:45:05 +01:00
set ( VCPKG_CMAKE_SYSTEM_VERSION 21 )
2018-11-20 16:28:12 -08:00
endif ( )
2016-10-06 13:46:41 -07:00
endif ( )
2019-07-09 16:53:48 -05:00
2016-10-06 13:46:41 -07:00
if ( DEFINED VCPKG_CMAKE_SYSTEM_VERSION )
2021-11-05 16:55:14 -07:00
vcpkg_list ( APPEND arg_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}" )
2016-10-06 13:46:41 -07:00
endif ( )
2017-10-16 11:22:21 -07:00
2021-11-05 16:55:14 -07:00
if ( "${VCPKG_LIBRARY_LINKAGE}" STREQUAL "dynamic" )
vcpkg_list ( APPEND arg_OPTIONS -DBUILD_SHARED_LIBS=ON )
elseif ( "${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static" )
vcpkg_list ( APPEND arg_OPTIONS -DBUILD_SHARED_LIBS=OFF )
2017-10-16 11:22:21 -07:00
else ( )
2019-07-09 16:53:48 -05:00
message ( FATAL_ERROR
2021-11-05 16:55:14 -07:00
" 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-30 12:24:21 -07:00
endif ( )
2020-01-18 00:36:08 +01:00
2021-11-05 16:55:14 -07:00
z_vcpkg_configure_cmake_both_or_neither_set ( VCPKG_CXX_FLAGS_DEBUG VCPKG_C_FLAGS_DEBUG )
z_vcpkg_configure_cmake_both_or_neither_set ( VCPKG_CXX_FLAGS_RELEASE VCPKG_C_FLAGS_RELEASE )
z_vcpkg_configure_cmake_both_or_neither_set ( VCPKG_CXX_FLAGS VCPKG_C_FLAGS )
2019-07-09 16:53:48 -05:00
2021-11-05 16:55:14 -07:00
set ( vcpkg_set_charset_flag ON )
2021-02-28 13:17:19 -08:00
if ( arg_NO_CHARSET_FLAG )
2021-11-05 16:55:14 -07:00
set ( vcpkg_set_charset_flag OFF )
2019-06-30 09:31:22 -07:00
endif ( )
2016-10-06 13:46:41 -07:00
2019-07-09 16:53:48 -05:00
if ( NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE )
2021-11-05 16:55:14 -07:00
if ( VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW )
2019-09-13 06:52:52 +00:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake" )
2019-07-09 16:53:48 -05:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" )
2019-09-13 06:52:52 +00:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/linux.cmake" )
2019-07-09 16:53:48 -05:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android" )
2019-09-13 06:52:52 +00:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/android.cmake" )
2019-07-09 16:53:48 -05:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
2019-09-13 06:52:52 +00: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-15 22:06:55 +02:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS" )
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/ios.cmake" )
2019-07-09 16:53:48 -05:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
2019-09-13 06:52:52 +00:00
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake" )
2020-11-23 18:43:23 +01:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" )
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/openbsd.cmake" )
2020-01-18 00:36:08 +01:00
elseif ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW" )
set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake" )
2019-07-09 16:53:48 -05:00
endif ( )
2017-10-16 11:22:21 -07:00
endif ( )
2021-11-05 16:55:14 -07:00
vcpkg_list ( APPEND arg_OPTIONS
2019-07-09 16:53:48 -05: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 00:35:40 -07: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 } "
2021-11-05 16:55:14 -07: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-02 20:40:25 -07: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 01: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-06 10: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 01:48:40 -07: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 06:52:52 +00: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 01:48:40 -07: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-06 09: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-03 21:00:35 +03: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 } "
2021-11-05 16:55:14 -07: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-23 16:23:37 -07: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-03 19:31:28 -07: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 } "
2021-11-05 16:55:14 -07:00
" - D Z _ V C P K G _ R O O T _ D I R = $ { V C P K G _ R O O T _ D I R } "
2020-06-03 19:31:28 -07:00
" - 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-06-30 10:40:18 -07: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-11 10:32:40 -07:00
)
2017-05-30 12:24:21 -07:00
2021-11-05 16:55:14 -07:00
if ( NOT "${generator_arch}" STREQUAL "" )
vcpkg_list ( APPEND arg_OPTIONS "-A${generator_arch}" )
2017-09-24 16:01:37 +03:00
endif ( )
2018-10-23 17:49:48 -06:00
# Sets configuration variables for macOS builds
2021-11-05 16:55:14 -07:00
foreach ( config_var IN ITEMS INSTALL_NAME_DIR OSX_DEPLOYMENT_TARGET OSX_SYSROOT OSX_ARCHITECTURES )
if ( DEFINED "VCPKG_${config_var}" )
vcpkg_list ( APPEND arg_OPTIONS "-DCMAKE_${config_var}=${VCPKG_${config_var}}" )
2019-07-09 16:53:48 -05:00
endif ( )
endforeach ( )
2018-10-23 17:49:48 -06:00
2021-11-05 16:55:14 -07:00
vcpkg_list ( SET rel_command
" $ { 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 }
- G " $ { g e n e r a t o r } "
2018-02-07 16:57:47 -08:00
- D C M A K E _ B U I L D _ T Y P E = R e l e a s e
2021-11-05 16:55:14 -07:00
" - 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 } " )
vcpkg_list ( SET dbg_command
" $ { 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 }
- G " $ { g e n e r a t o r } "
2018-02-07 16:57:47 -08:00
- D C M A K E _ B U I L D _ T Y P E = D e b u g
2021-11-05 16:55:14 -07:00
" - 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 " )
2018-02-07 16:57:47 -08:00
2021-11-05 16:55:14 -07:00
if ( ninja_host AND CMAKE_HOST_WIN32 AND NOT arg_DISABLE_PARALLEL_CONFIGURE )
vcpkg_list ( APPEND arg_OPTIONS "-DCMAKE_DISABLE_SOURCE_CHANGES=ON" )
2018-02-07 16:57:47 -08:00
vcpkg_find_acquire_program ( NINJA )
2021-11-05 16:55:14 -07:00
get_filename_component ( NINJA_PATH "${NINJA}" DIRECTORY )
2019-09-20 12:52:33 +02:00
vcpkg_add_to_path ( "${NINJA_PATH}" )
2018-02-07 16:57:47 -08:00
#parallelize the configure step
2021-11-05 16:55:14 -07:00
set ( ninja_configure_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-25 15:25:18 -08:00
)
2016-09-18 20:50:08 -07:00
2021-11-05 16:55:14 -07:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "release" )
z_vcpkg_configure_cmake_build_cmakecache ( ninja_configure_contents ".." "rel" )
endif ( )
if ( NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "debug" )
z_vcpkg_configure_cmake_build_cmakecache ( ninja_configure_contents "../../${TARGET_TRIPLET}-dbg" "dbg" )
2018-02-07 16:57:47 -08:00
endif ( )
2021-11-05 16:55:14 -07:00
file ( MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure" )
file ( WRITE
" $ { 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 / b u i l d . n i n j a "
" $ { n i n j a _ c o n f i g u r e _ c o n t e n t s } " )
2018-02-07 16:57:47 -08:00
2021-07-29 11:47:35 -05:00
message ( STATUS "${configuring_message}" )
2017-11-25 15:25:18 -08:00
vcpkg_execute_required_process (
2018-02-07 16:57:47 -08:00
C O M M A N D n i n j a - v
2021-11-05 16:55:14 -07:00
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 "
L O G N A M E " $ { a r g _ L O G N A M E } "
2017-11-25 15:25:18 -08:00
)
2021-07-20 12:24:58 -05:00
2021-11-05 16:55:14 -07:00
vcpkg_list ( APPEND config_logs
2021-07-20 12:24:58 -05:00
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { a r g _ L O G N A M E } - o u t . l o g "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { a r g _ L O G N A M E } - e r r . l o g " )
2018-02-07 16:57:47 -08:00
else ( )
2021-11-05 16:55:14 -07:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "debug" )
2021-07-29 11:47:35 -05:00
message ( STATUS "${configuring_message}-dbg" )
2021-11-05 16:55:14 -07:00
file ( MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" )
2018-02-07 16:57:47 -08:00
vcpkg_execute_required_process (
C O M M A N D $ { d b g _ c o m m a n d }
2021-11-05 16:55:14 -07:00
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 "
L O G N A M E " $ { a r g _ L O G N A M E } - d b g "
2018-02-07 16:57:47 -08:00
)
2021-11-05 16:55:14 -07:00
vcpkg_list ( APPEND config_logs
2021-07-20 12:24:58 -05:00
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { a r g _ L O G N A M E } - d b g - o u t . l o g "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { a r g _ L O G N A M E } - d b g - e r r . l o g " )
2018-02-07 16:57:47 -08:00
endif ( )
2018-03-01 17:31:14 +01:00
2021-11-05 16:55:14 -07:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "release" )
2021-07-29 11:47:35 -05:00
message ( STATUS "${configuring_message}-rel" )
2021-11-05 16:55:14 -07:00
file ( MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" )
2018-03-01 17:31:14 +01:00
vcpkg_execute_required_process (
C O M M A N D $ { r e l _ c o m m a n d }
2021-11-05 16:55:14 -07:00
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 "
L O G N A M E " $ { a r g _ L O G N A M E } - r e l "
2018-03-01 17:31:14 +01:00
)
2021-11-05 16:55:14 -07:00
vcpkg_list ( APPEND config_logs
2021-07-20 12:24:58 -05:00
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { a r g _ L O G N A M E } - r e l - o u t . l o g "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { a r g _ L O G N A M E } - r e l - e r r . l o g " )
endif ( )
endif ( )
# Check unused variables
2021-11-05 16:55:14 -07:00
vcpkg_list ( SET all_unused_variables )
2021-07-20 12:24:58 -05:00
foreach ( config_log IN LISTS config_logs )
2021-11-05 16:55:14 -07:00
if ( NOT EXISTS "${config_log}" )
2021-07-20 12:24:58 -05:00
continue ( )
endif ( )
file ( READ "${config_log}" log_contents )
debug_message ( "Reading configure log ${config_log}..." )
2021-11-05 16:55:14 -07:00
if ( NOT "${log_contents}" MATCHES "Manually-specified variables were not used by the project:\n\n(( [^\n]*\n)*)" )
2021-07-20 12:24:58 -05:00
continue ( )
2018-03-01 17:31:14 +01:00
endif ( )
2021-07-20 12:24:58 -05:00
string ( STRIP "${CMAKE_MATCH_1}" unused_variables ) # remove leading ` ` and trailing `\n`
string ( REPLACE "\n " ";" unused_variables "${unused_variables}" )
debug_message ( "unused variables: ${unused_variables}" )
foreach ( unused_variable IN LISTS unused_variables )
2021-11-05 16:55:14 -07:00
if ( "${unused_variable}" IN_LIST manually_specified_variables )
2021-07-20 12:24:58 -05:00
debug_message ( "manually specified unused variable: ${unused_variable}" )
2021-11-05 16:55:14 -07:00
vcpkg_list ( APPEND all_unused_variables "${unused_variable}" )
2021-07-20 12:24:58 -05:00
else ( )
debug_message ( "unused variable (not manually specified): ${unused_variable}" )
endif ( )
endforeach ( )
endforeach ( )
2021-11-05 16:55:14 -07:00
if ( NOT "${all_unused_variables}" STREQUAL "" )
vcpkg_list ( REMOVE_DUPLICATES all_unused_variables )
vcpkg_list ( JOIN all_unused_variables "\n " all_unused_variables )
2021-07-20 12:24:58 -05:00
message ( WARNING " The following variables are not used in CMakeLists.txt:
$ { a l l _ u n u s e d _ v a r i a b l e s }
P l e a s e r e c h e c k t h e m a n d r e m o v e t h e u n n e c e s s a r y o p t i o n s f r o m t h e ` v c p k g _ c o n f i g u r e _ c m a k e ` c a l l .
I f t h e s e o p t i o n s s h o u l d s t i l l b e p a s s e d f o r w h a t e v e r r e a s o n , p l e a s e u s e t h e ` M A Y B E _ U N U S E D _ V A R I A B L E S ` a r g u m e n t . " )
2017-11-25 15:25:18 -08:00
endif ( )
2017-10-05 17:49:28 -07:00
2021-07-29 11:47:35 -05:00
if ( NOT arg_Z_GET_CMAKE_VARS_USAGE )
2021-11-05 16:55:14 -07:00
set ( Z_VCPKG_CMAKE_GENERATOR "${generator}" PARENT_SCOPE )
2021-07-29 11:47:35 -05:00
endif ( )
2018-03-01 17:31:14 +01:00
endfunction ( )