-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vcpkg] Add new function vcpkg_copy_tools (#8749)
* [vcpkg] Add new function vcpkg_copy_tools * [cpuinfo][czmq][nanomsg][uriparser] Use vcpkg_copy_tools * [czmq] Clean even tools are not copied [libsvm][zyre] Use vcpkg_copy_tools * [vcpkg-copy-tools] Clean debug/bin This should fix czmq build error * [czmq] czmq does not have BUILD_TOOLS option * [vcpkg] Split clean logic into another function * [cpuinfo][czmq][nanomsg][uriparser] Fix calling of vcpkg_copy_tools * [zyre] Fix regression error * [vcpkg] Update try_remove_empty_directory * [libsvm] Fix vcpkg_copy_tools call
- Loading branch information
Showing
19 changed files
with
192 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# vcpkg_clean_executables_in_bin | ||
|
||
Remove specified executables found in `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_DIR}/debug/bin`. If, after all specified executables have been removed, and the `bin` and `debug/bin` directories are empty, then also delete `bin` and `debug/bin` directories. | ||
|
||
## Usage | ||
```cmake | ||
vcpkg_clean_executables_in_bin( | ||
FILE_NAMES <file1>... | ||
) | ||
``` | ||
|
||
## Parameters | ||
### FILE_NAMES | ||
A list of executable filenames without extension. | ||
|
||
## Notes | ||
Generally, there is no need to call this function manually. Instead, pass an extra `AUTO_CLEAN` argument when calling `vcpkg_copy_tools`. | ||
|
||
## Examples | ||
* [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake) | ||
|
||
## Source | ||
[scripts/cmake/vcpkg_clean_executables_in_bin.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_clean_executables_in_bin.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# vcpkg_copy_tools | ||
|
||
Copy tools and all their DLL dependencies into the `tools` folder. | ||
|
||
## Usage | ||
```cmake | ||
vcpkg_copy_tools( | ||
TOOL_NAMES <tool1>... | ||
[SEARCH_DIR <${CURRENT_PACKAGES_DIR}/bin>] | ||
[AUTO_CLEAN] | ||
) | ||
``` | ||
## Parameters | ||
### TOOL_NAMES | ||
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. | ||
|
||
### AUTO_CLEAN | ||
Auto clean executables in `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_DIR}/debug/bin`. | ||
|
||
## Examples | ||
|
||
* [cpuinfo](https://github.com/microsoft/vcpkg/blob/master/ports/cpuinfo/portfile.cmake) | ||
* [nanomsg](https://github.com/microsoft/vcpkg/blob/master/ports/nanomsg/portfile.cmake) | ||
* [uriparser](https://github.com/microsoft/vcpkg/blob/master/ports/uriparser/portfile.cmake) | ||
|
||
## Source | ||
[scripts/cmake/vcpkg_copy_tools.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_copy_tools.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Source: zyre | ||
Version: 2019-07-07 | ||
Version: 2019-07-07-1 | ||
Build-Depends: czmq | ||
Description: An open-source framework for proximity-based peer-to-peer applications | ||
Homepage: https://github.com/zeromq/zyre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
## # vcpkg_clean_executables_in_bin | ||
## | ||
## Remove specified executables found in `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_DIR}/debug/bin`. If, after all specified executables have been removed, and the `bin` and `debug/bin` directories are empty, then also delete `bin` and `debug/bin` directories. | ||
## | ||
## ## Usage | ||
## ```cmake | ||
## vcpkg_clean_executables_in_bin( | ||
## FILE_NAMES <file1>... | ||
## ) | ||
## ``` | ||
## | ||
## ## Parameters | ||
## ### FILE_NAMES | ||
## A list of executable filenames without extension. | ||
## | ||
## ## Notes | ||
## Generally, there is no need to call this function manually. Instead, pass an extra `AUTO_CLEAN` argument when calling `vcpkg_copy_tools`. | ||
## | ||
## ## Examples | ||
## * [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake) | ||
function(vcpkg_clean_executables_in_bin) | ||
cmake_parse_arguments(_vct "" "" "FILE_NAMES" ${ARGN}) | ||
|
||
if(NOT DEFINED _vct_FILE_NAMES) | ||
message(FATAL_ERROR "FILE_NAMES must be specified.") | ||
endif() | ||
|
||
foreach(file_name ${_vct_FILE_NAMES}) | ||
file(REMOVE | ||
"${CURRENT_PACKAGES_DIR}/bin/${file_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}" | ||
"${CURRENT_PACKAGES_DIR}/debug/bin/${file_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}" | ||
) | ||
endforeach() | ||
|
||
function(try_remove_empty_directory directory) | ||
if(NOT EXISTS "${directory}") | ||
return() | ||
endif() | ||
|
||
if(NOT IS_DIRECTORY "${directory}") | ||
message(FATAL_ERROR "${directory} is supposed to be an existing directory.") | ||
endif() | ||
|
||
# TODO: | ||
# For an empty directory, | ||
# file(GLOB items "${directory}" "${directory}/*") | ||
# will return a list with one item. | ||
file(GLOB items "${directory}/" "${directory}/*") | ||
list(LENGTH items items_count) | ||
|
||
if(${items_count} EQUAL 0) | ||
file(REMOVE_RECURSE "${directory}") | ||
endif() | ||
endfunction() | ||
|
||
try_remove_empty_directory("${CURRENT_PACKAGES_DIR}/bin") | ||
try_remove_empty_directory("${CURRENT_PACKAGES_DIR}/debug/bin") | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.