diff options
| -rw-r--r-- | docs/maintainers/vcpkg_fixup_cmake_targets.md | 7 | ||||
| -rw-r--r-- | ports/ignition-modularscripts/CONTROL | 2 | ||||
| -rw-r--r-- | ports/ignition-modularscripts/ignition_modular_library.cmake | 18 | ||||
| -rw-r--r-- | ports/ignition-plugin1/CONTROL | 5 | ||||
| -rw-r--r-- | ports/ignition-plugin1/portfile.cmake | 7 | ||||
| -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 |
8 files changed, 67 insertions, 13 deletions
diff --git a/docs/maintainers/vcpkg_fixup_cmake_targets.md b/docs/maintainers/vcpkg_fixup_cmake_targets.md index 5abd7c622..18e8d0867 100644 --- a/docs/maintainers/vcpkg_fixup_cmake_targets.md +++ b/docs/maintainers/vcpkg_fixup_cmake_targets.md @@ -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`. diff --git a/ports/ignition-modularscripts/CONTROL b/ports/ignition-modularscripts/CONTROL index 4dd2ac418..efde5f1b4 100644 --- a/ports/ignition-modularscripts/CONTROL +++ b/ports/ignition-modularscripts/CONTROL @@ -1,3 +1,3 @@ Source: ignition-modularscripts
-Version: 2020-05-09
+Version: 2020-05-16
Description: Vcpkg helpers to package ignition libraries
diff --git a/ports/ignition-modularscripts/ignition_modular_library.cmake b/ports/ignition-modularscripts/ignition_modular_library.cmake index 8b04d8177..f7b772d5f 100644 --- a/ports/ignition-modularscripts/ignition_modular_library.cmake +++ b/ports/ignition-modularscripts/ignition_modular_library.cmake @@ -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) diff --git a/ports/ignition-plugin1/CONTROL b/ports/ignition-plugin1/CONTROL new file mode 100644 index 000000000..ba3aa4c31 --- /dev/null +++ b/ports/ignition-plugin1/CONTROL @@ -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
diff --git a/ports/ignition-plugin1/portfile.cmake b/ports/ignition-plugin1/portfile.cmake new file mode 100644 index 000000000..daa626047 --- /dev/null +++ b/ports/ignition-plugin1/portfile.cmake @@ -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)
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) |
