aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake
diff options
context:
space:
mode:
authornicole mazzuca <mazzucan@outlook.com>2020-06-30 10:40:18 -0700
committerGitHub <noreply@github.com>2020-06-30 10:40:18 -0700
commit1d8f0acc9c3085d18152a3f639077a28109196b6 (patch)
tree1daa4780e0d5f51844217dc61dbf275433153abf /scripts/cmake
parent67ab6130b64cce6701c5a95ca3b9bdc4d949cb8a (diff)
downloadvcpkg-1d8f0acc9c3085d18152a3f639077a28109196b6.tar.gz
vcpkg-1d8f0acc9c3085d18152a3f639077a28109196b6.zip
[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
Diffstat (limited to 'scripts/cmake')
-rw-r--r--scripts/cmake/vcpkg_build_msbuild.cmake1
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake1
-rw-r--r--scripts/cmake/vcpkg_fixup_pkgconfig.cmake44
-rw-r--r--scripts/cmake/vcpkg_install_msbuild.cmake1
4 files changed, 25 insertions, 22 deletions
diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake
index 67ff3d3ae..bc118b4c0 100644
--- a/scripts/cmake/vcpkg_build_msbuild.cmake
+++ b/scripts/cmake/vcpkg_build_msbuild.cmake
@@ -96,6 +96,7 @@ function(vcpkg_build_msbuild)
/p:VCPkgLocalAppDataDisabled=true
/p:UseIntelMKL=No
/p:WindowsTargetPlatformVersion=${_csc_TARGET_PLATFORM_VERSION}
+ /p:VcpkgManifestInstall=false
/m
)
diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake
index 4debcb718..9f75c5e07 100644
--- a/scripts/cmake/vcpkg_configure_cmake.cmake
+++ b/scripts/cmake/vcpkg_configure_cmake.cmake
@@ -238,6 +238,7 @@ function(vcpkg_configure_cmake)
"-DCMAKE_INSTALL_BINDIR:STRING=bin"
"-D_VCPKG_ROOT_DIR=${VCPKG_ROOT_DIR}"
"-D_VCPKG_INSTALLED_DIR=${_VCPKG_INSTALLED_DIR}"
+ "-DVCPKG_MANIFEST_INSTALL=OFF"
)
if(DEFINED ARCH)
diff --git a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake
index a5495a423..6acb51360 100644
--- a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake
+++ b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake
@@ -13,7 +13,7 @@
##
## ## Parameters
## ### RELEASE_FILES
-## Specifies a list of files to apply the fixes for release paths.
+## Specifies a list of files to apply the fixes for release paths.
## Defaults to every *.pc file in the folder ${CURRENT_PACKAGES_DIR} without ${CURRENT_PACKAGES_DIR}/debug/
##
## ### DEBUG_FILES
@@ -22,11 +22,11 @@
##
## ### SYSTEM_PACKAGES
## If the *.pc file contains system packages outside vcpkg these need to be listed here.
-## Since vcpkg checks the existence of all required packages within vcpkg.
+## Since vcpkg checks the existence of all required packages within vcpkg.
##
## ### SYSTEM_LIBRARIES
## If the *.pc file contains system libraries outside vcpkg these need to be listed here.
-## VCPKG checks every -l flag for the existence of the required library within vcpkg.
+## VCPKG checks every -l flag for the existence of the required library within vcpkg.
##
## ### IGNORE_FLAGS
## If the *.pc file contains flags in the lib field which are not libraries. These can be listed here
@@ -36,7 +36,7 @@
##
## ## Examples
##
-## Just call vcpkg_fixup_pkgconfig() after any install step which installs *.pc files.
+## Just call vcpkg_fixup_pkgconfig() after any install step which installs *.pc files.
function(vcpkg_fixup_pkgconfig_check_libraries _config _contents_var _system_libs _system_packages _ignore_flags)
set(CMAKE_FIND_LIBRARY_SUFFIXES_BACKUP ${CMAKE_FIND_LIBRARY_SUFFIXES})
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll.a;.a")
@@ -64,7 +64,7 @@ function(vcpkg_fixup_pkgconfig_check_libraries _config _contents_var _system_lib
string(REPLACE "-l" "" _system_lib "${_system_lib}")
list(APPEND _system_lib_normalized "${_system_lib}")
endforeach()
-
+
## Extra libraries:
string(REGEX MATCH "Libs:[^\n#]+" _libs "${_contents}")
#message(STATUS "LIB LINE: ${_libs}")
@@ -133,9 +133,9 @@ function(vcpkg_fixup_pkgconfig_check_libraries _config _contents_var _system_lib
endif()
else()
#handle special cases
- if(_lib STREQUAL "-pthread" OR _lib STREQUAL "-pthreads")
+ if(_lib STREQUAL "-pthread" OR _lib STREQUAL "-pthreads")
# Replace with VCPKG version?
- #VCPKG should probably rename one of the pthread versions to avoid linking against system pthread?
+ #VCPKG should probably rename one of the pthread versions to avoid linking against system pthread?
# set(PTHREAD_SUFFIX )
# if("${_config}" STREQUAL "DEBUG")
# file(GLOB PTHREAD_LIB "${CURRENT_INSTALLED_DIR}/debug/lib/${VCPKG_TARGET_STATIC_LIBRARY_PREFIX}pthread*C3d.*")
@@ -165,18 +165,18 @@ function(vcpkg_fixup_pkgconfig_check_libraries _config _contents_var _system_lib
string(REGEX REPLACE "[\t ]*,[\t ]*" ";" _pkg_private_list_tmp "${_pkg_private_list_tmp}")
string(REGEX REPLACE "[\t ]*(>|=)+[\t ]*([0-9]+|\\.)+" " " _pkg_private_list_tmp "${_pkg_private_list_tmp}")
string(REGEX REPLACE "[\t ]+" ";" _pkg_private_list_tmp "${_pkg_private_list_tmp}")
-
+
debug_message("Required packages: ${_pkg_list_tmp}")
debug_message("Required private packages: ${_pkg_private_list_tmp}")
-
+
#message(STATUS "System packages: ${_system_packages}")
foreach(_package ${_pkg_list_tmp} ${_pkg_private_list_tmp})
debug_message("Searching for package: ${_package}")
set(PKG_CHECK ON)
if(NOT "${_system_packages}" STREQUAL "")
- #message(STATUS "Checking ${_package} for SYSTEM PACKAGE: ${_system_packages}")
+ #message(STATUS "Checking ${_package} for SYSTEM PACKAGE: ${_system_packages}")
if("${_system_packages}" MATCHES "${_package}" )
- debug_message("Package ${_package} is SYSTEM PACKAGE!")
+ debug_message("Package ${_package} is SYSTEM PACKAGE!")
set(PKG_CHECK OFF)
endif()
endif()
@@ -193,7 +193,7 @@ endfunction()
function(vcpkg_fixup_pkgconfig)
cmake_parse_arguments(_vfpkg "" "" "RELEASE_FILES;DEBUG_FILES;SYSTEM_LIBRARIES;SYSTEM_PACKAGES;IGNORE_FLAGS" ${ARGN})
-
+
if(VCPKG_SYSTEM_LIBRARIES)
list(APPEND _vfpkg_SYSTEM_LIBRARIES ${VCPKG_SYSTEM_LIBRARIES})
endif()
@@ -206,16 +206,16 @@ function(vcpkg_fixup_pkgconfig)
file(GLOB_RECURSE _vfpkg_RELEASE_FILES "${CURRENT_PACKAGES_DIR}/**/*.pc")
list(FILTER _vfpkg_RELEASE_FILES EXCLUDE REGEX "${CURRENT_PACKAGES_DIR}/debug/")
endif()
-
+
if(NOT _vfpkg_DEBUG_FILES)
file(GLOB_RECURSE _vfpkg_DEBUG_FILES "${CURRENT_PACKAGES_DIR}/debug/**/*.pc")
list(FILTER _vfpkg_DEBUG_FILES INCLUDE REGEX "${CURRENT_PACKAGES_DIR}/debug/")
endif()
-
- #Absolute Unix like paths
+
+ #Absolute Unix like paths
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}")
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}")
-
+
message(STATUS "Fixing pkgconfig - release")
debug_message("Files: ${_vfpkg_RELEASE_FILES}")
foreach(_file ${_vfpkg_RELEASE_FILES})
@@ -235,7 +235,7 @@ function(vcpkg_fixup_pkgconfig)
file(WRITE "${_file}" "${_contents}")
unset(PKG_LIB_SEARCH_PATH)
endforeach()
-
+
message(STATUS "Fixing pkgconfig - debug")
debug_message("Files: ${_vfpkg_DEBUG_FILES}")
foreach(_file ${_vfpkg_DEBUG_FILES})
@@ -257,17 +257,17 @@ function(vcpkg_fixup_pkgconfig)
string(REPLACE "debug/lib" "lib" _contents "${_contents}") # the prefix will contain the debug keyword
string(REGEX REPLACE "^prefix=(\\\\)?\\\${prefix}(/debug)?" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
- string(REPLACE "\${prefix}/debug" "\${prefix}" _contents "${_contents}") # replace remaining debug paths if they exist.
+ string(REPLACE "\${prefix}/debug" "\${prefix}" _contents "${_contents}") # replace remaining debug paths if they exist.
vcpkg_fixup_pkgconfig_check_libraries("DEBUG" _contents "${_vfpkg_SYSTEM_LIBRARIES}" "${_vfpkg_SYSTEM_PACKAGES}" "${_vfpkg_IGNORE_FLAGS}")
file(WRITE "${_file}" "${_contents}")
unset(PKG_LIB_SEARCH_PATH)
endforeach()
message(STATUS "Fixing pkgconfig --- finished")
-
- set(VCPKG_FIXUP_PKGCONFIG_CALLED TRUE CACHE INTERNAL "See below" FORCE)
- # Variable to check if this function has been called!
+
+ set(VCPKG_FIXUP_PKGCONFIG_CALLED TRUE CACHE INTERNAL "See below" FORCE)
+ # Variable to check if this function has been called!
# Theoreotically vcpkg could look for *.pc files and automatically call this function
- # or check if this function has been called if *.pc files are detected.
+ # or check if this function has been called if *.pc files are detected.
# The same is true for vcpkg_fixup_cmake_targets
endfunction()
diff --git a/scripts/cmake/vcpkg_install_msbuild.cmake b/scripts/cmake/vcpkg_install_msbuild.cmake
index 8fc0298e0..1a0d9513d 100644
--- a/scripts/cmake/vcpkg_install_msbuild.cmake
+++ b/scripts/cmake/vcpkg_install_msbuild.cmake
@@ -138,6 +138,7 @@ function(vcpkg_install_msbuild)
/p:WindowsTargetPlatformVersion=${_csc_TARGET_PLATFORM_VERSION}
/p:VcpkgTriplet=${TARGET_TRIPLET}
"/p:VcpkgCurrentInstalledDir=${CURRENT_INSTALLED_DIR}"
+ /p:VcpkgManifestInstall=false
/m
)