mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 14:53:02 +08:00
[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.
This commit is contained in:
parent
7ced7d721e
commit
70ab27fcad
@ -6,7 +6,7 @@ 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}>])
|
||||
vcpkg_fixup_cmake_targets([CONFIG_PATH <share/${PORT}>] [TARGET_PATH <share/${PORT}>] [DO_NOT_DELETE_PARENT_CONFIG_PATH])
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@ -22,6 +22,11 @@ This needs to be specified if the port name differs from the `find_package()` na
|
||||
|
||||
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`.
|
||||
|
@ -1,3 +1,3 @@
|
||||
Source: ignition-modularscripts
|
||||
Version: 2020-05-09
|
||||
Version: 2020-05-16
|
||||
Description: Vcpkg helpers to package ignition libraries
|
||||
|
@ -10,7 +10,18 @@ function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PAC
|
||||
|
||||
# If necessary, move the CMake config files
|
||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake")
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/${CMAKE_PACKAGE_NAME}" TARGET_PATH "share/${CMAKE_PACKAGE_NAME}")
|
||||
# Some ignition libraries install library subcomponents, that are effectively additional cmake packages
|
||||
# with name ${CMAKE_PACKAGE_NAME}-${COMPONENT_NAME}, so it is needed to call vcpkg_fixup_cmake_targets for them as well
|
||||
file(GLOB COMPONENTS_CMAKE_PACKAGE_NAMES
|
||||
LIST_DIRECTORIES TRUE
|
||||
RELATIVE "${CURRENT_PACKAGES_DIR}/lib/cmake/"
|
||||
"${CURRENT_PACKAGES_DIR}/lib/cmake/*")
|
||||
|
||||
foreach(COMPONENT_CMAKE_PACKAGE_NAME IN LISTS COMPONENTS_CMAKE_PACKAGE_NAMES)
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/${COMPONENT_CMAKE_PACKAGE_NAME}"
|
||||
TARGET_PATH "share/${COMPONENT_CMAKE_PACKAGE_NAME}"
|
||||
DO_NOT_DELETE_PARENT_CONFIG_PATH)
|
||||
endforeach()
|
||||
|
||||
file(GLOB_RECURSE CMAKE_RELEASE_FILES
|
||||
"${CURRENT_PACKAGES_DIR}/lib/cmake/${CMAKE_PACKAGE_NAME}/*")
|
||||
@ -19,8 +30,9 @@ function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PAC
|
||||
"${CURRENT_PACKAGES_DIR}/share/${CMAKE_PACKAGE_NAME}/")
|
||||
endif()
|
||||
|
||||
# Remove debug files
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
|
||||
# Remove unused files files
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake
|
||||
${CURRENT_PACKAGES_DIR}/debug/include
|
||||
${CURRENT_PACKAGES_DIR}/debug/lib/cmake
|
||||
${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
|
5
ports/ignition-plugin1/CONTROL
Normal file
5
ports/ignition-plugin1/CONTROL
Normal file
@ -0,0 +1,5 @@
|
||||
Source: ignition-plugin1
|
||||
Version: 1.1.0
|
||||
Homepage: https://ignitionrobotics.org/libs/plugin
|
||||
Build-Depends: dlfcn-win32 (windows|uwp), ignition-cmake2, ignition-modularscripts
|
||||
Description: Library for registering plugin libraries and dynamically loading them at runtime
|
7
ports/ignition-plugin1/portfile.cmake
Normal file
7
ports/ignition-plugin1/portfile.cmake
Normal file
@ -0,0 +1,7 @@
|
||||
include(${CURRENT_INSTALLED_DIR}/share/ignitionmodularscripts/ignition_modular_library.cmake)
|
||||
|
||||
set(PACKAGE_VERSION "1.1.0")
|
||||
ignition_modular_library(NAME plugin
|
||||
VERSION ${PACKAGE_VERSION}
|
||||
REF "ignition-plugin_${PACKAGE_VERSION}"
|
||||
SHA512 0657c5816e67d02329a79364050b8a56957180e5b7481b01696c7369b063cbfedfc93793a8ad92d87d242d24e476283dc7847bd810a3de98d3ec5ae7d640568c)
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user