From 9da31a4d7a7195d8dcefd19eca8ed70198fd4bbf Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Sun, 18 Jul 2021 20:34:10 -0700 Subject: [PATCH 1/7] [rollup:2021-07-16 1/7] PR #18201 (@JackBoosY) [vcpkg-cmake] Add check for unused cmake variables --- .../vcpkg-cmake/vcpkg_cmake_configure.md | 7 ++ docs/maintainers/vcpkg_configure_cmake.md | 4 ++ ports/vcpkg-cmake/vcpkg.json | 2 +- ports/vcpkg-cmake/vcpkg_cmake_configure.cmake | 66 +++++++++++++++++-- scripts/cmake/vcpkg_configure_cmake.cmake | 64 +++++++++++++++++- .../cmake/vcpkg_internal_get_cmake_vars.cmake | 1 + versions/baseline.json | 2 +- versions/v-/vcpkg-cmake.json | 5 ++ 8 files changed, 143 insertions(+), 8 deletions(-) diff --git a/docs/maintainers/ports/vcpkg-cmake/vcpkg_cmake_configure.md b/docs/maintainers/ports/vcpkg-cmake/vcpkg_cmake_configure.md index 95830313df41ba..3745df08058fec 100644 --- a/docs/maintainers/ports/vcpkg-cmake/vcpkg_cmake_configure.md +++ b/docs/maintainers/ports/vcpkg-cmake/vcpkg_cmake_configure.md @@ -18,6 +18,8 @@ vcpkg_cmake_configure( ...] [OPTIONS_DEBUG ...] + [MAYBE_UNUSED_VARIABLES + ...] ) ``` @@ -56,6 +58,11 @@ By default, this function adds flags to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS` which set the default character set to utf-8 for MSVC. If the library sets its own code page, pass the `NO_CHARSET_FLAG` option. +This function makes certain that all options passed in are used by the +underlying CMake build system. If there are options that might be unused, +perhaps on certain platforms, pass those variable names to +`MAYBE_UNUSED_VARIABLES`. + `LOGFILE_BASE` is used to set the base of the logfile names; by default, this is `config`, and thus the logfiles end up being something like `config-x86-windows-dbg.log`. You can set it to anything you like; diff --git a/docs/maintainers/vcpkg_configure_cmake.md b/docs/maintainers/vcpkg_configure_cmake.md index 195017b3c93e80..fd6ce13187bb7a 100644 --- a/docs/maintainers/vcpkg_configure_cmake.md +++ b/docs/maintainers/vcpkg_configure_cmake.md @@ -17,6 +17,7 @@ vcpkg_configure_cmake( [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] [OPTIONS_RELEASE <-DOPTIMIZE=1>...] [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] + [MAYBE_UNUSED_VARIABLES ...] ) ``` @@ -55,6 +56,9 @@ Additional options passed to CMake during the Release configuration. These are i ### OPTIONS_DEBUG Additional options passed to CMake during the Debug configuration. These are in addition to `OPTIONS`. +### MAYBE_UNUSED_VARIABLES +Any CMake variables which are explicitly passed in, but which may not be used on all platforms. + ### LOGNAME Name of the log to write the output of the configure call to. diff --git a/ports/vcpkg-cmake/vcpkg.json b/ports/vcpkg-cmake/vcpkg.json index ffda714e3fe066..88ee459ff35111 100644 --- a/ports/vcpkg-cmake/vcpkg.json +++ b/ports/vcpkg-cmake/vcpkg.json @@ -1,5 +1,5 @@ { "name": "vcpkg-cmake", "version-date": "2021-06-25", - "port-version": 4 + "port-version": 5 } diff --git a/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake b/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake index beffd32b0519ba..aa99a81ce282d1 100644 --- a/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake +++ b/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake @@ -17,6 +17,8 @@ vcpkg_cmake_configure( ...] [OPTIONS_DEBUG ...] + [MAYBE_UNUSED_VARIABLES + ...] ) ``` @@ -55,6 +57,11 @@ By default, this function adds flags to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS` which set the default character set to utf-8 for MSVC. If the library sets its own code page, pass the `NO_CHARSET_FLAG` option. +This function makes certain that all options passed in are used by the +underlying CMake build system. If there are options that might be unused, +perhaps on certain platforms, pass those variable names to +`MAYBE_UNUSED_VARIABLES`. + `LOGFILE_BASE` is used to set the base of the logfile names; by default, this is `config`, and thus the logfiles end up being something like `config-x86-windows-dbg.log`. You can set it to anything you like; @@ -88,7 +95,7 @@ function(vcpkg_cmake_configure) cmake_parse_arguments(PARSE_ARGV 0 "arg" "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE;WINDOWS_USE_MSBUILD;NO_CHARSET_FLAG" "SOURCE_PATH;GENERATOR;LOGFILE_BASE" - "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" + "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;MAYBE_UNUSED_VARIABLES" ) if(DEFINED CACHE{Z_VCPKG_CMAKE_GENERATOR}) @@ -102,9 +109,19 @@ function(vcpkg_cmake_configure) message(FATAL_ERROR "SOURCE_PATH must be set") endif() if(NOT DEFINED arg_LOGFILE_BASE) - set(arg_LOGFILE_BASE "config") + set(arg_LOGFILE_BASE "config-${TARGET_TRIPLET}") endif() + set(manually_specified_variables "") + foreach(option IN LISTS arg_OPTIONS arg_OPTIONS_RELEASE arg_OPTIONS_DEBUG) + if(option MATCHES "^-D([^:=]*)[:=]") + list(APPEND manually_specified_variables "${CMAKE_MATCH_1}") + endif() + endforeach() + list(REMOVE_DUPLICATES manually_specified_variables) + list(REMOVE_ITEM manually_specified_variables ${arg_MAYBE_UNUSED_VARIABLES}) + debug_message("manually specified variables: ${manually_specified_variables}") + if(CMAKE_HOST_WIN32) if(DEFINED ENV{PROCESSOR_ARCHITEW6432}) set(host_architecture "$ENV{PROCESSOR_ARCHITEW6432}") @@ -364,8 +381,11 @@ function(vcpkg_cmake_configure) vcpkg_execute_required_process( COMMAND ninja -v WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure" - LOGNAME "${arg_LOGFILE_BASE}-${TARGET_TRIPLET}" + LOGNAME "${arg_LOGFILE_BASE}" ) + list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-err.log") else() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") @@ -379,8 +399,11 @@ function(vcpkg_cmake_configure) "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug" WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" - LOGNAME "${arg_LOGFILE_BASE}-${TARGET_TRIPLET}-dbg" + LOGNAME "${arg_LOGFILE_BASE}-dbg" ) + list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-dbg-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-dbg-err.log") endif() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") @@ -397,7 +420,42 @@ function(vcpkg_cmake_configure) WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" LOGNAME "${arg_LOGFILE_BASE}-rel" ) + list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-rel-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_BASE}-rel-err.log") + endif() + endif() + + set(all_unused_variables) + foreach(config_log IN LISTS config_logs) + if(NOT EXISTS "${config_log}") + continue() endif() + file(READ "${config_log}" log_contents) + debug_message("Reading configure log ${config_log}...") + if(NOT log_contents MATCHES "Manually-specified variables were not used by the project:\n\n(( [^\n]*\n)*)") + continue() + endif() + 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) + if(unused_variable IN_LIST manually_specified_variables) + debug_message("manually specified unused variable: ${unused_variable}") + list(APPEND all_unused_variables "${unused_variable}") + else() + debug_message("unused variable (not manually specified): ${unused_variable}") + endif() + endforeach() + endforeach() + + if(DEFINED all_unused_variables) + list(REMOVE_DUPLICATES all_unused_variables) + list(JOIN all_unused_variables "\n " all_unused_variables) + message(WARNING "The following variables are not used in CMakeLists.txt: + ${all_unused_variables} +Please recheck them and remove the unnecessary options from the `vcpkg_cmake_configure` call. +If these options should still be passed for whatever reason, please use the `MAYBE_UNUSED_VARIABLES` argument.") endif() set(Z_VCPKG_CMAKE_GENERATOR "${generator}" CACHE INTERNAL "The generator which was used to configure CMake.") diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 1eb50e852b9699..bce3f6af583629 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -15,6 +15,7 @@ vcpkg_configure_cmake( [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] [OPTIONS_RELEASE <-DOPTIMIZE=1>...] [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] + [MAYBE_UNUSED_VARIABLES ...] ) ``` @@ -53,6 +54,9 @@ Additional options passed to CMake during the Release configuration. These are i ### OPTIONS_DEBUG Additional options passed to CMake during the Debug configuration. These are in addition to `OPTIONS`. +### MAYBE_UNUSED_VARIABLES +Any CMake variables which are explicitly passed in, but which may not be used on all platforms. + ### LOGNAME Name of the log to write the output of the configure call to. @@ -73,9 +77,9 @@ function(vcpkg_configure_cmake) endif() cmake_parse_arguments(PARSE_ARGV 0 arg - "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE;NO_CHARSET_FLAG" + "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE;NO_CHARSET_FLAG;Z_VCPKG_IGNORE_UNUSED_VARIABLES" "SOURCE_PATH;GENERATOR;LOGNAME" - "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" + "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;MAYBE_UNUSED_VARIABLES" ) if(NOT VCPKG_PLATFORM_TOOLSET) @@ -87,6 +91,18 @@ function(vcpkg_configure_cmake) set(arg_LOGNAME config-${TARGET_TRIPLET}) endif() + set(manually_specified_variables "") + if(NOT arg_Z_VCPKG_IGNORE_UNUSED_VARIABLES) + foreach(option IN LISTS arg_OPTIONS arg_OPTIONS_RELEASE arg_OPTIONS_DEBUG) + if(option MATCHES "^-D([^:=]*)[:=]") + list(APPEND manually_specified_variables "${CMAKE_MATCH_1}") + endif() + endforeach() + list(REMOVE_DUPLICATES manually_specified_variables) + list(REMOVE_ITEM manually_specified_variables ${arg_MAYBE_UNUSED_VARIABLES}) + debug_message("manually specified variables: ${manually_specified_variables}") + endif() + if(CMAKE_HOST_WIN32) if(DEFINED ENV{PROCESSOR_ARCHITEW6432}) set(arg_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITEW6432}) @@ -326,6 +342,10 @@ function(vcpkg_configure_cmake) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure LOGNAME ${arg_LOGNAME} ) + + list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-err.log") else() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") @@ -335,6 +355,9 @@ function(vcpkg_configure_cmake) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME ${arg_LOGNAME}-dbg ) + list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-dbg-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-dbg-err.log") endif() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") @@ -345,7 +368,44 @@ function(vcpkg_configure_cmake) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME ${arg_LOGNAME}-rel ) + list(APPEND config_logs + "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-rel-out.log" + "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-rel-err.log") + endif() + endif() + + # Check unused variables + set(all_unused_variables) + foreach(config_log IN LISTS config_logs) + if (NOT EXISTS "${config_log}") + continue() + endif() + file(READ "${config_log}" log_contents) + debug_message("Reading configure log ${config_log}...") + if(NOT log_contents MATCHES "Manually-specified variables were not used by the project:\n\n(( [^\n]*\n)*)") + continue() endif() + 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) + if(unused_variable IN_LIST manually_specified_variables) + debug_message("manually specified unused variable: ${unused_variable}") + list(APPEND all_unused_variables "${unused_variable}") + else() + debug_message("unused variable (not manually specified): ${unused_variable}") + endif() + endforeach() + endforeach() + + if(DEFINED all_unused_variables) + list(REMOVE_DUPLICATES all_unused_variables) + list(JOIN all_unused_variables "\n " all_unused_variables) + message(WARNING "The following variables are not used in CMakeLists.txt: + ${all_unused_variables} +Please recheck them and remove the unnecessary options from the `vcpkg_configure_cmake` call. +If these options should still be passed for whatever reason, please use the `MAYBE_UNUSED_VARIABLES` argument.") endif() set(Z_VCPKG_CMAKE_GENERATOR "${GENERATOR}" PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_internal_get_cmake_vars.cmake b/scripts/cmake/vcpkg_internal_get_cmake_vars.cmake index 6c705ae8f8f429..030d74120d88f5 100644 --- a/scripts/cmake/vcpkg_internal_get_cmake_vars.cmake +++ b/scripts/cmake/vcpkg_internal_get_cmake_vars.cmake @@ -53,6 +53,7 @@ function(vcpkg_internal_get_cmake_vars) OPTIONS_RELEASE "-DVCPKG_OUTPUT_FILE:PATH=${CURRENT_BUILDTREES_DIR}/cmake-vars-${TARGET_TRIPLET}-rel.cmake.log" PREFER_NINJA LOGNAME get-cmake-vars-${TARGET_TRIPLET} + Z_VCPKG_IGNORE_UNUSED_VARIABLES ) set(_include_string) diff --git a/versions/baseline.json b/versions/baseline.json index 88a4bcd85a9ef8..591333a43bc32e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6538,7 +6538,7 @@ }, "vcpkg-cmake": { "baseline": "2021-06-25", - "port-version": 4 + "port-version": 5 }, "vcpkg-cmake-config": { "baseline": "2021-05-22", diff --git a/versions/v-/vcpkg-cmake.json b/versions/v-/vcpkg-cmake.json index 96d5eb75da9fca..c632ab855e8929 100644 --- a/versions/v-/vcpkg-cmake.json +++ b/versions/v-/vcpkg-cmake.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "07c3e68ce9ae8f30bcc0b21def7a528dbb8ecb07", + "version-date": "2021-06-25", + "port-version": 5 + }, { "git-tree": "acc25ec22f8fd8887a865705580b1d6de041616d", "version-date": "2021-06-25", From 049ff530bfe5a0242aae210301a207714b53c0b2 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Sun, 18 Jul 2021 20:35:00 -0700 Subject: [PATCH 2/7] [rollup:2021-07-16 2/7] PR #18397 (@strega-nil) [vcpkg_list] add new function --- docs/maintainers/portfile-functions.md | 1 + docs/maintainers/vcpkg_list.md | 94 ++ scripts/buildsystems/vcpkg.cmake | 7 +- scripts/cmake/vcpkg_list.cmake | 257 ++++++ .../cmake/z_vcpkg_function_arguments.cmake | 16 +- scripts/ports.cmake | 1 + .../test_ports/unit-test-cmake/portfile.cmake | 73 ++ .../unit-test-cmake/test-vcpkg_list.cmake | 813 ++++++++++++++++++ .../test-z_vcpkg_function_arguments.cmake | 63 ++ scripts/test_ports/unit-test-cmake/vcpkg.json | 18 + 10 files changed, 1338 insertions(+), 5 deletions(-) create mode 100644 docs/maintainers/vcpkg_list.md create mode 100644 scripts/cmake/vcpkg_list.cmake create mode 100644 scripts/test_ports/unit-test-cmake/portfile.cmake create mode 100644 scripts/test_ports/unit-test-cmake/test-vcpkg_list.cmake create mode 100644 scripts/test_ports/unit-test-cmake/test-z_vcpkg_function_arguments.cmake create mode 100644 scripts/test_ports/unit-test-cmake/vcpkg.json diff --git a/docs/maintainers/portfile-functions.md b/docs/maintainers/portfile-functions.md index d6acc6471db91c..0ba3533e2c6fed 100644 --- a/docs/maintainers/portfile-functions.md +++ b/docs/maintainers/portfile-functions.md @@ -51,6 +51,7 @@ - [vcpkg\_install\_msbuild](vcpkg_install_msbuild.md) - [vcpkg\_install\_nmake](vcpkg_install_nmake.md) - [vcpkg\_install\_qmake](vcpkg_install_qmake.md) +- [vcpkg\_list](vcpkg_list.md) - [vcpkg\_minimum\_required](vcpkg_minimum_required.md) - [vcpkg\_replace\_string](vcpkg_replace_string.md) diff --git a/docs/maintainers/vcpkg_list.md b/docs/maintainers/vcpkg_list.md new file mode 100644 index 00000000000000..46aa7dabd35f7d --- /dev/null +++ b/docs/maintainers/vcpkg_list.md @@ -0,0 +1,94 @@ +# vcpkg_list + +The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_list.md). + +A replacement for CMake's `list()` function, which correctly handles elements +with internal semicolons (in other words, escaped semicolons). +Use `vcpkg_list()` instead of `list()` whenever possible. + +```cmake +vcpkg_list(SET [...]) +vcpkg_list( [...]) +``` + +In addition to all of the commands from `list()`, `vcpkg_list` adds +a `vcpkg_list(SET)` command. +This command takes its arguments, escapes them, and then concatenates +them into a list; this should be used instead of `set()` for setting any +list variable. + +Otherwise, the `vcpkg_list()` function is the same as the built-in +`list()` function, with the following restrictions: + +- `GET`, `REMOVE_ITEM`, and `REMOVE_AT` support only one index/value +- `POP_BACK` and `POP_FRONT` do not support getting the value into + another out variable. Use C++ style `GET` then `POP_(BACK|FRONT)`. +- `FILTER` and `TRANSFORM` are unsupported. + +See the [CMake documentation for `list()`](https://cmake.org/cmake/help/latest/command/list.html) +for more information. + +## Notes: Some Weirdnesses + +The most major weirdness is due to `""` pulling double-duty as "list of zero elements", +and "list of one element, which is empty". `vcpkg_list` always uses the former understanding. +This can cause weird behavior, for example: + +```cmake +set(lst "") +vcpkg_list(APPEND lst "" "") +# lst = ";" +``` + +This is because you're appending two elements to the empty list. +One very weird behavior that comes out of this would be: + +```cmake +set(lst "") +vcpkg_list(APPEND lst "") +# lst = "" +``` + +since `""` is the empty list, we append the empty element and end up with a list +of one element, which is empty. This does not happen for non-empty lists; +for example: + +```cmake +set(lst "a") +vcpkg_list(APPEND lst "") +# lst = "a;" +``` + +only the empty list has this odd behavior. + +## Examples + +### Creating a list + +```cmake +vcpkg_list(SET foo_param) +if(DEFINED arg_FOO) + vcpkg_list(SET foo_param FOO "${arg_FOO}") +endif() +``` + +### Appending to a list + +```cmake +set(OPTIONS -DFOO=BAR) +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_list(APPEND OPTIONS "-DOS=WINDOWS;FOO") +endif() +``` + +### Popping the end off a list + +```cmake +if(NOT list STREQUAL "") + vcpkg_list(GET list end -1) + vcpkg_list(POP_BACK list) +endif() +``` + +## Source +[scripts/cmake/vcpkg\_list.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_list.cmake) diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 8ab2878524e204..ff0873457eff28 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -153,7 +153,7 @@ macro(z_vcpkg_function_arguments OUT_VAR) message(FATAL_ERROR "z_vcpkg_function_arguments: invalid arguments (${ARGV})") endif() - set("${OUT_VAR}") + set("${OUT_VAR}" "") # this allows us to get the value of the enclosing function's ARGC set(z_vcpkg_function_arguments_ARGC_NAME "ARGC") @@ -164,8 +164,11 @@ macro(z_vcpkg_function_arguments OUT_VAR) if(NOT z_vcpkg_function_arguments_LAST_ARG LESS z_vcpkg_function_arguments_FIRST_ARG) foreach(z_vcpkg_function_arguments_N RANGE "${z_vcpkg_function_arguments_FIRST_ARG}" "${z_vcpkg_function_arguments_LAST_ARG}") string(REPLACE ";" "\\;" z_vcpkg_function_arguments_ESCAPED_ARG "${ARGV${z_vcpkg_function_arguments_N}}") - list(APPEND "${OUT_VAR}" "${z_vcpkg_function_arguments_ESCAPED_ARG}") + # adds an extra `;` on the first time through + set("${OUT_VAR}" "${${OUT_VAR}};${z_vcpkg_function_arguments_ESCAPED_ARG}") endforeach() + # remove leading `;` + string(SUBSTRING "${${OUT_VAR}}" 1 -1 "${OUT_VAR}") endif() endmacro() diff --git a/scripts/cmake/vcpkg_list.cmake b/scripts/cmake/vcpkg_list.cmake new file mode 100644 index 00000000000000..74523dc62eb586 --- /dev/null +++ b/scripts/cmake/vcpkg_list.cmake @@ -0,0 +1,257 @@ +#[===[.md: +# vcpkg_list + +A replacement for CMake's `list()` function, which correctly handles elements +with internal semicolons (in other words, escaped semicolons). +Use `vcpkg_list()` instead of `list()` whenever possible. + +```cmake +vcpkg_list(SET [...]) +vcpkg_list( [...]) +``` + +In addition to all of the commands from `list()`, `vcpkg_list` adds +a `vcpkg_list(SET)` command. +This command takes its arguments, escapes them, and then concatenates +them into a list; this should be used instead of `set()` for setting any +list variable. + +Otherwise, the `vcpkg_list()` function is the same as the built-in +`list()` function, with the following restrictions: + +- `GET`, `REMOVE_ITEM`, and `REMOVE_AT` support only one index/value +- `POP_BACK` and `POP_FRONT` do not support getting the value into + another out variable. Use C++ style `GET` then `POP_(BACK|FRONT)`. +- `FILTER` and `TRANSFORM` are unsupported. + +See the [CMake documentation for `list()`](https://cmake.org/cmake/help/latest/command/list.html) +for more information. + +## Notes: Some Weirdnesses + +The most major weirdness is due to `""` pulling double-duty as "list of zero elements", +and "list of one element, which is empty". `vcpkg_list` always uses the former understanding. +This can cause weird behavior, for example: + +```cmake +set(lst "") +vcpkg_list(APPEND lst "" "") +# lst = ";" +``` + +This is because you're appending two elements to the empty list. +One very weird behavior that comes out of this would be: + +```cmake +set(lst "") +vcpkg_list(APPEND lst "") +# lst = "" +``` + +since `""` is the empty list, we append the empty element and end up with a list +of one element, which is empty. This does not happen for non-empty lists; +for example: + +```cmake +set(lst "a") +vcpkg_list(APPEND lst "") +# lst = "a;" +``` + +only the empty list has this odd behavior. + +## Examples + +### Creating a list + +```cmake +vcpkg_list(SET foo_param) +if(DEFINED arg_FOO) + vcpkg_list(SET foo_param FOO "${arg_FOO}") +endif() +``` + +### Appending to a list + +```cmake +set(OPTIONS -DFOO=BAR) +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_list(APPEND OPTIONS "-DOS=WINDOWS;FOO") +endif() +``` + +### Popping the end off a list + +```cmake +if(NOT list STREQUAL "") + vcpkg_list(GET list end -1) + vcpkg_list(POP_BACK list) +endif() +``` +#]===] + +macro(z_vcpkg_list_escape_once_more lst) + string(REPLACE [[\;]] [[\\;]] "${lst}" "${${lst}}") +endmacro() + +function(vcpkg_list) + # NOTE: as this function replaces an existing CMake command, + # it does not use cmake_parse_arguments + + # vcpkg_list( ...) + # A0 A1 + + if(ARGC LESS "2") + message(FATAL_ERROR "vcpkg_list requires at least two arguments.") + endif() + + if(ARGV1 MATCHES "^ARGV([0-9]*)$|^ARG[CN]$|^CMAKE_CURRENT_FUNCTION") + message(FATAL_ERROR "vcpkg_list does not support the list_var being ${ARGV1}. + Please use a different variable name.") + endif() + + set(list "${${ARGV1}}") + set(operation "${ARGV0}") + set(list_var "${ARGV1}") + + if(operation STREQUAL "SET") + z_vcpkg_function_arguments(args 2) + set("${list_var}" "${args}" PARENT_SCOPE) + return() + endif() + + # Normal reading functions + if(operation STREQUAL "LENGTH") + # vcpkg_list(LENGTH ) + # A0 A1 A2 + if(NOT ARGC EQUAL "3") + message(FATAL_ERROR "vcpkg_list sub-command ${operation} requires two arguments.") + endif() + list(LENGTH list out) + set("${ARGV2}" "${out}" PARENT_SCOPE) + return() + endif() + if(operation MATCHES "^(GET|JOIN|FIND)$") + # vcpkg_list( ) + # A0 A1 A2 A3 + if(NOT ARGC EQUAL "4") + message(FATAL_ERROR "vcpkg_list sub-command ${operation} requires three arguments.") + endif() + if(operation STREQUAL "GET") + list(LENGTH list length) + if(length EQUAL "0") + message(FATAL_ERROR "vcpkg_list GET given empty list") + elseif(ARGV2 GREATER_EQUAL length OR ARGV2 LESS "-${length}") + message(FATAL_ERROR "vcpkg_list index: ${ARGV2} is not in range") + endif() + endif() + list("${operation}" list "${ARGV2}" out) + set("${ARGV3}" "${out}" PARENT_SCOPE) + return() + endif() + if(operation STREQUAL "SUBLIST") + # vcpkg_list(SUBLIST ) + # A0 A1 A2 A3 A4 + if(NOT ARGC EQUAL "5") + message(FATAL_ERROR "vcpkg_list sub-command SUBLIST requires four arguments.") + endif() + list(LENGTH list length) + if(ARGV2 LESS "0" OR (ARGV2 GREATER_EQUAL length AND NOT ARGV2 EQUAL "0")) + message(FATAL_ERROR "vcpkg_list begin index: ${ARGV2} is out of range") + endif() + z_vcpkg_list_escape_once_more(list) + list(SUBLIST list "${ARGV2}" "${ARGV3}" out) + set("${ARGV4}" "${out}" PARENT_SCOPE) + return() + endif() + + # modification functions + + if(operation MATCHES "^(APPEND|PREPEND)$") + # vcpkg_list( [...]) + # A0 A1 A2... + + # if ARGC <= 2, then we don't have to do anything + if(ARGC GREATER 2) + z_vcpkg_function_arguments(args 2) + if(list STREQUAL "") + set("${list_var}" "${args}" PARENT_SCOPE) + elseif(operation STREQUAL "APPEND") + set("${list_var}" "${list};${args}" PARENT_SCOPE) + else() + set("${list_var}" "${args};${list}" PARENT_SCOPE) + endif() + endif() + return() + endif() + if(operation STREQUAL "INSERT") + # vcpkg_list(INSERT [...]) + # A0 A1 A2 A3... + + list(LENGTH list length) + if(ARGV2 LESS "-{$length}" OR ARGV2 GREATER length) + message(FATAL_ERROR "vcpkg_list index: ${ARGV2} out of range") + endif() + if(ARGC GREATER 3) + # list(LENGTH) is one of the few subcommands that's fine + list(LENGTH list length) + if(ARGV2 LESS "0") + math(EXPR ARGV2 "${length} + ${ARGV2}") + endif() + if(ARGV2 LESS "0" OR ARGV2 GREATER length) + message(FATAL_ERROR "list index: ${ARGV2} out of range (-${length}, ${length})") + endif() + + z_vcpkg_function_arguments(args 3) + if(list STREQUAL "") + set("${list_var}" "${args}" PARENT_SCOPE) + elseif(ARGV2 EQUAL "0") + set("${list_var}" "${args};${list}" PARENT_SCOPE) + elseif(ARGV2 EQUAL length) + set("${list_var}" "${list};${args}" PARENT_SCOPE) + else() + vcpkg_list(SUBLIST list 0 "${ARGV2}" list_start) + vcpkg_list(SUBLIST list "${ARGV2}" -1 list_end) + set("${list_var}" "${list_start};${args};${list_end}" PARENT_SCOPE) + endif() + elseif(ARGC LESS 3) + message(FATAL_ERROR "vcpkg_list sub-command INSERT requires at least two arguments.") + endif() + return() + endif() + + if(operation MATCHES "^(POP_BACK|POP_FRONT|REVERSE|REMOVE_DUPLICATES)$") + # vcpkg_list( ) + # A0 A1 + if(NOT ARGC EQUAL 2) + message(FATAL_ERROR "vcpkg_list sub-command ${operation} requires one argument.") + endif() + z_vcpkg_list_escape_once_more(list) + list("${operation}" list) + set("${list_var}" "${list}" PARENT_SCOPE) + return() + endif() + + if(operation MATCHES "^(REMOVE_AT|REMOVE_ITEM)$") + # vcpkg_list( ) + # A0 A1 A2 + if(NOT ARGC EQUAL 3) + message(FATAL_ERROR "vcpkg_list sub-command ${operation} requires two arguments.") + endif() + if(operation STREQUAL "REMOVE_AT") + list(LENGTH list length) + if(ARGV2 GREATER_EQUAL length OR ARGV2 LESS "-${length}") + message(FATAL_ERROR "vcpkg_list index: ${ARGV2} out of range") + endif() + endif() + + z_vcpkg_list_escape_once_more(list) + string(REPLACE [[;]] [[\;]] ARGV2 "${ARGV2}") + + list("${operation}" list "${ARGV2}") + set("${list_var}" "${list}" PARENT_SCOPE) + return() + endif() + + message(FATAL_ERROR "vcpkg_list sub-command ${operation} is not yet implemented.") +endfunction() diff --git a/scripts/cmake/z_vcpkg_function_arguments.cmake b/scripts/cmake/z_vcpkg_function_arguments.cmake index 2c5b694ed1b780..043c861910f6c3 100644 --- a/scripts/cmake/z_vcpkg_function_arguments.cmake +++ b/scripts/cmake/z_vcpkg_function_arguments.cmake @@ -32,22 +32,32 @@ macro(z_vcpkg_function_arguments OUT_VAR) set(z_vcpkg_function_arguments_FIRST_ARG 0) elseif("${ARGC}" EQUAL 2) set(z_vcpkg_function_arguments_FIRST_ARG "${ARGV1}") + + if(NOT z_vcpkg_function_arguments_FIRST_ARG GREATER_EQUAL "0" AND NOT z_vcpkg_function_arguments_FIRST_ARG LESS "0") + message(FATAL_ERROR "z_vcpkg_function_arguments: index (${z_vcpkg_function_arguments_FIRST_ARG}) is not a number") + elseif(z_vcpkg_function_arguments_FIRST_ARG LESS "0" OR z_vcpkg_function_arguments_FIRST_ARG GREATER ARGC) + message(FATAL_ERROR "z_vcpkg_function_arguments: index (${z_vcpkg_function_arguments_FIRST_ARG}) out of range") + endif() else() # vcpkg bug message(FATAL_ERROR "z_vcpkg_function_arguments: invalid arguments (${ARGV})") endif() - set("${OUT_VAR}") + set("${OUT_VAR}" "") # this allows us to get the value of the enclosing function's ARGC set(z_vcpkg_function_arguments_ARGC_NAME "ARGC") set(z_vcpkg_function_arguments_ARGC "${${z_vcpkg_function_arguments_ARGC_NAME}}") math(EXPR z_vcpkg_function_arguments_LAST_ARG "${z_vcpkg_function_arguments_ARGC} - 1") - if(z_vcpkg_function_arguments_LAST_ARG GREATER_EQUAL z_vcpkg_function_arguments_FIRST_ARG) + # GREATER_EQUAL added in CMake 3.7 + if(NOT z_vcpkg_function_arguments_LAST_ARG LESS z_vcpkg_function_arguments_FIRST_ARG) foreach(z_vcpkg_function_arguments_N RANGE "${z_vcpkg_function_arguments_FIRST_ARG}" "${z_vcpkg_function_arguments_LAST_ARG}") string(REPLACE ";" "\\;" z_vcpkg_function_arguments_ESCAPED_ARG "${ARGV${z_vcpkg_function_arguments_N}}") - list(APPEND "${OUT_VAR}" "${z_vcpkg_function_arguments_ESCAPED_ARG}") + # adds an extra ";" on the front + set("${OUT_VAR}" "${${OUT_VAR}};${z_vcpkg_function_arguments_ESCAPED_ARG}") endforeach() + # and then removes that extra semicolon + string(SUBSTRING "${${OUT_VAR}}" 1 -1 "${OUT_VAR}") endif() endmacro() diff --git a/scripts/ports.cmake b/scripts/ports.cmake index ce6fc557b775a1..98a6e23520a9b0 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -130,6 +130,7 @@ if(CMD MATCHES "^BUILD$") include("${SCRIPTS}/cmake/vcpkg_install_nmake.cmake") include("${SCRIPTS}/cmake/vcpkg_install_qmake.cmake") include("${SCRIPTS}/cmake/vcpkg_internal_get_cmake_vars.cmake") + include("${SCRIPTS}/cmake/vcpkg_list.cmake") include("${SCRIPTS}/cmake/vcpkg_replace_string.cmake") include("${SCRIPTS}/cmake/vcpkg_test_cmake.cmake") diff --git a/scripts/test_ports/unit-test-cmake/portfile.cmake b/scripts/test_ports/unit-test-cmake/portfile.cmake new file mode 100644 index 00000000000000..638b15974c2e40 --- /dev/null +++ b/scripts/test_ports/unit-test-cmake/portfile.cmake @@ -0,0 +1,73 @@ +function(set_fatal_error) + if(ARGC EQUAL 0) + set(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR "OFF" CACHE BOOL "" FORCE) + else() + set(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR "ON" CACHE BOOL "" FORCE) + set(Z_VCPKG_UNIT_TEST_FATAL_ERROR "${ARGV0}" CACHE STRING "" FORCE) + endif() +endfunction() +function(set_has_error) + set(Z_VCPKG_UNIT_TEST_HAS_ERROR ON CACHE BOOL "" FORCE) +endfunction() + +macro(message level msg) + if("${level}" STREQUAL "FATAL_ERROR") + set_fatal_error("${msg}") + return() + else() + _message("${level}" "${msg}") # note: this results in incorrect printing, but that's fine + # message(STATUS "\${asdf}") will result in + # message(STATUS "${asdf}"), since that's how macro arguments work. + endif() +endmacro() + +set(Z_VCPKG_UNIT_TEST_HAS_ERROR OFF CACHE BOOL "" FORCE) +set_fatal_error() + +function(unit_test_check_variable_equal utcve_test utcve_variable utcve_value) + cmake_language(EVAL CODE "${utcve_test}") + if(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + set_fatal_error() + set_has_error() + message(STATUS "${utcve_test} had an unexpected FATAL_ERROR; + expected: \"${utcve_value}\"") + message(STATUS "FATAL_ERROR: ${Z_VCPKG_UNIT_TEST_FATAL_ERROR}") + return() + endif() + + if(NOT DEFINED "${utcve_variable}") + message(STATUS "${utcve_test} failed to set ${utcve_variable}; + expected: \"${utcve_value}\"") + set_has_error() + return() + endif() + if(NOT "${${utcve_variable}}" STREQUAL "${utcve_value}") + message(STATUS "${utcve_test} resulted in the wrong value for ${utcve_variable}; + expected: \"${utcve_value}\" + actual : \"${${utcve_variable}}\"") + set_has_error() + return() + endif() +endfunction() + +function(unit_test_ensure_fatal_error utcve_test) + cmake_language(EVAL CODE "${utcve_test}") + if(NOT Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + set_has_error() + message(STATUS "${utcve_test} was expected to be a FATAL_ERROR.") + endif() + set_fatal_error() +endfunction() + +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +if("list" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg_list.cmake") +endif() +if("function-arguments" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_function_arguments.cmake") +endif() + +if(Z_VCPKG_UNIT_TEST_HAS_ERROR) + _message(FATAL_ERROR "At least one test failed") +endif() diff --git a/scripts/test_ports/unit-test-cmake/test-vcpkg_list.cmake b/scripts/test_ports/unit-test-cmake/test-vcpkg_list.cmake new file mode 100644 index 00000000000000..c0f3ac8c07ecbd --- /dev/null +++ b/scripts/test_ports/unit-test-cmake/test-vcpkg_list.cmake @@ -0,0 +1,813 @@ +# vcpkg_list(SET ...) +unit_test_check_variable_equal( + [[vcpkg_list(SET lst)]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(SET lst "")]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(SET lst "" "")]] + lst ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(SET lst a)]] + lst "a" +) +unit_test_check_variable_equal( + [[vcpkg_list(SET lst a b)]] + lst "a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(SET lst "a;b")]] + lst [[a\;b]] +) +unit_test_check_variable_equal( + [=[vcpkg_list(SET lst "a;b" "c" [[d\;e]])]=] + lst [[a\;b;c;d\\;e]] +) + +# vcpkg_list(LENGTH ) +set(lst [[]]) +unit_test_check_variable_equal( + [[vcpkg_list(LENGTH lst out)]] + out 0 +) +set(lst [[;]]) +unit_test_check_variable_equal( + [[vcpkg_list(LENGTH lst out)]] + out 2 +) +set(lst [[a]]) +unit_test_check_variable_equal( + [[vcpkg_list(LENGTH lst out)]] + out 1 +) +set(lst [[a;b]]) +unit_test_check_variable_equal( + [[vcpkg_list(LENGTH lst out)]] + out 2 +) +set(lst [[a\\;b]]) +unit_test_check_variable_equal( + [[vcpkg_list(LENGTH lst out)]] + out 1 +) +set(lst [[a\;b;c\\;d]]) +unit_test_check_variable_equal( + [[vcpkg_list(LENGTH lst out)]] + out 2 +) + +# vcpkg_list(GET ) +set(lst "") +unit_test_ensure_fatal_error([[vcpkg_list(GET lst 0 out)]]) + +set(lst "a") +unit_test_check_variable_equal( + [[vcpkg_list(GET lst 0 out)]] + out "a" +) +unit_test_check_variable_equal( + [[vcpkg_list(GET lst -1 out)]] + out "a" +) +unit_test_ensure_fatal_error([[vcpkg_list(GET lst 2 out)]]) +unit_test_ensure_fatal_error([[vcpkg_list(GET lst -2 out)]]) + +set(lst ";b") +unit_test_check_variable_equal( + [[vcpkg_list(GET lst 0 out)]] + out "" +) +unit_test_check_variable_equal( + [[vcpkg_list(GET lst -1 out)]] + out "b" +) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(GET lst 0 out)]] + out "a" +) +unit_test_check_variable_equal( + [[vcpkg_list(GET lst -1 out)]] + out "b" +) + +set(lst [[a\;b;c]]) +unit_test_check_variable_equal( + [[vcpkg_list(GET lst 0 out)]] + out "a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(GET lst -1 out)]] + out "c" +) + +set(lst [[a;b\;c;d\\;e]]) +unit_test_check_variable_equal( + [[vcpkg_list(GET lst 1 out)]] + out "b;c" +) +unit_test_check_variable_equal( + [[vcpkg_list(GET lst -1 out)]] + out [[d\;e]] +) + +# vcpkg_list(JOIN ) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(JOIN lst "-" out)]] + out "" +) + +set(lst "a") +unit_test_check_variable_equal( + [[vcpkg_list(JOIN lst "-" out)]] + out "a" +) + +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(JOIN lst "-" out)]] + out "-" +) + +set(lst [[a;b]]) +unit_test_check_variable_equal( + [[vcpkg_list(JOIN lst "-" out)]] + out [[a-b]] +) +unit_test_check_variable_equal( + [[vcpkg_list(JOIN lst "+" out)]] + out [[a+b]] +) + +set(lst [[a;b\;c\\;d]]) +unit_test_check_variable_equal( + [[vcpkg_list(JOIN lst "-" out)]] + out [[a-b;c\;d]] +) + +# vcpkg_list(SUBLIST ) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 0 0 out)]] + out "" +) +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 0 1 out)]] + out "" +) +unit_test_ensure_fatal_error([[vcpkg_list(SUBLIST lst 1 0 out)]]) + +set(lst "a") +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 0 0 out)]] + out "" +) +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 0 1 out)]] + out "a" +) +unit_test_ensure_fatal_error([[vcpkg_list(SUBLIST lst 2 0 out)]]) +unit_test_ensure_fatal_error([[vcpkg_list(SUBLIST lst 2 1 out)]]) + +set(lst ";;") +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 0 0 out)]] + out "" +) +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 0 1 out)]] + out "" +) +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 0 2 out)]] + out ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 0 3 out)]] + out ";;" +) + +set(lst "a;b;c;d") +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 1 2 out)]] + out "b;c" +) + +set(lst [[a\;b;c\;d;e]]) +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 1 2 out)]] + out [[c\;d;e]] +) + +set(lst [[a\;b;c\\;d;e;f;g;h]]) +unit_test_check_variable_equal( + [[vcpkg_list(SUBLIST lst 1 -1 out)]] + out [[c\\;d;e;f;g;h]] +) + +# vcpkg_list(FIND ) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst "a" out)]] + out -1 +) + +set(lst "b") +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst "a" out)]] + out -1 +) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst "a" out)]] + out 0 +) +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst b out)]] + out 1 +) + +set(lst ";b") +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst "" out)]] + out 0 +) +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst b out)]] + out 1 +) + +set(lst [[a\;b;c]]) +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst "a;b" out)]] + out 0 +) +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst c out)]] + out 1 +) +unit_test_check_variable_equal( + [[vcpkg_list(FIND lst a out)]] + out -1 +) + +set(lst [[a\\;b;c]]) +unit_test_check_variable_equal( + [=[vcpkg_list(FIND lst [[a\;b]] out)]=] + out 0 +) + +# vcpkg_list(APPEND [...]) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst)]] + lst [[]] +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst "")]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst "" "")]] + lst ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst a)]] + lst "a" +) + +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst)]] + lst ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst "")]] + lst ";;" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst b)]] + lst ";;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst "b;c" d)]] + lst [[;;b\;c;d]] +) + +set(lst "a") +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst)]] + lst "a" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst "")]] + lst "a;" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst b)]] + lst "a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst "b;c" d)]] + lst [[a;b\;c;d]] +) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst)]] + lst "a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst "")]] + lst "a;b;" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst c)]] + lst "a;b;c" +) +unit_test_check_variable_equal( + [[vcpkg_list(APPEND lst "c;d" e)]] + lst [[a;b;c\;d;e]] +) +unit_test_check_variable_equal( + [=[vcpkg_list(APPEND lst [[c\;d]])]=] + lst [[a;b;c\\;d]] +) + +# vcpkg_list(PREPEND [...]) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst)]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst "")]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst "" "")]] + lst ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst a)]] + lst "a" +) + +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst)]] + lst ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst "")]] + lst ";;" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst b)]] + lst "b;;" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst "b;c" d)]] + lst [[b\;c;d;;]] +) + +set(lst "a") +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst)]] + lst "a" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst "")]] + lst ";a" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst b)]] + lst "b;a" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst "b;c" d)]] + lst [[b\;c;d;a]] +) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst)]] + lst "a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst "")]] + lst ";a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst c)]] + lst "c;a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(PREPEND lst "c;d" e)]] + lst [[c\;d;e;a;b]] +) +unit_test_check_variable_equal( + [=[vcpkg_list(PREPEND lst [[c\;d]])]=] + lst [[c\\;d;a;b]] +) + +# list(INSERT [...]) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 0)]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 0 "")]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 0 "" "")]] + lst ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 0 "a")]] + lst "a" +) +unit_test_ensure_fatal_error([[vcpkg_list(INSERT lst 1 "")]]) +unit_test_ensure_fatal_error([[vcpkg_list(INSERT lst -1 "")]]) + +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 0)]] + lst ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 1)]] + lst ";" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 1 "")]] + lst ";;" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 0 b)]] + lst "b;;" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 1 b)]] + lst ";b;" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 2 b)]] + lst ";;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst -1 "b;c" d)]] + lst [[;b\;c;d;]] +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst -2 "b;c" d)]] + lst [[b\;c;d;;]] +) +unit_test_ensure_fatal_error([[vcpkg_list(INSERT lst 3 "")]]) +unit_test_ensure_fatal_error([[vcpkg_list(INSERT lst -3 "")]]) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst -1 c)]] + lst "a;c;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 1 c)]] + lst "a;c;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 2 c)]] + lst "a;b;c" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst -2 c)]] + lst "c;a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(INSERT lst 1 "c;d")]] + lst [[a;c\;d;b]] +) +unit_test_check_variable_equal( + [=[vcpkg_list(INSERT lst 1 [[c\;d]] e)]=] + lst [[a;c\\;d;e;b]] +) + +# vcpkg_list(POP_BACK ) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(POP_BACK lst)]] + lst "" +) + +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(POP_BACK lst)]] + lst "" +) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(POP_BACK lst)]] + lst "a" +) + +set(lst "a;;b") +unit_test_check_variable_equal( + [[vcpkg_list(POP_BACK lst)]] + lst "a;" +) + +set(lst [[a\;b]]) +unit_test_check_variable_equal( + [[vcpkg_list(POP_BACK lst)]] + lst "" +) + +set(lst [[c;a\;b;c]]) +unit_test_check_variable_equal( + [[vcpkg_list(POP_BACK lst)]] + lst [[c;a\;b]] +) + +# vcpkg_list(POP_FRONT ) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(POP_BACK lst)]] + lst "" +) + +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(POP_FRONT lst)]] + lst "" +) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(POP_FRONT lst)]] + lst "b" +) + +set(lst "a;;b") +unit_test_check_variable_equal( + [[vcpkg_list(POP_FRONT lst)]] + lst ";b" +) + +set(lst [[a\;b]]) +unit_test_check_variable_equal( + [[vcpkg_list(POP_FRONT lst)]] + lst "" +) + +set(lst [[c;a\;b;c]]) +unit_test_check_variable_equal( + [[vcpkg_list(POP_FRONT lst)]] + lst [[a\;b;c]] +) + +# vcpkg_list(REMOVE_DUPLICATES ) +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_DUPLICATES lst)]] + lst "" +) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_DUPLICATES lst)]] + lst "a;b" +) + +set(lst "a;a;b") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_DUPLICATES lst)]] + lst "a;b" +) + +set(lst "a;b;a") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_DUPLICATES lst)]] + lst "a;b" +) + +set(lst "c;a;b;a;c") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_DUPLICATES lst)]] + lst "c;a;b" +) + +set(lst "a;;b") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_DUPLICATES lst)]] + lst "a;;b" +) + +set(lst [[a\;b;a\;b]]) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_DUPLICATES lst)]] + lst [[a\;b]] +) + +set(lst [[c;a\;b;c]]) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_DUPLICATES lst)]] + lst [[c;a\;b]] +) + +# vcpkg_list(REVERSE ) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(REVERSE lst)]] + lst "" +) +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(REVERSE lst)]] + lst ";" +) +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(REVERSE lst)]] + lst "b;a" +) +set(lst "a;b;c;d;e;f;g") +unit_test_check_variable_equal( + [[vcpkg_list(REVERSE lst)]] + lst "g;f;e;d;c;b;a" +) + +set(lst [[a\;b;a\;b\\;c]]) +unit_test_check_variable_equal( + [[vcpkg_list(REVERSE lst)]] + lst [[a\;b\\;c;a\;b]] +) +set(lst [[c;a\;b]]) +unit_test_check_variable_equal( + [[vcpkg_list(REVERSE lst)]] + lst [[a\;b;c]] +) + +# vcpkg_list(REMOVE_ITEM ) +set(lst "") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst "a")]] + lst "" +) + +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst "")]] + lst "" +) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst a)]] + lst "b" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst b)]] + lst "a" +) + +set(lst "a;a;b") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst a)]] + lst "b" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst b)]] + lst "a;a" +) + +set(lst "a;b;c;a;d") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst b)]] + lst "a;c;a;d" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst a)]] + lst "b;c;d" +) + +set(lst "a;;b") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst "")]] + lst "a;b" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst a)]] + lst ";b" +) + +set(lst [[e;a\;b;c\;d]]) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst "a;b")]] + lst [[e;c\;d]] +) + +set(lst [[c;a\;b;c]]) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst "c")]] + lst [[a\;b]] +) + +set(lst [[c;a\\;b;c]]) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_ITEM lst "a\\;b")]] + lst [[c;c]] +) + +# vcpkg_list(REMOVE_AT ) +set(lst "") +unit_test_ensure_fatal_error([[vcpkg_list(REMOVE_AT lst 0)]]) + +set(lst ";") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 0)]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 1)]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst -1)]] + lst "" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst -2)]] + lst "" +) +unit_test_ensure_fatal_error([[vcpkg_list(REMOVE_AT lst 2)]]) +unit_test_ensure_fatal_error([[vcpkg_list(REMOVE_AT lst -3)]]) + +set(lst "a;b") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 0)]] + lst "b" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 1)]] + lst "a" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst -1)]] + lst "a" +) + +set(lst "a;;b") +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 0)]] + lst ";b" +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 1)]] + lst "a;b" +) + +set(lst [[e;a\;b;c\;d]]) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 0)]] + lst [[a\;b;c\;d]] +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 1)]] + lst [[e;c\;d]] +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst -1)]] + lst [[e;a\;b]] +) + +set(lst [[c;a\\;b;c\;d;e]]) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 0)]] + lst [[a\\;b;c\;d;e]] +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 1)]] + lst [[c;c\;d;e]] +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 2)]] + lst [[c;a\\;b;e]] +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst 3)]] + lst [[c;a\\;b;c\;d]] +) +unit_test_check_variable_equal( + [[vcpkg_list(REMOVE_AT lst -1)]] + lst [[c;a\\;b;c\;d]] +) diff --git a/scripts/test_ports/unit-test-cmake/test-z_vcpkg_function_arguments.cmake b/scripts/test_ports/unit-test-cmake/test-z_vcpkg_function_arguments.cmake new file mode 100644 index 00000000000000..e88eb683f9b497 --- /dev/null +++ b/scripts/test_ports/unit-test-cmake/test-z_vcpkg_function_arguments.cmake @@ -0,0 +1,63 @@ +# these both set `args` in the top level +function(check_function_args start) + z_vcpkg_function_arguments(out "${start}") + set(args "${out}" PARENT_SCOPE) +endfunction() +function(check_all_function_args) + z_vcpkg_function_arguments(out) + set(args "${out}" PARENT_SCOPE) +endfunction() + +unit_test_ensure_fatal_error([[check_function_args(-1)]]) +unit_test_ensure_fatal_error([[check_function_args(3)]]) +unit_test_ensure_fatal_error([[check_function_args(notanumber)]]) +unit_test_check_variable_equal( + [[check_all_function_args()]] + args "" +) +unit_test_check_variable_equal( + [[check_all_function_args("")]] + args "" +) +unit_test_check_variable_equal( + [[check_all_function_args("" "")]] + args ";" +) +unit_test_check_variable_equal( + [[check_all_function_args("" "" "" "")]] + args ";;;" +) + +unit_test_check_variable_equal( + [[check_all_function_args(a b c)]] + args "a;b;c" +) +unit_test_check_variable_equal( + [[check_function_args(2 a b c)]] + args "b;c" +) +unit_test_check_variable_equal( + [[check_function_args(3 a b c)]] + args "c" +) + +unit_test_check_variable_equal( + [=[check_all_function_args("a;b" [[c\;d]] e)]=] + args [[a\;b;c\\;d;e]] +) +unit_test_check_variable_equal( + [=[check_all_function_args("a;b" [[c\;d]] [[e\\;f]])]=] + args [[a\;b;c\\;d;e\\\;f]] +) +unit_test_check_variable_equal( + [=[check_function_args(2 "a;b" [[c\;d]] e)]=] + args [[c\\;d;e]] +) +unit_test_check_variable_equal( + [=[check_function_args(3 "a;b" [[c\;d]] e)]=] + args "e" +) +unit_test_check_variable_equal( + [=[check_function_args(4 "a;b" [[c\;d]] e)]=] + args "" +) diff --git a/scripts/test_ports/unit-test-cmake/vcpkg.json b/scripts/test_ports/unit-test-cmake/vcpkg.json new file mode 100644 index 00000000000000..5079f9e739b5fc --- /dev/null +++ b/scripts/test_ports/unit-test-cmake/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "unit-test-cmake", + "version-string": "0", + "description": "Ensures that the CMake scripts are unit tested.", + "supports": "x64", + "default-features": [ + "function-arguments", + "list" + ], + "features": { + "function-arguments": { + "description": "Test the z_vcpkg_function_arguments function" + }, + "list": { + "description": "Test the vcpkg_list function" + } + } +} From 75770f10d49d4a590b1d7b40cfdd4b623b5d3e1c Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Sun, 18 Jul 2021 20:35:33 -0700 Subject: [PATCH 3/7] [rollup:2021-07-16 3/7] PR #18782 (@strega-nil) [scripts-audit] vcpkg_build_ninja --- scripts/cmake/vcpkg_build_ninja.cmake | 33 ++++++++++++++++----------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/scripts/cmake/vcpkg_build_ninja.cmake b/scripts/cmake/vcpkg_build_ninja.cmake index 2c9276e63d5a8a..5a0a1755fa8c2a 100644 --- a/scripts/cmake/vcpkg_build_ninja.cmake +++ b/scripts/cmake/vcpkg_build_ninja.cmake @@ -15,26 +15,33 @@ vcpkg_build_ninja( Only build the specified targets. #]===] +function(z_vcpkg_build_ninja_build config targets) + message(STATUS "Building (${config})...") + vcpkg_execute_build_process( + COMMAND "${NINJA}" -C "${CURRENT_BUILDTREES_DIR}/${config}" ${targets} + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "build-${config}" + ) +endfunction() + + function(vcpkg_build_ninja) - # parse parameters such that semicolons in options arguments to COMMAND don't get erased - cmake_parse_arguments(PARSE_ARGV 0 _vbn "" "" "TARGETS") + cmake_parse_arguments(PARSE_ARGV 0 arg "" "" "TARGETS") - vcpkg_find_acquire_program(NINJA) + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") + endif() + if(NOT DEFINED arg_TARGETS) + set(arg_TARGETS "") + endif() - function(build CONFIG) - message(STATUS "Building (${CONFIG})...") - vcpkg_execute_build_process( - COMMAND "${NINJA}" -C "${CURRENT_BUILDTREES_DIR}/${CONFIG}" ${_vbn_TARGETS} - WORKING_DIRECTORY "${SOURCE_PATH}" - LOGNAME build-${CONFIG} - ) - endfunction() + vcpkg_find_acquire_program(NINJA) if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - build(${TARGET_TRIPLET}-dbg) + z_vcpkg_build_ninja_build("${TARGET_TRIPLET}-dbg" "${arg_TARGETS}") endif() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - build(${TARGET_TRIPLET}-rel) + z_vcpkg_build_ninja_build("${TARGET_TRIPLET}-rel" "${arg_TARGETS}") endif() endfunction() From 614063e5bb896d1e5aab64b59e7a0f1b5f4086c9 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Sun, 18 Jul 2021 20:36:04 -0700 Subject: [PATCH 4/7] [rollup:2021-07-16 4/7] PR #18784 (@strega-nil) [scripts-audit] vcpkg_minimum_required --- scripts/cmake/vcpkg_minimum_required.cmake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/cmake/vcpkg_minimum_required.cmake b/scripts/cmake/vcpkg_minimum_required.cmake index 202935b8902914..44777875e1a1e1 100644 --- a/scripts/cmake/vcpkg_minimum_required.cmake +++ b/scripts/cmake/vcpkg_minimum_required.cmake @@ -14,7 +14,7 @@ The date-version to check against. #]===] function(vcpkg_minimum_required) - cmake_parse_arguments(PARSE_ARGV 0 _vcpkg "" "VERSION" "") + cmake_parse_arguments(PARSE_ARGV 0 arg "" "VERSION" "") if (NOT DEFINED VCPKG_BASE_VERSION) message(FATAL_ERROR "Your vcpkg executable is outdated and is not compatible with the current CMake scripts. " @@ -22,27 +22,27 @@ function(vcpkg_minimum_required) ) endif() - set(_vcpkg_date_regex "^[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]$") - if (NOT VCPKG_BASE_VERSION MATCHES "${_vcpkg_date_regex}") + set(vcpkg_date_regex "^[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]$") + if (NOT VCPKG_BASE_VERSION MATCHES "${vcpkg_date_regex}") message(FATAL_ERROR - "vcpkg internal failure; \${VCPKG_BASE_VERSION} (${VCPKG_BASE_VERSION}) was not a valid date." + "vcpkg internal failure; VCPKG_BASE_VERSION (${VCPKG_BASE_VERSION}) was not a valid date." ) endif() - if (NOT _vcpkg_VERSION MATCHES "${_vcpkg_date_regex}") + if (NOT arg_VERSION MATCHES "${vcpkg_date_regex}") message(FATAL_ERROR "VERSION parameter to vcpkg_minimum_required was not a valid date. " - "Comparing with vcpkg tool version ${_vcpkg_matched_base_version}" + "Comparing with vcpkg tool version ${VCPKG_BASE_VERSION}" ) endif() - string(REPLACE "-" "." _VCPKG_BASE_VERSION_as_dotted "${VCPKG_BASE_VERSION}") - string(REPLACE "-" "." _vcpkg_VERSION_as_dotted "${_vcpkg_VERSION}") + string(REPLACE "-" "." VCPKG_BASE_VERSION_as_dotted "${VCPKG_BASE_VERSION}") + string(REPLACE "-" "." arg_VERSION_as_dotted "${arg_VERSION}") - if (_VCPKG_BASE_VERSION_as_dotted VERSION_LESS _vcpkg_VERSION_as_dotted) + if (VCPKG_BASE_VERSION_as_dotted VERSION_LESS vcpkg_VERSION_as_dotted) message(FATAL_ERROR "Your vcpkg executable is from ${VCPKG_BASE_VERSION} which is older than required by the caller " - "of vcpkg_minimum_required (${_vcpkg_VERSION}). " + "of vcpkg_minimum_required(VERSION ${arg_VERSION}). " "Please re-acquire vcpkg by running bootstrap-vcpkg." ) endif() From a37b635cb570938ec7058f3856c2a05a68aa96a7 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Sun, 18 Jul 2021 20:36:27 -0700 Subject: [PATCH 5/7] [rollup:2021-07-16 5/7] PR #18785 (@strega-nil) [scripts-audit] vcpkg_replace_string --- docs/maintainers/vcpkg_replace_string.md | 3 +-- scripts/cmake/vcpkg_replace_string.cmake | 11 +++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/maintainers/vcpkg_replace_string.md b/docs/maintainers/vcpkg_replace_string.md index 179b8a08d7ab31..967dd3c01a6137 100644 --- a/docs/maintainers/vcpkg_replace_string.md +++ b/docs/maintainers/vcpkg_replace_string.md @@ -5,9 +5,8 @@ The latest version of this document lives in the [vcpkg repo](https://github.com Replace a string in a file. ```cmake -vcpkg_replace_string(filename match_string replace_string) +vcpkg_replace_string( ) ``` - ## Source [scripts/cmake/vcpkg\_replace\_string.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_replace_string.cmake) diff --git a/scripts/cmake/vcpkg_replace_string.cmake b/scripts/cmake/vcpkg_replace_string.cmake index d24b8677ec0fd6..1f8b37b656fb6a 100644 --- a/scripts/cmake/vcpkg_replace_string.cmake +++ b/scripts/cmake/vcpkg_replace_string.cmake @@ -4,13 +4,12 @@ Replace a string in a file. ```cmake -vcpkg_replace_string(filename match_string replace_string) +vcpkg_replace_string( ) ``` - #]===] -function(vcpkg_replace_string filename match_string replace_string) - file(READ ${filename} _contents) - string(REPLACE "${match_string}" "${replace_string}" _contents "${_contents}") - file(WRITE ${filename} "${_contents}") +function(vcpkg_replace_string filename match replace) + file(READ "${filename}" contents) + string(REPLACE "${match}" "${replace}" contents "${contents}") + file(WRITE "${filename}" "${contents}") endfunction() From 0c32a148ca02d151b027262b6914803abc275988 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Sun, 18 Jul 2021 20:36:57 -0700 Subject: [PATCH 6/7] [rollup:2021-07-16 6/7] PR #18786 (@strega-nil) [scripts-audit] windows scripts --- .../vcpkg_get_program_files_platform_bitness.cmake | 13 +++++-------- scripts/cmake/vcpkg_get_windows_sdk.cmake | 10 ++++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake index 7e3a5af5265af4..b40b24c42d2497 100644 --- a/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake +++ b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake @@ -11,13 +11,10 @@ vcpkg_get_program_files_platform_bitness() ``` #]===] -function(vcpkg_get_program_files_platform_bitness ret) - - set(ret_temp $ENV{ProgramW6432}) - if (NOT DEFINED ret_temp) - set(ret_temp $ENV{PROGRAMFILES}) +function(vcpkg_get_program_files_platform_bitness out_var) + if(DEFINED ENV{ProgramW6432}) + set("${out_var}" "$ENV{ProgramW6432}" PARENT_SCOPE) + else() + set("${out_var}" "$ENV{PROGRAMFILES}" PARENT_SCOPE) endif() - - set(${ret} ${ret_temp} PARENT_SCOPE) - endfunction() diff --git a/scripts/cmake/vcpkg_get_windows_sdk.cmake b/scripts/cmake/vcpkg_get_windows_sdk.cmake index f16d4f53e8f557..0a80d4c76c3706 100644 --- a/scripts/cmake/vcpkg_get_windows_sdk.cmake +++ b/scripts/cmake/vcpkg_get_windows_sdk.cmake @@ -9,8 +9,10 @@ vcpkg_get_windows_sdk() ``` #]===] -function(vcpkg_get_windows_sdk ret) - set(WINDOWS_SDK $ENV{WindowsSDKVersion}) - string(REPLACE "\\" "" WINDOWS_SDK "${WINDOWS_SDK}") - set(${ret} ${WINDOWS_SDK} PARENT_SCOPE) +function(vcpkg_get_windows_sdk out_var) + if("$ENV{WindowsSDKVersion}" MATCHES [[^([0-9.]*)\\?$]]) + set("${out_var}" "${CMAKE_MATCH_1}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Unexpected format for ENV{WindowsSDKVersion} ($ENV{WindowsSDKVersion})") + endif() endfunction() From 2b83de4068d55365b4f0ab4c2279f3de24d6c67c Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Sun, 18 Jul 2021 20:37:35 -0700 Subject: [PATCH 7/7] [rollup:2021-07-16 7/7] PR #18945 (@strega-nil) [many ports] remove deprecated vcpkg_check_features call [1/5] --- ports/apr/CONTROL | 9 --- ports/apr/portfile.cmake | 3 +- ports/apr/vcpkg.json | 13 ++++ ports/azure-iot-sdk-c/CONTROL | 12 ---- ports/azure-iot-sdk-c/portfile.cmake | 7 +- ports/azure-iot-sdk-c/vcpkg.json | 62 ++++++++++++++++++ ports/azure-kinect-sensor-sdk/CONTROL | 13 ---- ports/azure-kinect-sensor-sdk/portfile.cmake | 5 +- ports/azure-kinect-sensor-sdk/vcpkg.json | 45 +++++++++++++ ports/bitserializer/CONTROL | 22 ------- ports/bitserializer/portfile.cmake | 9 +-- ports/bitserializer/vcpkg.json | 42 ++++++++++++ ports/bond/portfile.cmake | 29 ++++---- ports/bond/vcpkg.json | 4 +- ports/botan/portfile.cmake | 3 +- ports/botan/vcpkg.json | 2 +- ports/capstone/CONTROL | 51 --------------- ports/capstone/portfile.cmake | 31 ++++----- ports/capstone/vcpkg.json | 62 ++++++++++++++++++ ports/ceres/portfile.cmake | 11 ++-- ports/ceres/vcpkg.json | 2 +- ports/cgal/CONTROL | 10 --- ports/cgal/portfile.cmake | 3 +- ports/cgal/vcpkg.json | 69 ++++++++++++++++++++ ports/civetweb/CONTROL | 10 --- ports/civetweb/portfile.cmake | 3 +- ports/civetweb/vcpkg.json | 16 +++++ ports/cjson/CONTROL | 7 -- ports/cjson/portfile.cmake | 3 +- ports/cjson/vcpkg.json | 12 ++++ ports/clue/CONTROL | 7 -- ports/clue/portfile.cmake | 5 +- ports/clue/vcpkg.json | 12 ++++ ports/cppzmq/CONTROL | 9 --- ports/cppzmq/portfile.cmake | 3 +- ports/cppzmq/vcpkg.json | 15 +++++ ports/crashrpt/CONTROL | 16 ----- ports/crashrpt/portfile.cmake | 7 +- ports/crashrpt/vcpkg.json | 37 +++++++++++ ports/dlib/CONTROL | 19 ------ ports/dlib/portfile.cmake | 7 +- ports/dlib/vcpkg.json | 38 +++++++++++ ports/dmlc/CONTROL | 9 --- ports/dmlc/portfile.cmake | 5 +- ports/dmlc/vcpkg.json | 13 ++++ versions/a-/apr.json | 5 ++ versions/a-/azure-iot-sdk-c.json | 5 ++ versions/a-/azure-kinect-sensor-sdk.json | 5 ++ versions/b-/bitserializer.json | 5 ++ versions/b-/bond.json | 5 ++ versions/b-/botan.json | 5 ++ versions/baseline.json | 34 +++++----- versions/c-/capstone.json | 5 ++ versions/c-/ceres.json | 5 ++ versions/c-/cgal.json | 5 ++ versions/c-/civetweb.json | 5 ++ versions/c-/cjson.json | 5 ++ versions/c-/clue.json | 5 ++ versions/c-/cppzmq.json | 5 ++ versions/c-/crashrpt.json | 5 ++ versions/d-/dlib.json | 5 ++ versions/d-/dmlc.json | 5 ++ 62 files changed, 612 insertions(+), 274 deletions(-) delete mode 100644 ports/apr/CONTROL create mode 100644 ports/apr/vcpkg.json delete mode 100644 ports/azure-iot-sdk-c/CONTROL create mode 100644 ports/azure-iot-sdk-c/vcpkg.json delete mode 100644 ports/azure-kinect-sensor-sdk/CONTROL create mode 100644 ports/azure-kinect-sensor-sdk/vcpkg.json delete mode 100644 ports/bitserializer/CONTROL create mode 100644 ports/bitserializer/vcpkg.json delete mode 100644 ports/capstone/CONTROL create mode 100644 ports/capstone/vcpkg.json delete mode 100644 ports/cgal/CONTROL create mode 100644 ports/cgal/vcpkg.json delete mode 100644 ports/civetweb/CONTROL create mode 100644 ports/civetweb/vcpkg.json delete mode 100644 ports/cjson/CONTROL create mode 100644 ports/cjson/vcpkg.json delete mode 100644 ports/clue/CONTROL create mode 100644 ports/clue/vcpkg.json delete mode 100644 ports/cppzmq/CONTROL create mode 100644 ports/cppzmq/vcpkg.json delete mode 100644 ports/crashrpt/CONTROL create mode 100644 ports/crashrpt/vcpkg.json delete mode 100644 ports/dlib/CONTROL create mode 100644 ports/dlib/vcpkg.json delete mode 100644 ports/dmlc/CONTROL create mode 100644 ports/dmlc/vcpkg.json diff --git a/ports/apr/CONTROL b/ports/apr/CONTROL deleted file mode 100644 index cf2c0079abb35c..00000000000000 --- a/ports/apr/CONTROL +++ /dev/null @@ -1,9 +0,0 @@ -Source: apr -Version: 1.7.0 -Port-Version: 3 -Homepage: https://apr.apache.org/ -Description: The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems. -Supports: !uwp - -Feature: private-headers -Description: Install non-standard files required for building Apache httpd diff --git a/ports/apr/portfile.cmake b/ports/apr/portfile.cmake index de969c20fe5399..3b9bed66415f1c 100644 --- a/ports/apr/portfile.cmake +++ b/ports/apr/portfile.cmake @@ -17,7 +17,8 @@ vcpkg_extract_source_archive_ex( if (VCPKG_TARGET_IS_WINDOWS) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - private-headers INSTALL_PRIVATE_H + FEATURES + private-headers INSTALL_PRIVATE_H ) vcpkg_configure_cmake( diff --git a/ports/apr/vcpkg.json b/ports/apr/vcpkg.json new file mode 100644 index 00000000000000..91fb9c71307363 --- /dev/null +++ b/ports/apr/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "apr", + "version": "1.7.0", + "port-version": 4, + "description": "The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.", + "homepage": "https://apr.apache.org/", + "supports": "!uwp", + "features": { + "private-headers": { + "description": "Install non-standard files required for building Apache httpd" + } + } +} diff --git a/ports/azure-iot-sdk-c/CONTROL b/ports/azure-iot-sdk-c/CONTROL deleted file mode 100644 index 456ec806a6493f..00000000000000 --- a/ports/azure-iot-sdk-c/CONTROL +++ /dev/null @@ -1,12 +0,0 @@ -Source: azure-iot-sdk-c -Version: 2020-12-09 -Build-Depends: azure-uamqp-c, azure-umqtt-c, azure-c-shared-utility, parson, azure-uhttp-c, azure-macro-utils-c, umock-c -Description: A C99 SDK for connecting devices to Microsoft Azure IoT services -Homepage: https://github.com/Azure/azure-iot-sdk-c - -Feature: public-preview -Description: A version of the azure-iot-sdk-c containing public-preview features. -Build-Depends: azure-uamqp-c[public-preview], azure-umqtt-c[public-preview], azure-c-shared-utility[public-preview], azure-uhttp-c[public-preview], azure-macro-utils-c[public-preview], umock-c[public-preview] - -Feature: use-prov-client -Description: Enables device provisioning client for DPS diff --git a/ports/azure-iot-sdk-c/portfile.cmake b/ports/azure-iot-sdk-c/portfile.cmake index 39def6f618da3b..dafefb6500c501 100644 --- a/ports/azure-iot-sdk-c/portfile.cmake +++ b/ports/azure-iot-sdk-c/portfile.cmake @@ -25,8 +25,9 @@ else() endif() vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - use-prov-client hsm_type_symm_key - use-prov-client use_prov_client + FEATURES + use-prov-client hsm_type_symm_key + use-prov-client use_prov_client ) file(COPY ${CURRENT_INSTALLED_DIR}/share/azure-c-shared-utility/azure_iot_build_rules.cmake DESTINATION ${SOURCE_PATH}/deps/azure-c-shared-utility/configs/) @@ -51,4 +52,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) -vcpkg_copy_pdbs() \ No newline at end of file +vcpkg_copy_pdbs() diff --git a/ports/azure-iot-sdk-c/vcpkg.json b/ports/azure-iot-sdk-c/vcpkg.json new file mode 100644 index 00000000000000..78a74e518218aa --- /dev/null +++ b/ports/azure-iot-sdk-c/vcpkg.json @@ -0,0 +1,62 @@ +{ + "name": "azure-iot-sdk-c", + "version-date": "2020-12-09", + "port-version": 1, + "description": "A C99 SDK for connecting devices to Microsoft Azure IoT services", + "homepage": "https://github.com/Azure/azure-iot-sdk-c", + "dependencies": [ + "azure-c-shared-utility", + "azure-macro-utils-c", + "azure-uamqp-c", + "azure-uhttp-c", + "azure-umqtt-c", + "parson", + "umock-c" + ], + "features": { + "public-preview": { + "description": "A version of the azure-iot-sdk-c containing public-preview features.", + "dependencies": [ + { + "name": "azure-c-shared-utility", + "features": [ + "public-preview" + ] + }, + { + "name": "azure-macro-utils-c", + "features": [ + "public-preview" + ] + }, + { + "name": "azure-uamqp-c", + "features": [ + "public-preview" + ] + }, + { + "name": "azure-uhttp-c", + "features": [ + "public-preview" + ] + }, + { + "name": "azure-umqtt-c", + "features": [ + "public-preview" + ] + }, + { + "name": "umock-c", + "features": [ + "public-preview" + ] + } + ] + }, + "use-prov-client": { + "description": "Enables device provisioning client for DPS" + } + } +} diff --git a/ports/azure-kinect-sensor-sdk/CONTROL b/ports/azure-kinect-sensor-sdk/CONTROL deleted file mode 100644 index 8b2137de48945b..00000000000000 --- a/ports/azure-kinect-sensor-sdk/CONTROL +++ /dev/null @@ -1,13 +0,0 @@ -Source: azure-kinect-sensor-sdk -Version: 1.4.1 -Homepage: https://github.com/microsoft/Azure-Kinect-Sensor-SDK -Description: Azure Kinect SDK is a cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device. -Build-Depends: azure-c-shared-utility, glfw3, gtest, imgui, libusb, spdlog, cjson, ebml, libjpeg-turbo, matroska, libsoundio, libyuv, libuvc (linux) -Supports: !osx - -Feature: docs -Description: Build K4A doxygen documentation. - -Feature: tool -Description: Build tools. -Build-Depends: gl3w, glew, imgui[glfw-binding,opengl3-glew-binding] diff --git a/ports/azure-kinect-sensor-sdk/portfile.cmake b/ports/azure-kinect-sensor-sdk/portfile.cmake index 742298adfc9e6e..5255481b406981 100644 --- a/ports/azure-kinect-sensor-sdk/portfile.cmake +++ b/ports/azure-kinect-sensor-sdk/portfile.cmake @@ -19,8 +19,9 @@ get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) vcpkg_add_to_path("${PYTHON3_DIR}") vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - docs K4A_BUILD_DOCS - tool BUILD_TOOLS + FEATURES + docs K4A_BUILD_DOCS + tool BUILD_TOOLS ) # .rc file needs windows.h, so do not use PREFER_NINJA here diff --git a/ports/azure-kinect-sensor-sdk/vcpkg.json b/ports/azure-kinect-sensor-sdk/vcpkg.json new file mode 100644 index 00000000000000..4226c5adf4d6cc --- /dev/null +++ b/ports/azure-kinect-sensor-sdk/vcpkg.json @@ -0,0 +1,45 @@ +{ + "name": "azure-kinect-sensor-sdk", + "version": "1.4.1", + "port-version": 1, + "description": "Azure Kinect SDK is a cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device.", + "homepage": "https://github.com/microsoft/Azure-Kinect-Sensor-SDK", + "supports": "!osx", + "dependencies": [ + "azure-c-shared-utility", + "cjson", + "ebml", + "glfw3", + "gtest", + "imgui", + "libjpeg-turbo", + "libsoundio", + "libusb", + { + "name": "libuvc", + "platform": "linux" + }, + "libyuv", + "matroska", + "spdlog" + ], + "features": { + "docs": { + "description": "Build K4A doxygen documentation." + }, + "tool": { + "description": "Build tools.", + "dependencies": [ + "gl3w", + "glew", + { + "name": "imgui", + "features": [ + "glfw-binding", + "opengl3-glew-binding" + ] + } + ] + } + } +} diff --git a/ports/bitserializer/CONTROL b/ports/bitserializer/CONTROL deleted file mode 100644 index bc33cc5525a5da..00000000000000 --- a/ports/bitserializer/CONTROL +++ /dev/null @@ -1,22 +0,0 @@ -Source: bitserializer -Version: 0.10 -Description: Core part of C++ 17 library for serialization to JSON, XML, YAML -Homepage: https://bitbucket.org/Pavel_Kisliak/bitserializer -Default-Features: cpprestjson-archive, rapidjson-archive, pugixml-archive -Supports: !(arm|osx) - -Feature: cpprestjson-archive -Build-Depends: cpprestsdk -Description: Module for support JSON (implementation based on the CppRestSDK library) - -Feature: rapidjson-archive -Build-Depends: rapidjson -Description: Module for support JSON (implementation based on the RapidJson library) - -Feature: pugixml-archive -Build-Depends: pugixml -Description: Module for support XML (implementation based on the PugiXml library) - -Feature: rapidyaml-archive -Build-Depends: ryml (!arm&!arm64&!osx) -Description: Module for support YAML (implementation based on the RapidYaml library) diff --git a/ports/bitserializer/portfile.cmake b/ports/bitserializer/portfile.cmake index d4ae869792cf3c..3b8e4184fdafad 100644 --- a/ports/bitserializer/portfile.cmake +++ b/ports/bitserializer/portfile.cmake @@ -7,10 +7,11 @@ vcpkg_from_bitbucket( ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - "cpprestjson-archive" BUILD_CPPRESTJSON_ARCHIVE - "rapidjson-archive" BUILD_RAPIDJSON_ARCHIVE - "pugixml-archive" BUILD_PUGIXML_ARCHIVE - "rapidyaml-archive" BUILD_RAPIDYAML_ARCHIVE + FEATURES + "cpprestjson-archive" BUILD_CPPRESTJSON_ARCHIVE + "rapidjson-archive" BUILD_RAPIDJSON_ARCHIVE + "pugixml-archive" BUILD_PUGIXML_ARCHIVE + "rapidyaml-archive" BUILD_RAPIDYAML_ARCHIVE ) vcpkg_configure_cmake( diff --git a/ports/bitserializer/vcpkg.json b/ports/bitserializer/vcpkg.json new file mode 100644 index 00000000000000..4866a2dc8d3509 --- /dev/null +++ b/ports/bitserializer/vcpkg.json @@ -0,0 +1,42 @@ +{ + "name": "bitserializer", + "version": "0.10", + "port-version": 1, + "description": "Core part of C++ 17 library for serialization to JSON, XML, YAML", + "homepage": "https://bitbucket.org/Pavel_Kisliak/bitserializer", + "supports": "!(arm | osx)", + "default-features": [ + "cpprestjson-archive", + "pugixml-archive", + "rapidjson-archive" + ], + "features": { + "cpprestjson-archive": { + "description": "Module for support JSON (implementation based on the CppRestSDK library)", + "dependencies": [ + "cpprestsdk" + ] + }, + "pugixml-archive": { + "description": "Module for support XML (implementation based on the PugiXml library)", + "dependencies": [ + "pugixml" + ] + }, + "rapidjson-archive": { + "description": "Module for support JSON (implementation based on the RapidJson library)", + "dependencies": [ + "rapidjson" + ] + }, + "rapidyaml-archive": { + "description": "Module for support YAML (implementation based on the RapidYaml library)", + "dependencies": [ + { + "name": "ryml", + "platform": "!arm & !arm64 & !osx" + } + ] + } + } +} diff --git a/ports/bond/portfile.cmake b/ports/bond/portfile.cmake index 6a56a4534e92be..0d424e78f43edd 100644 --- a/ports/bond/portfile.cmake +++ b/ports/bond/portfile.cmake @@ -13,9 +13,9 @@ vcpkg_from_github( if (VCPKG_TARGET_IS_WINDOWS) vcpkg_download_distfile(GBC_ARCHIVE - URLS "https://github.com/microsoft/bond/releases/download/${BOND_VER}/gbc-${BOND_VER}-amd64.zip" - FILENAME "gbc-${BOND_VER}-amd64.zip" - SHA512 41a4e01a9a0f6246a3c07f516f2c0cfc8a837eff2166c2bb787877e409d6f55eeb6084e63aabc3502492775a3fa7e381bf37fde0bdfced50a9d0b39dfaca7dfd + URLS "https://github.com/microsoft/bond/releases/download/${BOND_VER}/gbc-${BOND_VER}-amd64.zip" + FILENAME "gbc-${BOND_VER}-amd64.zip" + SHA512 41a4e01a9a0f6246a3c07f516f2c0cfc8a837eff2166c2bb787877e409d6f55eeb6084e63aabc3502492775a3fa7e381bf37fde0bdfced50a9d0b39dfaca7dfd ) # Clear the generator to prevent it from updating @@ -37,20 +37,21 @@ else() endif() vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - bond-over-grpc BOND_ENABLE_GRPC + FEATURES + bond-over-grpc BOND_ENABLE_GRPC ) vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - OPTIONS - -DBOND_LIBRARIES_ONLY=TRUE - -DBOND_GBC_PATH=${FETCHED_GBC_PATH} - -DBOND_SKIP_GBC_TESTS=TRUE - -DBOND_ENABLE_COMM=FALSE - -DBOND_FIND_RAPIDJSON=TRUE - -DBOND_STACK_OPTIONS=--allow-different-user - ${FEATURE_OPTIONS} + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBOND_LIBRARIES_ONLY=TRUE + -DBOND_GBC_PATH=${FETCHED_GBC_PATH} + -DBOND_SKIP_GBC_TESTS=TRUE + -DBOND_ENABLE_COMM=FALSE + -DBOND_FIND_RAPIDJSON=TRUE + -DBOND_STACK_OPTIONS=--allow-different-user + ${FEATURE_OPTIONS} ) vcpkg_install_cmake() diff --git a/ports/bond/vcpkg.json b/ports/bond/vcpkg.json index 524cc9d0f5b7da..5155d3a4117b1d 100644 --- a/ports/bond/vcpkg.json +++ b/ports/bond/vcpkg.json @@ -1,7 +1,7 @@ { "name": "bond", - "version-string": "9.0.3", - "port-version": 1, + "version": "9.0.3", + "port-version": 2, "description": "Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services.", "homepage": "https://github.com/Microsoft/bond", "dependencies": [ diff --git a/ports/botan/portfile.cmake b/ports/botan/portfile.cmake index cee4a0e2722125..6d04e1e93cbd84 100644 --- a/ports/botan/portfile.cmake +++ b/ports/botan/portfile.cmake @@ -51,7 +51,8 @@ else() endif() vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - amalgamation BOTAN_AMALGAMATION + FEATURES + amalgamation BOTAN_AMALGAMATION ) function(BOTAN_BUILD BOTAN_BUILD_TYPE) diff --git a/ports/botan/vcpkg.json b/ports/botan/vcpkg.json index 48b62c95c10298..0dbf7567dcaba4 100644 --- a/ports/botan/vcpkg.json +++ b/ports/botan/vcpkg.json @@ -1,7 +1,7 @@ { "name": "botan", "version": "2.16.0", - "port-version": 1, + "port-version": 2, "description": "A cryptography library written in C++11", "homepage": "https://botan.randombit.net", "supports": "!(windows & arm)", diff --git a/ports/capstone/CONTROL b/ports/capstone/CONTROL deleted file mode 100644 index 60e2a2a535a936..00000000000000 --- a/ports/capstone/CONTROL +++ /dev/null @@ -1,51 +0,0 @@ -Source: capstone -Version: 4.0.2 -Port-Version: 1 -Homepage: https://github.com/aquynh/capstone -Description: Multi-architecture disassembly framework - -Feature: arm -Description: Capstone disassembly support for ARM - -Feature: arm64 -Description: Capstone disassembly support for ARM64 - -Feature: evm -Description: Capstone disassembly support for EVM - -Feature: m680x -Description: Capstone disassembly support for M680X - -Feature: m68k -Description: Capstone disassembly support for M68k - -Feature: mips -Description: Capstone disassembly support for MIPS - -Feature: ppc -Description: Capstone disassembly support for PowerPC - -Feature: sparc -Description: Capstone disassembly support for SPARC - -Feature: sysz -Description: Capstone disassembly support for SysZ - -Feature: tms320c64x -Description: Capstone disassembly support for TMS320C64X - -Feature: x86 -Description: Capstone disassembly support for x86 - -Feature: x86-reduce -Description: Capstone disassembly support for x86 without support for less used instructions -Build-Depends: capstone[x86] - -Feature: xcore -Description: Capstone disassembly support for XCore - -Feature: diet -Description: Build Capstone in diet mode (reduced features for smaller size) - -Feature: osxkernel -Description: Support for emedding Capstone into OSX Kernel extensions diff --git a/ports/capstone/portfile.cmake b/ports/capstone/portfile.cmake index 3e01523dfacd38..bd28511cfec6ca 100644 --- a/ports/capstone/portfile.cmake +++ b/ports/capstone/portfile.cmake @@ -10,21 +10,22 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" CS_BUILD_STATIC) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" CS_BUILD_SHARED) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - "arm" CAPSTONE_ARM_SUPPORT - "arm64" CAPSTONE_ARM64_SUPPORT - "evm" CAPSTONE_EVM_SUPPORT - "m680x" CAPSTONE_M680X_SUPPORT - "m68k" CAPSTONE_M68K_SUPPORT - "mips" CAPSTONE_MIPS_SUPPORT - "osxkernel" CAPSTONE_OSXKERNEL_SUPPORT - "ppc" CAPSTONE_PPC_SUPPORT - "sparc" CAPSTONE_SPARC_SUPPORT - "sysz" CAPSTONE_SYSZ_SUPPORT - "tms320c64x" CAPSTONE_TMS320C64X_SUPPORT - "x86" CAPSTONE_X86_SUPPORT - "x86-reduce" CAPSTONE_X86_REDUCE - "xcore" CAPSTONE_XCORE_SUPPORT - "diet" CAPSTONE_BUILD_DIET + FEATURES + "arm" CAPSTONE_ARM_SUPPORT + "arm64" CAPSTONE_ARM64_SUPPORT + "evm" CAPSTONE_EVM_SUPPORT + "m680x" CAPSTONE_M680X_SUPPORT + "m68k" CAPSTONE_M68K_SUPPORT + "mips" CAPSTONE_MIPS_SUPPORT + "osxkernel" CAPSTONE_OSXKERNEL_SUPPORT + "ppc" CAPSTONE_PPC_SUPPORT + "sparc" CAPSTONE_SPARC_SUPPORT + "sysz" CAPSTONE_SYSZ_SUPPORT + "tms320c64x" CAPSTONE_TMS320C64X_SUPPORT + "x86" CAPSTONE_X86_SUPPORT + "x86-reduce" CAPSTONE_X86_REDUCE + "xcore" CAPSTONE_XCORE_SUPPORT + "diet" CAPSTONE_BUILD_DIET ) vcpkg_configure_cmake( diff --git a/ports/capstone/vcpkg.json b/ports/capstone/vcpkg.json new file mode 100644 index 00000000000000..770f479438cb16 --- /dev/null +++ b/ports/capstone/vcpkg.json @@ -0,0 +1,62 @@ +{ + "name": "capstone", + "version": "4.0.2", + "port-version": 2, + "description": "Multi-architecture disassembly framework", + "homepage": "https://github.com/aquynh/capstone", + "features": { + "arm": { + "description": "Capstone disassembly support for ARM" + }, + "arm64": { + "description": "Capstone disassembly support for ARM64" + }, + "diet": { + "description": "Build Capstone in diet mode (reduced features for smaller size)" + }, + "evm": { + "description": "Capstone disassembly support for EVM" + }, + "m680x": { + "description": "Capstone disassembly support for M680X" + }, + "m68k": { + "description": "Capstone disassembly support for M68k" + }, + "mips": { + "description": "Capstone disassembly support for MIPS" + }, + "osxkernel": { + "description": "Support for emedding Capstone into OSX Kernel extensions" + }, + "ppc": { + "description": "Capstone disassembly support for PowerPC" + }, + "sparc": { + "description": "Capstone disassembly support for SPARC" + }, + "sysz": { + "description": "Capstone disassembly support for SysZ" + }, + "tms320c64x": { + "description": "Capstone disassembly support for TMS320C64X" + }, + "x86": { + "description": "Capstone disassembly support for x86" + }, + "x86-reduce": { + "description": "Capstone disassembly support for x86 without support for less used instructions", + "dependencies": [ + { + "name": "capstone", + "features": [ + "x86" + ] + } + ] + }, + "xcore": { + "description": "Capstone disassembly support for XCore" + } + } +} diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index 78fff33b68ee6a..d0500faef27a05 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -27,11 +27,12 @@ file(REMOVE ${SOURCE_PATH}/cmake/FindEigen.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindSuiteSparse.cmake) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - "suitesparse" SUITESPARSE - "cxsparse" CXSPARSE - "lapack" LAPACK - "eigensparse" EIGENSPARSE - "tools" GFLAGS + FEATURES + "suitesparse" SUITESPARSE + "cxsparse" CXSPARSE + "lapack" LAPACK + "eigensparse" EIGENSPARSE + "tools" GFLAGS ) vcpkg_configure_cmake( diff --git a/ports/ceres/vcpkg.json b/ports/ceres/vcpkg.json index 927a150a23a3f7..b1be6bde6f749c 100644 --- a/ports/ceres/vcpkg.json +++ b/ports/ceres/vcpkg.json @@ -1,7 +1,7 @@ { "name": "ceres", "version-semver": "2.0.0", - "port-version": 4, + "port-version": 5, "description": "non-linear optimization package", "homepage": "https://github.com/ceres-solver/ceres-solver", "dependencies": [ diff --git a/ports/cgal/CONTROL b/ports/cgal/CONTROL deleted file mode 100644 index ee817113a30732..00000000000000 --- a/ports/cgal/CONTROL +++ /dev/null @@ -1,10 +0,0 @@ -Source: cgal -Version: 5.2.2 -Port-Version: 0 -Build-Depends: mpfr, gmp, zlib, boost-accumulators, boost-algorithm, boost-bimap, boost-callable-traits, boost-concept-check, boost-container, boost-core, boost-detail, boost-filesystem, boost-functional, boost-fusion, boost-geometry, boost-graph, boost-heap, boost-intrusive, boost-iostreams, boost-iterator, boost-lambda, boost-logic, boost-math, boost-mpl, boost-multi-index, boost-multiprecision, boost-numeric-conversion, boost-optional, boost-parameter, boost-pool, boost-preprocessor, boost-property-map, boost-property-tree, boost-ptr-container, boost-random, boost-range, boost-serialization, boost-spirit, boost-thread, boost-tuple, boost-type-traits, boost-units, boost-utility, boost-variant -Homepage: https://github.com/CGAL/cgal -Description: The Computational Geometry Algorithms Library (CGAL) is a C++ library that aims to provide easy access to efficient and reliable algorithms in computational geometry. - -Feature: qt -Build-Depends: qt5-base[core], qt5-3d, qt5-svg, qt5-xmlpatterns, qt5-script, eigen3 -Description: Qt GUI support for CGAL diff --git a/ports/cgal/portfile.cmake b/ports/cgal/portfile.cmake index 87be4144f43d7c..729ece8953d8b0 100644 --- a/ports/cgal/portfile.cmake +++ b/ports/cgal/portfile.cmake @@ -9,7 +9,8 @@ vcpkg_from_github( ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - qt WITH_CGAL_Qt5 + FEATURES + qt WITH_CGAL_Qt5 ) vcpkg_configure_cmake( diff --git a/ports/cgal/vcpkg.json b/ports/cgal/vcpkg.json new file mode 100644 index 00000000000000..1ac7f45ffb0165 --- /dev/null +++ b/ports/cgal/vcpkg.json @@ -0,0 +1,69 @@ +{ + "name": "cgal", + "version": "5.2.2", + "port-version": 1, + "description": "The Computational Geometry Algorithms Library (CGAL) is a C++ library that aims to provide easy access to efficient and reliable algorithms in computational geometry.", + "homepage": "https://github.com/CGAL/cgal", + "dependencies": [ + "boost-accumulators", + "boost-algorithm", + "boost-bimap", + "boost-callable-traits", + "boost-concept-check", + "boost-container", + "boost-core", + "boost-detail", + "boost-filesystem", + "boost-functional", + "boost-fusion", + "boost-geometry", + "boost-graph", + "boost-heap", + "boost-intrusive", + "boost-iostreams", + "boost-iterator", + "boost-lambda", + "boost-logic", + "boost-math", + "boost-mpl", + "boost-multi-index", + "boost-multiprecision", + "boost-numeric-conversion", + "boost-optional", + "boost-parameter", + "boost-pool", + "boost-preprocessor", + "boost-property-map", + "boost-property-tree", + "boost-ptr-container", + "boost-random", + "boost-range", + "boost-serialization", + "boost-spirit", + "boost-thread", + "boost-tuple", + "boost-type-traits", + "boost-units", + "boost-utility", + "boost-variant", + "gmp", + "mpfr", + "zlib" + ], + "features": { + "qt": { + "description": "Qt GUI support for CGAL", + "dependencies": [ + "eigen3", + "qt5-3d", + { + "name": "qt5-base", + "default-features": false + }, + "qt5-script", + "qt5-svg", + "qt5-xmlpatterns" + ] + } + } +} diff --git a/ports/civetweb/CONTROL b/ports/civetweb/CONTROL deleted file mode 100644 index 395e244651db4d..00000000000000 --- a/ports/civetweb/CONTROL +++ /dev/null @@ -1,10 +0,0 @@ -Source: civetweb -Version: 1.13 -Port-Version: 1 -Homepage: https://github.com/civetweb/civetweb -Description: Easy to use, powerful, C/C++ embeddable web server. -Supports: !uwp - -Feature: ssl -Build-Depends: openssl -Description: Enable SSL support \ No newline at end of file diff --git a/ports/civetweb/portfile.cmake b/ports/civetweb/portfile.cmake index 2dae7f4d64025b..8af5c6d764e370 100644 --- a/ports/civetweb/portfile.cmake +++ b/ports/civetweb/portfile.cmake @@ -12,7 +12,8 @@ vcpkg_from_github( ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - ssl CIVETWEB_ENABLE_SSL + FEATURES + ssl CIVETWEB_ENABLE_SSL ) vcpkg_configure_cmake( diff --git a/ports/civetweb/vcpkg.json b/ports/civetweb/vcpkg.json new file mode 100644 index 00000000000000..77ac71bf079336 --- /dev/null +++ b/ports/civetweb/vcpkg.json @@ -0,0 +1,16 @@ +{ + "name": "civetweb", + "version": "1.13", + "port-version": 2, + "description": "Easy to use, powerful, C/C++ embeddable web server.", + "homepage": "https://github.com/civetweb/civetweb", + "supports": "!uwp", + "features": { + "ssl": { + "description": "Enable SSL support", + "dependencies": [ + "openssl" + ] + } + } +} diff --git a/ports/cjson/CONTROL b/ports/cjson/CONTROL deleted file mode 100644 index 27474316a4f6ed..00000000000000 --- a/ports/cjson/CONTROL +++ /dev/null @@ -1,7 +0,0 @@ -Source: cjson -Version: 2019-11-30-1 -Description: Ultralightweight JSON parser in ANSI C -Homepage: https://github.com/DaveGamble/cJSON - -Feature: utils -Description: Enable building the cJSON_Utils library diff --git a/ports/cjson/portfile.cmake b/ports/cjson/portfile.cmake index 058c9009d6745d..52e84654a91386 100644 --- a/ports/cjson/portfile.cmake +++ b/ports/cjson/portfile.cmake @@ -8,7 +8,8 @@ vcpkg_from_github( vcpkg_check_features( OUT_FEATURE_OPTIONS FEATURE_OPTIONS - utils ENABLE_CJSON_UTILS + FEATURES + utils ENABLE_CJSON_UTILS ) if(CMAKE_HOST_WIN32) diff --git a/ports/cjson/vcpkg.json b/ports/cjson/vcpkg.json new file mode 100644 index 00000000000000..92bec5fb2db973 --- /dev/null +++ b/ports/cjson/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "cjson", + "version-date": "2019-11-30", + "port-version": 2, + "description": "Ultralightweight JSON parser in ANSI C", + "homepage": "https://github.com/DaveGamble/cJSON", + "features": { + "utils": { + "description": "Enable building the cJSON_Utils library" + } + } +} diff --git a/ports/clue/CONTROL b/ports/clue/CONTROL deleted file mode 100644 index dcd80809e5d12c..00000000000000 --- a/ports/clue/CONTROL +++ /dev/null @@ -1,7 +0,0 @@ -Source: clue -Version: 1.0.0-alpha.7 -Homepage: https://github.com/martinmoene/clue -Description: clue is a C++03 header-only library to log messages with a severity and optional module identifier. - -Feature: test -Description: Build test \ No newline at end of file diff --git a/ports/clue/portfile.cmake b/ports/clue/portfile.cmake index 7fb67edd76d7ec..3b9715f9e98932 100644 --- a/ports/clue/portfile.cmake +++ b/ports/clue/portfile.cmake @@ -9,7 +9,8 @@ vcpkg_from_github( file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - test CLUE_BUILD_TEST + FEATURES + test CLUE_BUILD_TEST ) vcpkg_configure_cmake( @@ -24,4 +25,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) \ No newline at end of file +file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) diff --git a/ports/clue/vcpkg.json b/ports/clue/vcpkg.json new file mode 100644 index 00000000000000..105741b0955ea8 --- /dev/null +++ b/ports/clue/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "clue", + "version-string": "1.0.0-alpha.7", + "port-version": 1, + "description": "clue is a C++03 header-only library to log messages with a severity and optional module identifier.", + "homepage": "https://github.com/martinmoene/clue", + "features": { + "test": { + "description": "Build test" + } + } +} diff --git a/ports/cppzmq/CONTROL b/ports/cppzmq/CONTROL deleted file mode 100644 index f148c1a7736c5e..00000000000000 --- a/ports/cppzmq/CONTROL +++ /dev/null @@ -1,9 +0,0 @@ -Source: cppzmq -Version: 4.7.1 -Port-Version: 1 -Build-Depends: zeromq -Homepage: https://github.com/zeromq/cppzmq -Description: lightweight messaging kernel, C++ bindings - -Feature: draft -Description: Build and install draft diff --git a/ports/cppzmq/portfile.cmake b/ports/cppzmq/portfile.cmake index 2789190b73a3e7..aa968e8a3fc9e2 100644 --- a/ports/cppzmq/portfile.cmake +++ b/ports/cppzmq/portfile.cmake @@ -7,7 +7,8 @@ vcpkg_from_github( ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - draft ENABLE_DRAFTS + FEATURES + draft ENABLE_DRAFTS ) vcpkg_configure_cmake( diff --git a/ports/cppzmq/vcpkg.json b/ports/cppzmq/vcpkg.json new file mode 100644 index 00000000000000..db7ce81fbe8e1f --- /dev/null +++ b/ports/cppzmq/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "cppzmq", + "version": "4.7.1", + "port-version": 2, + "description": "lightweight messaging kernel, C++ bindings", + "homepage": "https://github.com/zeromq/cppzmq", + "dependencies": [ + "zeromq" + ], + "features": { + "draft": { + "description": "Build and install draft" + } + } +} diff --git a/ports/crashrpt/CONTROL b/ports/crashrpt/CONTROL deleted file mode 100644 index 4b15e9d2336243..00000000000000 --- a/ports/crashrpt/CONTROL +++ /dev/null @@ -1,16 +0,0 @@ -Source: crashrpt -Version: 1.4.3 -Description: A crash reporting system for Windows applications -Homepage: http://crashrpt.sourceforge.net/ -Build-Depends: dbghelp, libjpeg-turbo, libogg, libpng, libtheora, tinyxml, wtl, zlib -Default-Features: - -Feature: probe -Description: The CrashRptProbe library - -Feature: tests -Description: Test application for crashrpt -Build-Depends: crashrpt[core,probe] - -Feature: demos -Description: Demo applications for CrashRptProbe diff --git a/ports/crashrpt/portfile.cmake b/ports/crashrpt/portfile.cmake index f52f8e19a24b8f..ffc83aa98b1976 100644 --- a/ports/crashrpt/portfile.cmake +++ b/ports/crashrpt/portfile.cmake @@ -28,9 +28,10 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" CRASHRPT_BUILD_SHARED_ string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" CRASHRPT_LINK_CRT_AS_DLL) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - probe CRASHRPT_BUILD_PROBE - tests CRASHRPT_BUILD_TESTS - demos CRASHRPT_BUILD_DEMOS + FEATURES + probe CRASHRPT_BUILD_PROBE + tests CRASHRPT_BUILD_TESTS + demos CRASHRPT_BUILD_DEMOS ) # PREFER_NINJA is not used below since CrashSender fails to build with errors like this one: diff --git a/ports/crashrpt/vcpkg.json b/ports/crashrpt/vcpkg.json new file mode 100644 index 00000000000000..3ed55e7312b515 --- /dev/null +++ b/ports/crashrpt/vcpkg.json @@ -0,0 +1,37 @@ +{ + "name": "crashrpt", + "version": "1.4.3", + "port-version": 1, + "description": "A crash reporting system for Windows applications", + "homepage": "http://crashrpt.sourceforge.net/", + "dependencies": [ + "dbghelp", + "libjpeg-turbo", + "libogg", + "libpng", + "libtheora", + "tinyxml", + "wtl", + "zlib" + ], + "features": { + "demos": { + "description": "Demo applications for CrashRptProbe" + }, + "probe": { + "description": "The CrashRptProbe library" + }, + "tests": { + "description": "Test application for crashrpt", + "dependencies": [ + { + "name": "crashrpt", + "default-features": false, + "features": [ + "probe" + ] + } + ] + } + } +} diff --git a/ports/dlib/CONTROL b/ports/dlib/CONTROL deleted file mode 100644 index c9b8f1f6834c3c..00000000000000 --- a/ports/dlib/CONTROL +++ /dev/null @@ -1,19 +0,0 @@ -Source: dlib -Version: 19.21 -Port-Version: 4 -Build-Depends: libjpeg-turbo, libpng, blas, lapack -Homepage: https://github.com/davisking/dlib -Description: Modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ -Default-Features: fftw3, sqlite3 - -Feature: cuda -Build-Depends: cuda, cudnn -Description: CUDA support for dlib - -Feature: fftw3 -Build-Depends: fftw3 -Description: fftw3 support for dlib - -Feature: sqlite3 -Build-Depends: sqlite3 -Description: sqlite3 support for dlib diff --git a/ports/dlib/portfile.cmake b/ports/dlib/portfile.cmake index 00f45d25f2083d..481554b90e49e9 100644 --- a/ports/dlib/portfile.cmake +++ b/ports/dlib/portfile.cmake @@ -22,9 +22,10 @@ string(REPLACE "PNG_LIBRARY" "PNG_LIBRARIES" DLIB_CMAKE "${DLIB_CMAKE}") file(WRITE "${SOURCE_PATH}/dlib/CMakeLists.txt" "${DLIB_CMAKE}") vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - "sqlite3" DLIB_LINK_WITH_SQLITE3 - "fftw3" DLIB_USE_FFTW - "cuda" DLIB_USE_CUDA + FEATURES + "sqlite3" DLIB_LINK_WITH_SQLITE3 + "fftw3" DLIB_USE_FFTW + "cuda" DLIB_USE_CUDA ) vcpkg_configure_cmake( diff --git a/ports/dlib/vcpkg.json b/ports/dlib/vcpkg.json new file mode 100644 index 00000000000000..bb60944f8d3111 --- /dev/null +++ b/ports/dlib/vcpkg.json @@ -0,0 +1,38 @@ +{ + "name": "dlib", + "version": "19.21", + "port-version": 5, + "description": "Modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++", + "homepage": "https://github.com/davisking/dlib", + "dependencies": [ + "blas", + "lapack", + "libjpeg-turbo", + "libpng" + ], + "default-features": [ + "fftw3", + "sqlite3" + ], + "features": { + "cuda": { + "description": "CUDA support for dlib", + "dependencies": [ + "cuda", + "cudnn" + ] + }, + "fftw3": { + "description": "fftw3 support for dlib", + "dependencies": [ + "fftw3" + ] + }, + "sqlite3": { + "description": "sqlite3 support for dlib", + "dependencies": [ + "sqlite3" + ] + } + } +} diff --git a/ports/dmlc/CONTROL b/ports/dmlc/CONTROL deleted file mode 100644 index 7021ffdcd01347..00000000000000 --- a/ports/dmlc/CONTROL +++ /dev/null @@ -1,9 +0,0 @@ -Source: dmlc -Version: 2019-08-12 -Port-Version: 5 -Homepage: https://github.com/dmlc/dmlc-core -Description: DMLC-Core is the backbone library to support all DMLC projects, offers the bricks to build efficient and scalable distributed machine learning libraries. -Supports: !uwp - -Feature: openmp -Description: Build with openmp diff --git a/ports/dmlc/portfile.cmake b/ports/dmlc/portfile.cmake index fd339627a3f26e..3e4c7baeb39e13 100644 --- a/ports/dmlc/portfile.cmake +++ b/ports/dmlc/portfile.cmake @@ -11,7 +11,8 @@ vcpkg_from_github( ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - openmp ENABLE_OPENMP + FEATURES + openmp ENABLE_OPENMP ) if(VCPKG_CRT_LINKAGE STREQUAL dynamic) @@ -36,4 +37,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/dmlc) # Handle copyright -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/dmlc/vcpkg.json b/ports/dmlc/vcpkg.json new file mode 100644 index 00000000000000..36a4e03953a68a --- /dev/null +++ b/ports/dmlc/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "dmlc", + "version-date": "2019-08-12", + "port-version": 6, + "description": "DMLC-Core is the backbone library to support all DMLC projects, offers the bricks to build efficient and scalable distributed machine learning libraries.", + "homepage": "https://github.com/dmlc/dmlc-core", + "supports": "!uwp", + "features": { + "openmp": { + "description": "Build with openmp" + } + } +} diff --git a/versions/a-/apr.json b/versions/a-/apr.json index 6f5ea6bf9b870c..d652415aa93e90 100644 --- a/versions/a-/apr.json +++ b/versions/a-/apr.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b9e93acdaa680398eaed361f1df530096ded84ff", + "version": "1.7.0", + "port-version": 4 + }, { "git-tree": "ca62f9b23d92ff6bb375277cb56e6ea1cde2c9f1", "version-string": "1.7.0", diff --git a/versions/a-/azure-iot-sdk-c.json b/versions/a-/azure-iot-sdk-c.json index 4e77989eb34ca9..f70e69627c4baf 100644 --- a/versions/a-/azure-iot-sdk-c.json +++ b/versions/a-/azure-iot-sdk-c.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "5dadcecafd0c3ffdfcf438c1f5f8b106002e14d0", + "version-date": "2020-12-09", + "port-version": 1 + }, { "git-tree": "d74324af317840ffb5c5aa54f1579ef2faab4a0e", "version-string": "2020-12-09", diff --git a/versions/a-/azure-kinect-sensor-sdk.json b/versions/a-/azure-kinect-sensor-sdk.json index e7a2d37b5fb425..12f10ca85f24fb 100644 --- a/versions/a-/azure-kinect-sensor-sdk.json +++ b/versions/a-/azure-kinect-sensor-sdk.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "dc7fdf585419fadcd96b13a800c4323b098256cd", + "version": "1.4.1", + "port-version": 1 + }, { "git-tree": "28c9dbd6d17602e942cd81f9d70aeff80f3d83f0", "version-string": "1.4.1", diff --git a/versions/b-/bitserializer.json b/versions/b-/bitserializer.json index 5e3fd467f69642..7e1ce41a5bba9c 100644 --- a/versions/b-/bitserializer.json +++ b/versions/b-/bitserializer.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a840c1d638565cbc8c4fd9a4200c0f54136275d7", + "version": "0.10", + "port-version": 1 + }, { "git-tree": "7ad926d8d5b488348fb195aa2180443a986e3464", "version-string": "0.10", diff --git a/versions/b-/bond.json b/versions/b-/bond.json index 88acf8925e8ae7..98a2e01d805121 100644 --- a/versions/b-/bond.json +++ b/versions/b-/bond.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a1dbc5726734016b562a6f957ae3072df17b4592", + "version": "9.0.3", + "port-version": 2 + }, { "git-tree": "29fa989c86f7846056f2afc162152f79169ec813", "version-string": "9.0.3", diff --git a/versions/b-/botan.json b/versions/b-/botan.json index 8b68bd2fb6a834..fec275a65f2f4a 100644 --- a/versions/b-/botan.json +++ b/versions/b-/botan.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "8a0618dd4e015d7a0ae5339e6758c5f1fd4754a6", + "version": "2.16.0", + "port-version": 2 + }, { "git-tree": "7776bdc54cb37a29c18701d4332e4537e6be357a", "version": "2.16.0", diff --git a/versions/baseline.json b/versions/baseline.json index 591333a43bc32e..06df0be000fc13 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -102,7 +102,7 @@ }, "apr": { "baseline": "1.7.0", - "port-version": 3 + "port-version": 4 }, "apr-util": { "baseline": "1.6.1", @@ -274,11 +274,11 @@ }, "azure-iot-sdk-c": { "baseline": "2020-12-09", - "port-version": 0 + "port-version": 1 }, "azure-kinect-sensor-sdk": { "baseline": "1.4.1", - "port-version": 0 + "port-version": 1 }, "azure-macro-utils-c": { "baseline": "2020-06-17", @@ -390,7 +390,7 @@ }, "bitserializer": { "baseline": "0.10", - "port-version": 0 + "port-version": 1 }, "bitserializer-cpprestjson": { "baseline": "alias", @@ -434,7 +434,7 @@ }, "bond": { "baseline": "9.0.3", - "port-version": 1 + "port-version": 2 }, "boolinq": { "baseline": "3.0.1", @@ -1038,7 +1038,7 @@ }, "botan": { "baseline": "2.16.0", - "port-version": 1 + "port-version": 2 }, "box2d": { "baseline": "2.4.1", @@ -1126,7 +1126,7 @@ }, "capstone": { "baseline": "4.0.2", - "port-version": 1 + "port-version": 2 }, "cartographer": { "baseline": "1.0.0", @@ -1182,7 +1182,7 @@ }, "ceres": { "baseline": "2.0.0", - "port-version": 4 + "port-version": 5 }, "cfitsio": { "baseline": "3.49", @@ -1190,7 +1190,7 @@ }, "cgal": { "baseline": "5.2.2", - "port-version": 0 + "port-version": 1 }, "cgicc": { "baseline": "3.2.19-4", @@ -1254,11 +1254,11 @@ }, "civetweb": { "baseline": "1.13", - "port-version": 1 + "port-version": 2 }, "cjson": { - "baseline": "2019-11-30-1", - "port-version": 0 + "baseline": "2019-11-30", + "port-version": 2 }, "clamav": { "baseline": "0.103.0", @@ -1314,7 +1314,7 @@ }, "clue": { "baseline": "1.0.0-alpha.7", - "port-version": 0 + "port-version": 1 }, "cmark": { "baseline": "0.29.0", @@ -1474,7 +1474,7 @@ }, "cppzmq": { "baseline": "4.7.1", - "port-version": 1 + "port-version": 2 }, "cpr": { "baseline": "1.6.2", @@ -1502,7 +1502,7 @@ }, "crashrpt": { "baseline": "1.4.3", - "port-version": 0 + "port-version": 1 }, "crc32c": { "baseline": "1.1.1", @@ -1726,11 +1726,11 @@ }, "dlib": { "baseline": "19.21", - "port-version": 4 + "port-version": 5 }, "dmlc": { "baseline": "2019-08-12", - "port-version": 5 + "port-version": 6 }, "docopt": { "baseline": "2018-11-01", diff --git a/versions/c-/capstone.json b/versions/c-/capstone.json index a74ac9b9255393..bcd224fa77aa3d 100644 --- a/versions/c-/capstone.json +++ b/versions/c-/capstone.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "465e527988f09c855e156cff45b7ee6dfbe1d303", + "version": "4.0.2", + "port-version": 2 + }, { "git-tree": "7c919b056af0b624766a625f1de7847f97262d92", "version-string": "4.0.2", diff --git a/versions/c-/ceres.json b/versions/c-/ceres.json index c4607a3ae012be..b2284cd17c9e0e 100644 --- a/versions/c-/ceres.json +++ b/versions/c-/ceres.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "07f2aa6906e97637ae7a4ed6dcfce6867eb1a049", + "version-semver": "2.0.0", + "port-version": 5 + }, { "git-tree": "ba834e4ef32213f516d2b0539240ba4cc4a9c90a", "version-semver": "2.0.0", diff --git a/versions/c-/cgal.json b/versions/c-/cgal.json index 6f27b3aeccc590..ce6e700fc47994 100644 --- a/versions/c-/cgal.json +++ b/versions/c-/cgal.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "02c3a0b581425d69dc21787d87e14c53a07e33ee", + "version": "5.2.2", + "port-version": 1 + }, { "git-tree": "8ecf63852d98760d2b2bd0c75b70ab95a5e73aca", "version-string": "5.2.2", diff --git a/versions/c-/civetweb.json b/versions/c-/civetweb.json index 669cb9a5696a7d..4a1f0f8274dc38 100644 --- a/versions/c-/civetweb.json +++ b/versions/c-/civetweb.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ca6f80fd431dc0a13daa1509308d598700fbd763", + "version": "1.13", + "port-version": 2 + }, { "git-tree": "c66a22f30f2b72f81ae2bb23cce2bfc512b6e983", "version-string": "1.13", diff --git a/versions/c-/cjson.json b/versions/c-/cjson.json index 60a5fdf30eb2b9..65804958af0dd7 100644 --- a/versions/c-/cjson.json +++ b/versions/c-/cjson.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "c8997bd75a1e40cf8ac7f7d77a942afd84f01d2e", + "version-date": "2019-11-30", + "port-version": 2 + }, { "git-tree": "2a1edb97563c7a8e4007f479bfdcb33122911e16", "version-string": "2019-11-30-1", diff --git a/versions/c-/clue.json b/versions/c-/clue.json index ae2eb1280ba21e..def781117f8b9a 100644 --- a/versions/c-/clue.json +++ b/versions/c-/clue.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b58662a5b92d34be097810c33d6ec24400ae0b26", + "version-string": "1.0.0-alpha.7", + "port-version": 1 + }, { "git-tree": "f4b5156fc9604848b9aa627ef0bf7ab21e9ad5ac", "version-string": "1.0.0-alpha.7", diff --git a/versions/c-/cppzmq.json b/versions/c-/cppzmq.json index caaa7cfa80a1d0..bbf86ebf20665f 100644 --- a/versions/c-/cppzmq.json +++ b/versions/c-/cppzmq.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "142701d624e76cc4288ddce74c796501ba8cfa57", + "version": "4.7.1", + "port-version": 2 + }, { "git-tree": "8f196edc3e7a6d6d26e14162ed542848d1eee4c1", "version-string": "4.7.1", diff --git a/versions/c-/crashrpt.json b/versions/c-/crashrpt.json index 665df26dda7ed0..633efbaa4d5e66 100644 --- a/versions/c-/crashrpt.json +++ b/versions/c-/crashrpt.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ad55102e0d167bb457349e5b2b4cec75efc45a91", + "version": "1.4.3", + "port-version": 1 + }, { "git-tree": "671b2d16a22bdaf8718e15fa13554c838b6e6ce7", "version-string": "1.4.3", diff --git a/versions/d-/dlib.json b/versions/d-/dlib.json index 1984302539f7de..9d7cd262cf8b8b 100644 --- a/versions/d-/dlib.json +++ b/versions/d-/dlib.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "58207e22ff2355358bee9fb607b03b6cab1030c6", + "version": "19.21", + "port-version": 5 + }, { "git-tree": "498121f386e722fbc511caac849425041206735b", "version-string": "19.21", diff --git a/versions/d-/dmlc.json b/versions/d-/dmlc.json index 9a0daad884339f..97a0362d2bdb11 100644 --- a/versions/d-/dmlc.json +++ b/versions/d-/dmlc.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "47d5b971d74b762c6c52e676d5c1c082ee462c0e", + "version-date": "2019-08-12", + "port-version": 6 + }, { "git-tree": "162f71aa6f31426d3e8cbbb2614c8bba689e7bbc", "version-string": "2019-08-12",