diff options
| author | Silvio Traversaro <silvio.traversaro@iit.it> | 2020-06-24 23:59:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-24 14:59:32 -0700 |
| commit | 70ab27fcad50241d72e0fe235ec4012f0ce7551e (patch) | |
| tree | cccbd72ff215dcf3b66ae9d3aed2c61a8ebee693 /scripts | |
| parent | 7ced7d721e3e1da8f0df8634370f5698ec7a6e12 (diff) | |
| download | vcpkg-70ab27fcad50241d72e0fe235ec4012f0ce7551e.tar.gz vcpkg-70ab27fcad50241d72e0fe235ec4012f0ce7551e.zip | |
[ignition-plugin1] Add new port 🤖 (#11275)
* [ignition-plugin1] Add new port
* vcpkg_fixup_cmake_targets: Add DO_NOT_DELETE_PARENT_CONFIG_PATH
By default the vcpkg_fixup_cmake_targets script remove the parent
path of CONFIG_PATH if it named "cmake", this behaviour is not convenient
for ports that install more than one CMake package config file, and
for which vcpkg_fixup_cmake_targets is invoked multiple times.
To optionally disable this behaviour, this commit adds the option
DO_NOT_DELETE_PARENT_CONFIG_PATH to vcpkg_fixup_cmake_targets.
* [ignition-modularscripts] Add support for ignition libraries that install multiple CMake package config files
Some ignition libraries install several CMake package config files,
to represent the different components of the library. This commit modifies
the ignition_modular_library function to fixup correctly all the cmake package config files.
* vcpkg_fixup_pkgconfig: Move definition of SYSTEM_LIBRARIES to vcpkg_common_definitions
To correctly validate installed pkg-config files, vcpkg_fixup_pkgconfig needs to know
for each platform which libraries are not managed by vcpkg. This commits improve this
definitions for all the triplet supported by vcpkg, and move this definition to vcpkg_common_definitions
in a way that permit custom triplets to overload its value.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/cmake/vcpkg_common_definitions.cmake | 20 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 17 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_fixup_pkgconfig.cmake | 4 |
3 files changed, 33 insertions, 8 deletions
diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index 724644abc..ee6f34849 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -16,6 +16,7 @@ ## VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX import library suffix for target (same as CMAKE_IMPORT_LIBRARY_SUFFIX) ## VCPKG_FIND_LIBRARY_PREFIXES target dependent prefixes used for find_library calls in portfiles ## VCPKG_FIND_LIBRARY_SUFFIXES target dependent suffixes used for find_library calls in portfiles +## VCPKG_SYSTEM_LIBRARIES list of libraries are provide by the toolchain and are not managed by vcpkg ## ``` ## ## CMAKE_STATIC_LIBRARY_(PREFIX|SUFFIX), CMAKE_SHARED_LIBRARY_(PREFIX|SUFFIX) and CMAKE_IMPORT_LIBRARY_(PREFIX|SUFFIX) are defined for the target @@ -111,3 +112,22 @@ set(CMAKE_IMPORT_LIBRARY_PREFIX "${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX}") set(CMAKE_FIND_LIBRARY_SUFFIXES "${VCPKG_FIND_LIBRARY_SUFFIXES}" CACHE INTERNAL "") # Required by find_library set(CMAKE_FIND_LIBRARY_PREFIXES "${VCPKG_FIND_LIBRARY_PREFIXES}" CACHE INTERNAL "") # Required by find_library + +# Append platform libraries to VCPKG_SYSTEM_LIBRARIES +# The variable are just appended to permit to custom triplets define the variable + +# Platforms with libdl +if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX) + list(APPEND VCPKG_SYSTEM_LIBRARIES dl) +endif() + +# Platforms with libm +if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD) + list(APPEND VCPKG_SYSTEM_LIBRARIES m) +endif() + +# Windows system libs +if(VCPKG_TARGET_IS_WINDOWS) + list(APPEND VCPKG_SYSTEM_LIBRARIES wsock32) + list(APPEND VCPKG_SYSTEM_LIBRARIES ws2_32) +endif() diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index b2faa4abe..ec5ea05f5 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -6,7 +6,7 @@ ## ## ## Usage ## ```cmake -## vcpkg_fixup_cmake_targets([CONFIG_PATH <share/${PORT}>] [TARGET_PATH <share/${PORT}>]) +## vcpkg_fixup_cmake_targets([CONFIG_PATH <share/${PORT}>] [TARGET_PATH <share/${PORT}>] [DO_NOT_DELETE_PARENT_CONFIG_PATH]) ## ``` ## ## ## Parameters @@ -22,6 +22,11 @@ ## ## Defaults to `share/${PORT}`. ## +## ### DO_NOT_DELETE_PARENT_CONFIG_PATH +## By default the parent directory of CONFIG_PATH is removed if it is named "cmake". +## Passing this option disable such behavior, as it is convenient for ports that install +## more than one CMake package configuration file. +## ## ## 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`. @@ -38,7 +43,7 @@ ## * [curl](https://github.com/Microsoft/vcpkg/blob/master/ports/curl/portfile.cmake) ## * [nlohmann-json](https://github.com/Microsoft/vcpkg/blob/master/ports/nlohmann-json/portfile.cmake) function(vcpkg_fixup_cmake_targets) - cmake_parse_arguments(_vfct "" "CONFIG_PATH;TARGET_PATH" "" ${ARGN}) + cmake_parse_arguments(_vfct "DO_NOT_DELETE_PARENT_CONFIG_PATH" "CONFIG_PATH;TARGET_PATH" "" ${ARGN}) if(_vfct_UNPARSED_ARGUMENTS) message(FATAL_ERROR "vcpkg_fixup_cmake_targets was passed extra arguments: ${_vfct_UNPARSED_ARGUMENTS}") @@ -85,13 +90,13 @@ function(vcpkg_fixup_cmake_targets) if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") get_filename_component(DEBUG_CONFIG_DIR_NAME ${DEBUG_CONFIG} NAME) string(TOLOWER "${DEBUG_CONFIG_DIR_NAME}" DEBUG_CONFIG_DIR_NAME) - if(DEBUG_CONFIG_DIR_NAME STREQUAL "cmake") + if(DEBUG_CONFIG_DIR_NAME STREQUAL "cmake" AND NOT _vfct_DO_NOT_DELETE_PARENT_CONFIG_PATH) file(REMOVE_RECURSE ${DEBUG_CONFIG}) else() get_filename_component(DEBUG_CONFIG_PARENT_DIR ${DEBUG_CONFIG} DIRECTORY) get_filename_component(DEBUG_CONFIG_DIR_NAME ${DEBUG_CONFIG_PARENT_DIR} NAME) string(TOLOWER "${DEBUG_CONFIG_DIR_NAME}" DEBUG_CONFIG_DIR_NAME) - if(DEBUG_CONFIG_DIR_NAME STREQUAL "cmake") + if(DEBUG_CONFIG_DIR_NAME STREQUAL "cmake" AND NOT _vfct_DO_NOT_DELETE_PARENT_CONFIG_PATH) file(REMOVE_RECURSE ${DEBUG_CONFIG_PARENT_DIR}) endif() endif() @@ -99,13 +104,13 @@ function(vcpkg_fixup_cmake_targets) get_filename_component(RELEASE_CONFIG_DIR_NAME ${RELEASE_CONFIG} NAME) string(TOLOWER "${RELEASE_CONFIG_DIR_NAME}" RELEASE_CONFIG_DIR_NAME) - if(RELEASE_CONFIG_DIR_NAME STREQUAL "cmake") + if(RELEASE_CONFIG_DIR_NAME STREQUAL "cmake" AND NOT _vfct_DO_NOT_DELETE_PARENT_CONFIG_PATH) file(REMOVE_RECURSE ${RELEASE_CONFIG}) else() get_filename_component(RELEASE_CONFIG_PARENT_DIR ${RELEASE_CONFIG} DIRECTORY) get_filename_component(RELEASE_CONFIG_DIR_NAME ${RELEASE_CONFIG_PARENT_DIR} NAME) string(TOLOWER "${RELEASE_CONFIG_DIR_NAME}" RELEASE_CONFIG_DIR_NAME) - if(RELEASE_CONFIG_DIR_NAME STREQUAL "cmake") + if(RELEASE_CONFIG_DIR_NAME STREQUAL "cmake" AND NOT _vfct_DO_NOT_DELETE_PARENT_CONFIG_PATH) file(REMOVE_RECURSE ${RELEASE_CONFIG_PARENT_DIR}) endif() endif() diff --git a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake index 1256bef4a..a5495a423 100644 --- a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake +++ b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake @@ -194,8 +194,8 @@ endfunction() function(vcpkg_fixup_pkgconfig) cmake_parse_arguments(_vfpkg "" "" "RELEASE_FILES;DEBUG_FILES;SYSTEM_LIBRARIES;SYSTEM_PACKAGES;IGNORE_FLAGS" ${ARGN}) - if(VCPKG_TARGET_IS_LINUX) - list(APPEND _vfpkg_SYSTEM_LIBRARIES -ldl -lm) + if(VCPKG_SYSTEM_LIBRARIES) + list(APPEND _vfpkg_SYSTEM_LIBRARIES ${VCPKG_SYSTEM_LIBRARIES}) endif() message(STATUS "Fixing pkgconfig") if(_vfpkg_UNPARSED_ARGUMENTS) |
