From d15587c5d425fa6535b4fe04575d5982cf9bb3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wro=CC=81bel?= Date: Thu, 16 Sep 2021 19:30:06 +0200 Subject: [PATCH 1/5] [vcpkg_copy_tools] support copying .app bundles --- scripts/cmake/vcpkg_common_definitions.cmake | 15 +++++++++++++++ scripts/cmake/vcpkg_copy_tools.cmake | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index e53d9396354171..c031af40fb7260 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -9,6 +9,8 @@ VCPKG_HOST_IS_ with being one of the following: VCPKG_HOST_PATH_SEPARATOR Host specific path separator (USAGE: "${VCPKG_HOST_PATH_SEPARATOR}"; only use and pass variables with VCPKG_HOST_PATH_SEPARATOR within "") VCPKG_HOST_EXECUTABLE_SUFFIX executable suffix of the host VCPKG_TARGET_EXECUTABLE_SUFFIX executable suffix of the target +VCPKG_HOST_BUNDLE_SUFFIX bundle suffix of the host +VCPKG_TARGET_BUNDLE_SUFFIX bundle suffix of the target VCPKG_TARGET_STATIC_LIBRARY_PREFIX static library prefix for target (same as CMAKE_STATIC_LIBRARY_PREFIX) VCPKG_TARGET_STATIC_LIBRARY_SUFFIX static library suffix for target (same as CMAKE_STATIC_LIBRARY_SUFFIX) VCPKG_TARGET_SHARED_LIBRARY_PREFIX shared library prefix for target (same as CMAKE_SHARED_LIBRARY_PREFIX) @@ -88,6 +90,19 @@ else() set(VCPKG_TARGET_EXECUTABLE_SUFFIX "") endif() +#Helper variables to identify bundles on host/target +if(VCPKG_HOST_IS_OSX) + set(VCPKG_HOST_BUNDLE_SUFFIX ".app") +else() + set(VCPKG_HOST_BUNDLE_SUFFIX "") +endif() + +if(VCPKG_HOST_IS_OSX) + set(VCPKG_TARGET_BUNDLE_SUFFIX ".app") +else() + set(VCPKG_TARGET_BUNDLE_SUFFIX "") +endif() + #Helper variables for libraries if(VCPKG_TARGET_IS_MINGW) set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a") diff --git a/scripts/cmake/vcpkg_copy_tools.cmake b/scripts/cmake/vcpkg_copy_tools.cmake index ef3259840ccf02..ec289723e7a9aa 100644 --- a/scripts/cmake/vcpkg_copy_tools.cmake +++ b/scripts/cmake/vcpkg_copy_tools.cmake @@ -54,8 +54,11 @@ function(vcpkg_copy_tools) endif() foreach(tool_name IN LISTS arg_TOOL_NAMES) - set(tool_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + set(tool_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_BUNDLE_SUFFIX}") set(tool_pdb "${arg_SEARCH_DIR}/${tool_name}.pdb") + if(NOT EXISTS "${tool_path}") + set(tool_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + endif() if(EXISTS "${tool_path}") file(COPY "${tool_path}" DESTINATION "${arg_DESTINATION}") else() From 310f8dd9d655ff8523e9e6cc1f3d89029f4ea59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wro=CC=81bel?= Date: Wed, 22 Sep 2021 14:32:49 +0300 Subject: [PATCH 2/5] check for VCPKG_TARGET_IS_OSX --- scripts/cmake/vcpkg_common_definitions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index c031af40fb7260..40c8183f1bbb0c 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -97,7 +97,7 @@ else() set(VCPKG_HOST_BUNDLE_SUFFIX "") endif() -if(VCPKG_HOST_IS_OSX) +if(VCPKG_TARGET_IS_OSX) set(VCPKG_TARGET_BUNDLE_SUFFIX ".app") else() set(VCPKG_TARGET_BUNDLE_SUFFIX "") From 46412519e9c2ee42b2b52dcd8f9bb86f0d7113fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wro=CC=81bel?= Date: Thu, 23 Sep 2021 15:28:32 +0300 Subject: [PATCH 3/5] Fix formatting --- docs/maintainers/vcpkg_common_definitions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/maintainers/vcpkg_common_definitions.md b/docs/maintainers/vcpkg_common_definitions.md index 2e1037af5f50bc..b96dd3cbc5e56e 100644 --- a/docs/maintainers/vcpkg_common_definitions.md +++ b/docs/maintainers/vcpkg_common_definitions.md @@ -10,6 +10,8 @@ VCPKG_HOST_IS_ with being one of the following: VCPKG_HOST_PATH_SEPARATOR Host specific path separator (USAGE: "${VCPKG_HOST_PATH_SEPARATOR}"; only use and pass variables with VCPKG_HOST_PATH_SEPARATOR within "") VCPKG_HOST_EXECUTABLE_SUFFIX executable suffix of the host VCPKG_TARGET_EXECUTABLE_SUFFIX executable suffix of the target +VCPKG_HOST_BUNDLE_SUFFIX bundle suffix of the host +VCPKG_TARGET_BUNDLE_SUFFIX bundle suffix of the target VCPKG_TARGET_STATIC_LIBRARY_PREFIX static library prefix for target (same as CMAKE_STATIC_LIBRARY_PREFIX) VCPKG_TARGET_STATIC_LIBRARY_SUFFIX static library suffix for target (same as CMAKE_STATIC_LIBRARY_SUFFIX) VCPKG_TARGET_SHARED_LIBRARY_PREFIX shared library prefix for target (same as CMAKE_SHARED_LIBRARY_PREFIX) From d278d5619f4cdfff617989537a4ec741ef1e5c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wro=CC=81bel?= Date: Fri, 24 Sep 2021 19:17:37 +0300 Subject: [PATCH 4/5] [vcpkg_copy_tools] copy bundle and plain bin if both present --- scripts/cmake/vcpkg_copy_tools.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/cmake/vcpkg_copy_tools.cmake b/scripts/cmake/vcpkg_copy_tools.cmake index ec289723e7a9aa..6d3ad35e9b79ea 100644 --- a/scripts/cmake/vcpkg_copy_tools.cmake +++ b/scripts/cmake/vcpkg_copy_tools.cmake @@ -54,13 +54,18 @@ function(vcpkg_copy_tools) endif() foreach(tool_name IN LISTS arg_TOOL_NAMES) - set(tool_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_BUNDLE_SUFFIX}") + set(tool_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}") set(tool_pdb "${arg_SEARCH_DIR}/${tool_name}.pdb") - if(NOT EXISTS "${tool_path}") - set(tool_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}") - endif() if(EXISTS "${tool_path}") file(COPY "${tool_path}" DESTINATION "${arg_DESTINATION}") + elseif(VCPKG_TARGET_BUNDLE_SUFFIX AND NOT "${VCPKG_TARGET_BUNDLE_SUFFIX}" STREQUAL "${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + set(bundle_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_BUNDLE_SUFFIX}") + if(EXISTS "${bundle_path}") + file(COPY "${bundle_path}" DESTINATION "${arg_DESTINATION}") + else() + message(FATAL_ERROR "Couldn't find tool \"${tool_name}\": + neither \"${tool_path}\" nor \"${bundle_path}\" exists") + endif() else() message(FATAL_ERROR "Couldn't find tool \"${tool_name}\": \"${tool_path}\" does not exist") From 71bfc7bfb8cde4755bcefa5cd8b8a77ca6e4ed58 Mon Sep 17 00:00:00 2001 From: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com> Date: Fri, 1 Oct 2021 14:28:03 -0700 Subject: [PATCH 5/5] Update scripts/cmake/vcpkg_copy_tools.cmake --- scripts/cmake/vcpkg_copy_tools.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cmake/vcpkg_copy_tools.cmake b/scripts/cmake/vcpkg_copy_tools.cmake index 6d3ad35e9b79ea..af4a457ffee24d 100644 --- a/scripts/cmake/vcpkg_copy_tools.cmake +++ b/scripts/cmake/vcpkg_copy_tools.cmake @@ -58,7 +58,7 @@ function(vcpkg_copy_tools) set(tool_pdb "${arg_SEARCH_DIR}/${tool_name}.pdb") if(EXISTS "${tool_path}") file(COPY "${tool_path}" DESTINATION "${arg_DESTINATION}") - elseif(VCPKG_TARGET_BUNDLE_SUFFIX AND NOT "${VCPKG_TARGET_BUNDLE_SUFFIX}" STREQUAL "${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + elseif(NOT "${VCPKG_TARGET_BUNDLE_SUFFIX}" STREQUAL "" AND NOT "${VCPKG_TARGET_BUNDLE_SUFFIX}" STREQUAL "${VCPKG_TARGET_EXECUTABLE_SUFFIX}") set(bundle_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_BUNDLE_SUFFIX}") if(EXISTS "${bundle_path}") file(COPY "${bundle_path}" DESTINATION "${arg_DESTINATION}")