aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Neumann <30894796+Neumann-A@users.noreply.github.com>2021-03-31 21:47:35 +0200
committerGitHub <noreply@github.com>2021-03-31 12:47:35 -0700
commit2779b733c221361aa33290f2dce1dd2cc5a0cbf1 (patch)
tree9742ed865c74f365feb2b553a2d101538c924930 /scripts
parent93304d198183634d07ea97aa831480a79f6960d6 (diff)
downloadvcpkg-2779b733c221361aa33290f2dce1dd2cc5a0cbf1.tar.gz
vcpkg-2779b733c221361aa33290f2dce1dd2cc5a0cbf1.zip
[vcpkg/scripts] add a way to define another tool destination (#16935)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/vcpkg_copy_tools.cmake16
-rw-r--r--scripts/cmake/vcpkg_fixup_cmake_targets.cmake22
2 files changed, 28 insertions, 10 deletions
diff --git a/scripts/cmake/vcpkg_copy_tools.cmake b/scripts/cmake/vcpkg_copy_tools.cmake
index 628bfc506..ea1368da0 100644
--- a/scripts/cmake/vcpkg_copy_tools.cmake
+++ b/scripts/cmake/vcpkg_copy_tools.cmake
@@ -8,6 +8,7 @@ Copy tools and all their DLL dependencies into the `tools` folder.
vcpkg_copy_tools(
TOOL_NAMES <tool1>...
[SEARCH_DIR <${CURRENT_PACKAGES_DIR}/bin>]
+ [DESTINATION <${CURRENT_PACKAGES_DIR}/tools/${PORT}>]
[AUTO_CLEAN]
)
```
@@ -18,6 +19,9 @@ A list of tool filenames without extension.
### SEARCH_DIR
The path to the directory containing the tools. This will be set to `${CURRENT_PACKAGES_DIR}/bin` if ommited.
+### DESTINATION
+Destination to copy the tools to. This will be set to `${CURRENT_PACKAGES_DIR}/tools/${PORT}` if ommited.
+
### AUTO_CLEAN
Auto clean executables in `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_DIR}/debug/bin`.
@@ -30,12 +34,16 @@ Auto clean executables in `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_
function(vcpkg_copy_tools)
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
- cmake_parse_arguments(PARSE_ARGV 0 _vct "AUTO_CLEAN" "SEARCH_DIR" "TOOL_NAMES")
+ cmake_parse_arguments(PARSE_ARGV 0 _vct "AUTO_CLEAN" "SEARCH_DIR;DESTINATION" "TOOL_NAMES")
if(NOT DEFINED _vct_TOOL_NAMES)
message(FATAL_ERROR "TOOL_NAMES must be specified.")
endif()
+ if(NOT DEFINED _vct_DESTINATION)
+ set(_vct_DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ endif()
+
if(NOT DEFINED _vct_SEARCH_DIR)
set(_vct_SEARCH_DIR "${CURRENT_PACKAGES_DIR}/bin")
elseif(NOT IS_DIRECTORY ${_vct_SEARCH_DIR})
@@ -46,12 +54,12 @@ function(vcpkg_copy_tools)
set(tool_path "${_vct_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
set(tool_pdb "${_vct_SEARCH_DIR}/${tool_name}.pdb")
if(EXISTS "${tool_path}")
- file(COPY "${tool_path}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ file(COPY "${tool_path}" DESTINATION "${_vct_DESTINATION}")
else()
message(FATAL_ERROR "Couldn't find this tool: ${tool_path}.")
endif()
if(EXISTS "${tool_pdb}")
- file(COPY "${tool_pdb}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ file(COPY "${tool_pdb}" DESTINATION "${_vct_DESTINATION}")
endif()
endforeach()
@@ -59,5 +67,5 @@ function(vcpkg_copy_tools)
vcpkg_clean_executables_in_bin(FILE_NAMES ${_vct_TOOL_NAMES})
endif()
- vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ vcpkg_copy_tool_dependencies("${_vct_DESTINATION}")
endfunction()
diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
index d4eae04a6..f38270e8c 100644
--- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
+++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
@@ -9,7 +9,10 @@ Additionally corrects common issues with targets, such as absolute paths and inc
## Usage
```cmake
-vcpkg_fixup_cmake_targets([CONFIG_PATH <share/${PORT}>] [TARGET_PATH <share/${PORT}>] [DO_NOT_DELETE_PARENT_CONFIG_PATH])
+vcpkg_fixup_cmake_targets([CONFIG_PATH <share/${PORT}>]
+ [TARGET_PATH <share/${PORT}>]
+ [TOOLS_PATH <tools/${PORT}>]
+ [DO_NOT_DELETE_PARENT_CONFIG_PATH])
```
## Parameters
@@ -35,12 +38,15 @@ Disables the correction of_IMPORT_PREFIX done by vcpkg due to moving the targets
Currently the correction does not take into account how the files are moved and applies
I rather simply correction which in some cases will yield the wrong results.
+### TOOLS_PATH
+Define the base path to tools. Default: `tools/<PORT>`
+
## Notes
Transform all `/debug/<CONFIG_PATH>/*targets-debug.cmake` files and move them to `/<TARGET_PATH>`.
Removes all `/debug/<CONFIG_PATH>/*targets.cmake` and `/debug/<CONFIG_PATH>/*config.cmake`.
-Transform all references matching `/bin/*.exe` to `/tools/<port>/*.exe` on Windows.
-Transform all references matching `/bin/*` to `/tools/<port>/*` on other platforms.
+Transform all references matching `/bin/*.exe` to `/${TOOLS_PATH}/*.exe` on Windows.
+Transform all references matching `/bin/*` to `/${TOOLS_PATH}/*` on other platforms.
Fix `${_IMPORT_PREFIX}` in auto generated targets to be one folder deeper.
Replace `${CURRENT_INSTALLED_DIR}` with `${_IMPORT_PREFIX}` in configs and targets.
@@ -57,7 +63,7 @@ function(vcpkg_fixup_cmake_targets)
message(FATAL_ERROR "The ${PORT} port already depends on vcpkg-cmake-config; using both vcpkg-cmake-config and vcpkg_fixup_cmake_targets in the same port is unsupported.")
endif()
- cmake_parse_arguments(PARSE_ARGV 0 arg "DO_NOT_DELETE_PARENT_CONFIG_PATH" "CONFIG_PATH;TARGET_PATH;NO_PREFIX_CORRECTION" "")
+ cmake_parse_arguments(PARSE_ARGV 0 arg "DO_NOT_DELETE_PARENT_CONFIG_PATH" "CONFIG_PATH;TARGET_PATH;NO_PREFIX_CORRECTION;TOOLS_PATH" "")
if(arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "vcpkg_fixup_cmake_targets was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
@@ -66,6 +72,10 @@ function(vcpkg_fixup_cmake_targets)
if(NOT arg_TARGET_PATH)
set(arg_TARGET_PATH share/${PORT})
endif()
+
+ if(NOT arg_TOOLS_PATH)
+ set(arg_TOOLS_PATH tools/${PORT})
+ endif()
string(REPLACE "." "\\." EXECUTABLE_SUFFIX "${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
@@ -148,7 +158,7 @@ function(vcpkg_fixup_cmake_targets)
foreach(RELEASE_TARGET IN LISTS RELEASE_TARGETS)
file(READ ${RELEASE_TARGET} _contents)
string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}")
- string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+${EXECUTABLE_SUFFIX})" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}")
+ string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+${EXECUTABLE_SUFFIX})" "\${_IMPORT_PREFIX}/${arg_TOOLS_PATH}/\\1" _contents "${_contents}")
file(WRITE ${RELEASE_TARGET} "${_contents}")
endforeach()
@@ -161,7 +171,7 @@ function(vcpkg_fixup_cmake_targets)
file(READ ${DEBUG_TARGET} _contents)
string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}")
- string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \";]+${EXECUTABLE_SUFFIX})" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}")
+ string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \";]+${EXECUTABLE_SUFFIX})" "\${_IMPORT_PREFIX}/${arg_TOOLS_PATH}/\\1" _contents "${_contents}")
string(REPLACE "\${_IMPORT_PREFIX}/lib" "\${_IMPORT_PREFIX}/debug/lib" _contents "${_contents}")
string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/debug/bin" _contents "${_contents}")
file(WRITE ${RELEASE_SHARE}/${DEBUG_TARGET_REL} "${_contents}")