Skip to content

Commit

Permalink
[ignition-fuel-tools1] Add new port (#8136)
Browse files Browse the repository at this point in the history
Add new port for the ignition-fuel-tools version 1, part
of the Ignition Robotics Libraries (https://ignitionrobotics.org/).
  • Loading branch information
traversaro authored and cbezault committed Sep 26, 2019
1 parent 2f4cb2d commit 4afc873
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ports/ignition-cmake0/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: ignition-cmake0
Version: 0.6.2
Version: 0.6.2-1
Homepage: https://ignitionrobotics.org/libs/cmake
Description: CMake helper functions for building robotic applications
Build-Depends: ignition-modularscripts
Expand Down
16 changes: 16 additions & 0 deletions ports/ignition-cmake0/fix-find-ign-curl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff -r 3276aecbcbb4 -r 33b5d95affd2 cmake/FindIgnCURL.cmake
--- a/cmake/FindIgnCURL.cmake
+++ b/cmake/FindIgnCURL.cmake
@@ -46,6 +46,12 @@

# Older versions of curl don't create imported targets, so we will create
# them here if they have not been provided.
+ if(TARGET CURL::libcurl AND NOT TARGET curl::curl)
+ add_library(curl::curl INTERFACE IMPORTED)
+ set_target_properties(curl::curl PROPERTIES
+ INTERFACE_LINK_LIBRARIES CURL::libcurl)
+ endif()
+
include(IgnImportTarget)

if(NOT TARGET curl::curl)
2 changes: 2 additions & 0 deletions ports/ignition-cmake0/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ignition_modular_library(NAME cmake
support-arm64.patch
# Do not depend on pkg-config installed to find uuid
uuid-do-not-require-pkg-config.patch
# Fix FindIgnCURL.cmake (backport of https://bitbucket.org/ignitionrobotics/ign-cmake/pull-requests/175)
fix-find-ign-curl.patch
)

# Permit empty include folder
Expand Down
4 changes: 4 additions & 0 deletions ports/ignition-fuel-tools1/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Source: ignition-fuel-tools1
Version: 1.2.0
Build-Depends: curl, ignition-cmake0, ignition-common1, libyaml, libzip, jsoncpp
Description: Tools for using fuel API to download robot models
24 changes: 24 additions & 0 deletions ports/ignition-fuel-tools1/link-correct-yaml-target.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff -r 29939b8a25be -r 8a0a85e63950 CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,7 +9,7 @@
# Find ignition-cmake
#============================================================================
# If you get an error at this line, you need to install ignition-cmake
-find_package(ignition-cmake0 REQUIRED)
+find_package(ignition-cmake0 0.4.1 REQUIRED)

#============================================================================
# Configure the project
diff -r 29939b8a25be -r 8a0a85e63950 src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -52,7 +52,7 @@
curl::curl
ignition-common${IGN_COMMON_MAJOR_VER}::ignition-common${IGN_COMMON_MAJOR_VER}
${JSONCPP_TARGET}
- YAML::YAML
+ ${YAML_TARGET}
ZIP::ZIP
)

10 changes: 10 additions & 0 deletions ports/ignition-fuel-tools1/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include(vcpkg_common_functions)

include(${CURRENT_INSTALLED_DIR}/share/ignitionmodularscripts/ignition_modular_library.cmake)

ignition_modular_library(NAME fuel-tools
VERSION "1.2.0"
CMAKE_PACKAGE_NAME ignition-fuel_tools1
SHA512 5ed8d1429e1f5c0716e06840a4163f7e79a614cf7b6ff326adb69d35639e3ec5f1862edc41c6dc0bd21b16db6d13bee509831a66b10ca2ae3999649f1554a68e
# Ensure yaml is correctly linked (backport of https://bitbucket.org/ignitionrobotics/ign-fuel-tools/pull-requests/103/use-yaml_target-instead-of-yaml-yaml/diff)
PATCHES link-correct-yaml-target.patch)
2 changes: 1 addition & 1 deletion ports/ignition-modularscripts/CONTROL
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Source: ignition-modularscripts
Version: 2019-08-20
Version: 2019-09-11
Description: Vcpkg helpers to package ignition libraries
31 changes: 22 additions & 9 deletions ports/ignition-modularscripts/ignition_modular_library.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH)
function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH CMAKE_PACKAGE_NAME DEFAULT_CMAKE_PACKAGE_NAME)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
Expand All @@ -8,21 +8,23 @@ function(ignition_modular_build_library NAME MAJOR_VERSION SOURCE_PATH)

vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/ignition-${NAME}${MAJOR_VERSION}")
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/${CMAKE_PACKAGE_NAME}" TARGET_PATH "share/${CMAKE_PACKAGE_NAME}")

file(GLOB_RECURSE CMAKE_RELEASE_FILES
"${CURRENT_PACKAGES_DIR}/lib/cmake/ignition-${NAME}${MAJOR_VERSION}/*")
"${CURRENT_PACKAGES_DIR}/lib/cmake/${CMAKE_PACKAGE_NAME}/*")

file(COPY ${CMAKE_RELEASE_FILES} DESTINATION
"${CURRENT_PACKAGES_DIR}/share/ignition-${NAME}${MAJOR_VERSION}/")
"${CURRENT_PACKAGES_DIR}/share/${CMAKE_PACKAGE_NAME}/")

# Remove debug files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/lib/cmake
${CURRENT_PACKAGES_DIR}/debug/share)



# Post-build test for cmake libraries
vcpkg_test_cmake(PACKAGE_NAME ignition-${NAME}${MAJOR_VERSION})
vcpkg_test_cmake(PACKAGE_NAME ${CMAKE_PACKAGE_NAME})

# Find the relevant license file and install it
if(EXISTS "${SOURCE_PATH}/LICENSE")
Expand Down Expand Up @@ -67,20 +69,25 @@ endfunction()
##
## ### PATCHES
## A list of patches to be applied to the extracted sources.
## This is forwarded to the `vcpkg_from_bitbucket` command.
## This is forwarded to the `vcpkg_from_bitbucket` command.
##
## ### CMAKE_PACKAGE_NAME
## The name of the CMake package for the port.
## If not specified, defaults to `ignition-${NAME}${MAJOR_VERSION}`.
##
## ## Examples:
##
## * [ignition-cmake0](https://github.com/Microsoft/vcpkg/blob/master/ports/ignition-cmake0/portfile.cmake)
## * [ignition-math4](https://github.com/Microsoft/vcpkg/blob/master/ports/ignition-math4/portfile.cmake)
## * [ignition-fuel-tools1](https://github.com/Microsoft/vcpkg/blob/master/ports/ignition-fuel-tools1/portfile.cmake)
function(ignition_modular_library)
set(oneValueArgs NAME VERSION SHA512 REF HEAD_REF)
set(oneValueArgs NAME VERSION SHA512 REF HEAD_REF CMAKE_PACKAGE_NAME)
set(multiValueArgs PATCHES)
cmake_parse_arguments(IML "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

string(REPLACE "." ";" IML_VERSION_LIST ${IML_VERSION})
list(GET IML_VERSION_LIST 0 IML_MAJOR_VERSION)

# If the REF option is omitted, use the canonical one
if(NOT DEFINED IML_REF)
set(IML_REF "ignition-${IML_NAME}${IML_MAJOR_VERSION}_${IML_VERSION}")
Expand All @@ -90,6 +97,12 @@ function(ignition_modular_library)
if(NOT DEFINED IML_HEAD_REF)
set(IML_HEAD_REF "ign-${IML_NAME}${IML_MAJOR_VERSION}")
endif()

# If the CMAKE_PACKAGE_NAME option is omitted, use the canonical one
set(DEFAULT_CMAKE_PACKAGE_NAME "ignition-${IML_NAME}${IML_MAJOR_VERSION}")
if(NOT DEFINED IML_CMAKE_PACKAGE_NAME)
set(IML_CMAKE_PACKAGE_NAME ${DEFAULT_CMAKE_PACKAGE_NAME})
endif()

# Download library from bitbucket, to support also the --head option
vcpkg_from_bitbucket(
Expand All @@ -102,5 +115,5 @@ function(ignition_modular_library)
)

# Build library
ignition_modular_build_library(${IML_NAME} ${IML_MAJOR_VERSION} ${SOURCE_PATH})
ignition_modular_build_library(${IML_NAME} ${IML_MAJOR_VERSION} ${SOURCE_PATH} ${IML_CMAKE_PACKAGE_NAME} ${DEFAULT_CMAKE_PACKAGE_NAME})
endfunction()

0 comments on commit 4afc873

Please sign in to comment.