vcpkg/scripts/cmake/vcpkg_configure_cmake.cmake

282 lines
13 KiB
CMake
Raw Normal View History

## # vcpkg_configure_cmake
##
## Configure CMake for Debug and Release builds of a project.
##
## ## Usage
## ```cmake
## vcpkg_configure_cmake(
## SOURCE_PATH <${SOURCE_PATH}>
## [PREFER_NINJA]
## [GENERATOR <"NMake Makefiles">]
## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
## [OPTIONS_RELEASE <-DOPTIMIZE=1>...]
## [OPTIONS_DEBUG <-DDEBUGGABLE=1>...]
## )
## ```
##
## ## Parameters
## ### SOURCE_PATH
## Specifies the directory containing the `CMakeLists.txt`. By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
##
## ### PREFER_NINJA
## Indicates that, when available, Vcpkg should use Ninja to perform the build. This should be specified unless the port is known to not work under Ninja.
##
libmupdf version bump (#2730) * Add libgta Libgta is a portable library that implements the Generic Tagged Array (GTA) file format. Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgta] turn off document build and doxygen dependency Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgta] add build-dependency - bzip2, zlib and liblzma Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgta] remove dlls when static build Signed-off-by: Hiroshi Miura <miurahr@linux.com> * Fix typo * [libgta] update CONTROL add lf at end of file. * libmupdf version bump * [qt5-base] Use system freetype. * [opencv] Fix UWP and ARM * [hdf5] Always use config mode for HDF5 * [opencv] Fixup -- apply patch added in previous commit * [abseil] Add *.inc files. Fixes #2718 * [abseil] Update to 2018-2-5 * Fix for Issue #2729 Allows PowerShell to change the name of the downloaded directory correctly. * vcpkgRemoveItem: nullcheck * [cpprestsdk] Update to 2.10.2 * Adding Torch's TH library (#2737) Adding Torch's TH library * [flatbuffers] Fixes #2735 * sobjectizer updated to v.5.5.21 * [nghttp2] Enable static builds * [nghttp2]: update to 1.30.0 (#2739) * [nghttp2]: update to 1.30.0 * [nghttp2] Enable static builds * Add epsilon library port Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [vcpkg-configure-cmake] Use ninja to configure in parallel (#2712) * [curl] Add nghttp2.lib to dependencies of curl * [vtk] Fix breaking change in find_package(HDF5) * Merge findFileRecursivelyUp into VcpkgPowershellUtils * [vcpkgInvokeCommandClean] Don't use -encodedCommand. Instead, use -Command with the appropriate number of escaped quotes (which ended up being 3) * [blosc] Update to 1.13.5 static-install-fix.patch no longer required (upstream contains the patched version). Resolves build error with VS 15.6 in static builds * [cgal] Avoid using absolute paths in cmake config file * Update CHANGELOG and bump version to v0.0.104 * [qt5-base][qtdeploy] Deploy plugin dependencies to the executable's folder. * Add libgeotiff port Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgeotiff] fix install directory for cmake configurations Signed-off-by: Hiroshi Miura <miurahr@linux.com> * fix tiff detection error when static build * [libgeotiff] remove installed dlls when static build * [libgeotiff] update description * [chipmunk] 7.0.2 initial. * [recast] 1.5.1 initial. * [tinydir] 1.2.3 initial. * [mman] git-f5ff813 initial. * Update Catch to 2.1.2 (#2763) * [vcpkg-ci] Delete intermediate build folders even on unsuccesful builds * [folly] Workaround bug for VS 15.6 * [pcre] fix space issue and add mirror (fix #2751) * [realsense2] Update to v2.10.0 Update realsense2 port to librealsense v2.10.0. * [libevent] Fix generated libevent targets files * fixed typo in warning message (#2773) * [blaze] update to Blaze 3.3 * [lmdb] Fix possible whitespace problem * Fix date issue * add qt5-quickcontrols2 * add qt5-quickcontrols port * add qt5-graphicaleffects * change compile order to debug first, fix #2767 (#2785) * [liblzma] Add usage information * [ffmpeg] Allow static builds of ffmpeg (#2783) ffmpeg creates static .a libraries, so change the suffix to .lib * [ffmpeg] Bump version for PR #2783 * [aubio] Update to handle static FFMPEG * Copy local dependencies for library targets (#2787) * Fix for issue #2786 * [vcpkg-cmake-toolchain] Only applocal dependencies for shared libraries * [uriparser] Update to 0.8.5 * [vcpkg] Implement Default-Features (#2697) * [vcpkg] Add Default-Feature to make_status_pgh utility function Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Parse "Default-Features" as dependencies and add test for parsing Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Document some methods and structures Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Add install_default_features_test Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Change install_default_features_test to not have preinstalled package * [vcpkg] Test install behaviour of default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Implement default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Test default features upgrade behavior Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Implement upgrade with default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Test behaviour of upgrade with default features in dependencies Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Make upgrade install new default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Move collecting of packages for which to prevent defaults Further down the line to create_feature_install_plan. Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Fix core missing from default features and potential inf loop Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Rename, fix and move some tests Signed-off-by: Squareys <squareys@googlemail.com> * Updated boost license to 1.66.0 (#2795) I was a bit confused to see a reference to "1.65.1" while I was installing 1.66.0, but it turns out this URL is just not updated. This updates it. * [vcpkg-find-acquire-program] Add mirror for NASM. Fixes #2777. * update cuda requirement to 9.0, fixes #2791 (#2802) * update cuda requirement to 9.0, fixes #2791 * [cuda] Restore sample version blob * [vcpkg] http_proxy and https_proxy should be lowercase (#2815) Pacman of Msys understands only lowercase environment variables http_proxy and https_proxy. * [vcpkg] Add find/find_installed/is_installed for FeatureSpec Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Fix build command for packages that depend of features Signed-off-by: Squareys <squareys@googlemail.com> * [liblo] Initial port (#2821) * [portaudio] Added ASIO support to build * Update libpng to 1.6.34 * [liblo] Initial port * Revert "Update libpng to 1.6.34" This reverts commit ede0bb947b07aea119b7b05e3625c3eec1395af4. * Revert "[liblo] Initial port" This reverts commit bb819eb21841bb8cf4816af5a78e17ef58ec8ce5. * [liblo] Initial port * [liblo] Use vcpkg_from_github() and vcpkg_fixup_cmake_targets() * [liblo] Fix SHA512 * [openvr] update to 1.0.13 (#2809) * [ebml] Initial port. (#2812) * [vcpkg] Fix bug with missing dependencies introduced in #2697 (#2819) When a package dependency was not found (has no source control file), install would exit with "Value was null" when trying to install its default features, as the dependency would be marked erroneously as found in this case. Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Avoid using s::status_known() -- it does not do what you think it does * [jansson] Update to 2.11 (#2820) * [aws-sdk-cpp] update to 1.3.58 (#2810) * [mkl] Add port MKL (#2806) * [corrade,magnum,-plugins,-extras,-integration] Update to latest and support feature packages (#2687) [corrade,magnum,-plugins,-extras,-integration] Update to latest and support feature packages * [jbig2dec][libmupdf] Extract jbig2dec, remove remaining vendored 3rdparty
2018-02-17 05:31:49 -05:00
## ### DISABLE_PARALLEL_CONFIGURE
## Disables running the CMake configure step in parallel.
##
## This is needed for libraries which write back into their source directory during configure.
##
## ### GENERATOR
## Specifies the precise generator to use.
##
## This is useful if some project-specific buildsystem has been wrapped in a cmake script that won't perform an actual build. If used for this purpose, it should be set to "NMake Makefiles".
##
## ### OPTIONS
## Additional options passed to CMake during the configuration.
##
## ### OPTIONS_RELEASE
## Additional options passed to CMake during the Release configuration. These are in addition to `OPTIONS`.
##
## ### OPTIONS_DEBUG
## Additional options passed to CMake during the Debug configuration. These are in addition to `OPTIONS`.
##
## ## Notes
## This command supplies many common arguments to CMake. To see the full list, examine the source.
##
## ## Examples
##
## * [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake)
## * [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake)
## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake)
## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake)
2016-09-18 20:50:08 -07:00
function(vcpkg_configure_cmake)
libmupdf version bump (#2730) * Add libgta Libgta is a portable library that implements the Generic Tagged Array (GTA) file format. Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgta] turn off document build and doxygen dependency Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgta] add build-dependency - bzip2, zlib and liblzma Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgta] remove dlls when static build Signed-off-by: Hiroshi Miura <miurahr@linux.com> * Fix typo * [libgta] update CONTROL add lf at end of file. * libmupdf version bump * [qt5-base] Use system freetype. * [opencv] Fix UWP and ARM * [hdf5] Always use config mode for HDF5 * [opencv] Fixup -- apply patch added in previous commit * [abseil] Add *.inc files. Fixes #2718 * [abseil] Update to 2018-2-5 * Fix for Issue #2729 Allows PowerShell to change the name of the downloaded directory correctly. * vcpkgRemoveItem: nullcheck * [cpprestsdk] Update to 2.10.2 * Adding Torch's TH library (#2737) Adding Torch's TH library * [flatbuffers] Fixes #2735 * sobjectizer updated to v.5.5.21 * [nghttp2] Enable static builds * [nghttp2]: update to 1.30.0 (#2739) * [nghttp2]: update to 1.30.0 * [nghttp2] Enable static builds * Add epsilon library port Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [vcpkg-configure-cmake] Use ninja to configure in parallel (#2712) * [curl] Add nghttp2.lib to dependencies of curl * [vtk] Fix breaking change in find_package(HDF5) * Merge findFileRecursivelyUp into VcpkgPowershellUtils * [vcpkgInvokeCommandClean] Don't use -encodedCommand. Instead, use -Command with the appropriate number of escaped quotes (which ended up being 3) * [blosc] Update to 1.13.5 static-install-fix.patch no longer required (upstream contains the patched version). Resolves build error with VS 15.6 in static builds * [cgal] Avoid using absolute paths in cmake config file * Update CHANGELOG and bump version to v0.0.104 * [qt5-base][qtdeploy] Deploy plugin dependencies to the executable's folder. * Add libgeotiff port Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgeotiff] fix install directory for cmake configurations Signed-off-by: Hiroshi Miura <miurahr@linux.com> * fix tiff detection error when static build * [libgeotiff] remove installed dlls when static build * [libgeotiff] update description * [chipmunk] 7.0.2 initial. * [recast] 1.5.1 initial. * [tinydir] 1.2.3 initial. * [mman] git-f5ff813 initial. * Update Catch to 2.1.2 (#2763) * [vcpkg-ci] Delete intermediate build folders even on unsuccesful builds * [folly] Workaround bug for VS 15.6 * [pcre] fix space issue and add mirror (fix #2751) * [realsense2] Update to v2.10.0 Update realsense2 port to librealsense v2.10.0. * [libevent] Fix generated libevent targets files * fixed typo in warning message (#2773) * [blaze] update to Blaze 3.3 * [lmdb] Fix possible whitespace problem * Fix date issue * add qt5-quickcontrols2 * add qt5-quickcontrols port * add qt5-graphicaleffects * change compile order to debug first, fix #2767 (#2785) * [liblzma] Add usage information * [ffmpeg] Allow static builds of ffmpeg (#2783) ffmpeg creates static .a libraries, so change the suffix to .lib * [ffmpeg] Bump version for PR #2783 * [aubio] Update to handle static FFMPEG * Copy local dependencies for library targets (#2787) * Fix for issue #2786 * [vcpkg-cmake-toolchain] Only applocal dependencies for shared libraries * [uriparser] Update to 0.8.5 * [vcpkg] Implement Default-Features (#2697) * [vcpkg] Add Default-Feature to make_status_pgh utility function Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Parse "Default-Features" as dependencies and add test for parsing Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Document some methods and structures Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Add install_default_features_test Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Change install_default_features_test to not have preinstalled package * [vcpkg] Test install behaviour of default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Implement default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Test default features upgrade behavior Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Implement upgrade with default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Test behaviour of upgrade with default features in dependencies Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Make upgrade install new default features Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Move collecting of packages for which to prevent defaults Further down the line to create_feature_install_plan. Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Fix core missing from default features and potential inf loop Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Rename, fix and move some tests Signed-off-by: Squareys <squareys@googlemail.com> * Updated boost license to 1.66.0 (#2795) I was a bit confused to see a reference to "1.65.1" while I was installing 1.66.0, but it turns out this URL is just not updated. This updates it. * [vcpkg-find-acquire-program] Add mirror for NASM. Fixes #2777. * update cuda requirement to 9.0, fixes #2791 (#2802) * update cuda requirement to 9.0, fixes #2791 * [cuda] Restore sample version blob * [vcpkg] http_proxy and https_proxy should be lowercase (#2815) Pacman of Msys understands only lowercase environment variables http_proxy and https_proxy. * [vcpkg] Add find/find_installed/is_installed for FeatureSpec Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Fix build command for packages that depend of features Signed-off-by: Squareys <squareys@googlemail.com> * [liblo] Initial port (#2821) * [portaudio] Added ASIO support to build * Update libpng to 1.6.34 * [liblo] Initial port * Revert "Update libpng to 1.6.34" This reverts commit ede0bb947b07aea119b7b05e3625c3eec1395af4. * Revert "[liblo] Initial port" This reverts commit bb819eb21841bb8cf4816af5a78e17ef58ec8ce5. * [liblo] Initial port * [liblo] Use vcpkg_from_github() and vcpkg_fixup_cmake_targets() * [liblo] Fix SHA512 * [openvr] update to 1.0.13 (#2809) * [ebml] Initial port. (#2812) * [vcpkg] Fix bug with missing dependencies introduced in #2697 (#2819) When a package dependency was not found (has no source control file), install would exit with "Value was null" when trying to install its default features, as the dependency would be marked erroneously as found in this case. Signed-off-by: Squareys <squareys@googlemail.com> * [vcpkg] Avoid using s::status_known() -- it does not do what you think it does * [jansson] Update to 2.11 (#2820) * [aws-sdk-cpp] update to 1.3.58 (#2810) * [mkl] Add port MKL (#2806) * [corrade,magnum,-plugins,-extras,-integration] Update to latest and support feature packages (#2687) [corrade,magnum,-plugins,-extras,-integration] Update to latest and support feature packages * [jbig2dec][libmupdf] Extract jbig2dec, remove remaining vendored 3rdparty
2018-02-17 05:31:49 -05:00
cmake_parse_arguments(_csc "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN})
2016-09-18 20:50:08 -07:00
if(NOT VCPKG_PLATFORM_TOOLSET)
message(FATAL_ERROR "Vcpkg has been updated with VS2017 support, however you need to rebuild vcpkg.exe by re-running bootstrap-vcpkg.bat\n")
endif()
2017-05-03 19:11:29 +02:00
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(_csc_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITEW6432})
else()
set(_csc_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITECTURE})
endif()
set(NINJA_CAN_BE_USED ON) # Ninja as generator
set(NINJA_HOST ON) # Ninja as parallel configurator
if(_csc_HOST_ARCHITECTURE STREQUAL "x86")
# Prebuilt ninja binaries are only provided for x64 hosts
set(NINJA_CAN_BE_USED OFF)
set(NINJA_HOST OFF)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
# Ninja and MSBuild have many differences when targetting UWP, so use MSBuild to maximize existing compatibility
set(NINJA_CAN_BE_USED OFF)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
# Arm64 usage should be allowed once github issue #2375 is resolved
set(NINJA_CAN_BE_USED OFF)
endif()
2016-09-18 20:50:08 -07:00
if(_csc_GENERATOR)
set(GENERATOR ${_csc_GENERATOR})
elseif(_csc_PREFER_NINJA AND NINJA_CAN_BE_USED)
set(GENERATOR "Ninja")
elseif(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
2017-02-03 17:16:13 +01:00
set(GENERATOR "Ninja")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
set(GENERATOR "Visual Studio 12 2013")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
set(GENERATOR "Visual Studio 12 2013 Win64")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
set(GENERATOR "Visual Studio 12 2013 ARM")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
2016-09-18 20:50:08 -07:00
set(GENERATOR "Visual Studio 14 2015")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
2016-09-18 20:50:08 -07:00
set(GENERATOR "Visual Studio 14 2015 Win64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
set(GENERATOR "Visual Studio 14 2015 ARM")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
set(GENERATOR "Visual Studio 15 2017")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
set(GENERATOR "Visual Studio 15 2017 Win64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
set(GENERATOR "Visual Studio 15 2017 ARM")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141")
2017-09-24 16:01:37 +03:00
set(GENERATOR "Visual Studio 15 2017")
set(ARCH "ARM64")
else()
message(FATAL_ERROR "Unable to determine appropriate generator for: ${VCPKG_CMAKE_SYSTEM_NAME}-${VCPKG_TARGET_ARCHITECTURE}-${VCPKG_PLATFORM_TOOLSET}")
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
if(GENERATOR STREQUAL "Ninja")
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}")
2017-02-03 17:16:13 +01:00
endif()
2016-09-18 20:50:08 -07:00
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
if(DEFINED VCPKG_CMAKE_SYSTEM_NAME)
list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}")
endif()
if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=ON)
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=OFF)
else()
message(FATAL_ERROR "Invalid setting for VCPKG_LIBRARY_LINKAGE: \"${VCPKG_LIBRARY_LINKAGE}\". It must be \"static\" or \"dynamic\"")
endif()
2017-05-30 12:24:21 -07:00
if((NOT DEFINED VCPKG_CXX_FLAGS_DEBUG AND NOT DEFINED VCPKG_C_FLAGS_DEBUG) OR
(DEFINED VCPKG_CXX_FLAGS_DEBUG AND DEFINED VCPKG_C_FLAGS_DEBUG))
else()
message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS_DEBUG and VCPKG_C_FLAGS_DEBUG")
endif()
if((NOT DEFINED VCPKG_CXX_FLAGS_RELEASE AND NOT DEFINED VCPKG_C_FLAGS_RELEASE) OR
(DEFINED VCPKG_CXX_FLAGS_RELEASE AND DEFINED VCPKG_C_FLAGS_RELEASE))
else()
message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS_RELEASE and VCPKG_C_FLAGS_RELEASE")
endif()
if((NOT DEFINED VCPKG_CXX_FLAGS AND NOT DEFINED VCPKG_C_FLAGS) OR
(DEFINED VCPKG_CXX_FLAGS AND DEFINED VCPKG_C_FLAGS))
else()
message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS and VCPKG_C_FLAGS")
endif()
if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
else()
set(VCPKG_CXX_FLAGS " /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP ${VCPKG_CXX_FLAGS}")
set(VCPKG_C_FLAGS " /DWIN32 /D_WINDOWS /W3 /utf-8 /MP ${VCPKG_C_FLAGS}")
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
list(APPEND _csc_OPTIONS_DEBUG
"-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
"-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
)
list(APPEND _csc_OPTIONS_RELEASE
"-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}"
"-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}"
)
elseif(VCPKG_CRT_LINKAGE STREQUAL "static")
list(APPEND _csc_OPTIONS_DEBUG
"-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
"-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
)
list(APPEND _csc_OPTIONS_RELEASE
"-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}"
"-DCMAKE_C_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}"
)
else()
message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"")
endif()
list(APPEND _csc_OPTIONS_RELEASE
"-DCMAKE_SHARED_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}"
"-DCMAKE_EXE_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}"
)
list(APPEND _csc_OPTIONS
"-DCMAKE_CXX_FLAGS=${VCPKG_CXX_FLAGS}"
"-DCMAKE_C_FLAGS=${VCPKG_C_FLAGS}"
)
endif()
list(APPEND _csc_OPTIONS
"-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}"
"-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
"-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
"-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON"
"-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE"
"-DCMAKE_VERBOSE_MAKEFILE=ON"
"-DVCPKG_APPLOCAL_DEPS=OFF"
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/buildsystems/vcpkg.cmake"
"-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON"
)
2017-05-30 12:24:21 -07:00
2017-09-24 16:01:37 +03:00
if(DEFINED ARCH)
list(APPEND _csc_OPTIONS
"-A${ARCH}"
)
endif()
set(rel_command
${CMAKE_COMMAND} ${_csc_SOURCE_PATH} "${_csc_OPTIONS}" "${_csc_OPTIONS_RELEASE}"
-G ${GENERATOR}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR})
set(dbg_command
${CMAKE_COMMAND} ${_csc_SOURCE_PATH} "${_csc_OPTIONS}" "${_csc_OPTIONS_DEBUG}"
-G ${GENERATOR}
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug)
if(NINJA_HOST AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND NOT _csc_DISABLE_PARALLEL_CONFIGURE)
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}")
#parallelize the configure step
set(_contents
"rule CreateProcess\n command = $process\n\n"
)
2016-09-18 20:50:08 -07:00
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
set(rel_line "build ../CMakeCache.txt: CreateProcess\n process = cmd /c \"cd .. &&")
foreach(arg ${rel_command})
set(rel_line "${rel_line} \"${arg}\"")
endforeach()
set(_contents "${_contents}${rel_line}\"\n\n")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(dbg_line "build ../../${TARGET_TRIPLET}-dbg/CMakeCache.txt: CreateProcess\n process = cmd /c \"cd ../../${TARGET_TRIPLET}-dbg &&")
foreach(arg ${dbg_command})
set(dbg_line "${dbg_line} \"${arg}\"")
endforeach()
set(_contents "${_contents}${dbg_line}\"\n\n")
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}")
vcpkg_execute_required_process(
COMMAND ninja -v
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure
LOGNAME config-${TARGET_TRIPLET}
)
message(STATUS "Configuring ${TARGET_TRIPLET} done")
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(
COMMAND ${dbg_command}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME config-${TARGET_TRIPLET}-dbg
)
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
endif()
2018-03-01 17:31:14 +01: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(
COMMAND ${rel_command}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME config-${TARGET_TRIPLET}-rel
)
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
endif()
endif()
set(_VCPKG_CMAKE_GENERATOR "${GENERATOR}" PARENT_SCOPE)
2018-03-01 17:31:14 +01:00
endfunction()