From f1bef4aa7ca7e2a6ea4f5dfe4850d95fce60b431 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 15 Sep 2020 02:13:33 +0200 Subject: [PATCH] [dartsim] Add new port (#13320) * [dartsim] Add new port * Update vcpkg.json * Update vcpkg.json * Update vcpkg.json --- ports/dartsim/1478.patch | 25 ++++++++++++++++++ ports/dartsim/1497.patch | 50 ++++++++++++++++++++++++++++++++++++ ports/dartsim/portfile.cmake | 40 +++++++++++++++++++++++++++++ ports/dartsim/vcpkg.json | 25 ++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 ports/dartsim/1478.patch create mode 100644 ports/dartsim/1497.patch create mode 100644 ports/dartsim/portfile.cmake create mode 100644 ports/dartsim/vcpkg.json diff --git a/ports/dartsim/1478.patch b/ports/dartsim/1478.patch new file mode 100644 index 0000000000..ce6dbd1268 --- /dev/null +++ b/ports/dartsim/1478.patch @@ -0,0 +1,25 @@ +From 6d03ee61c38e2b07b2dbb85f0ba61d2a76956e3b Mon Sep 17 00:00:00 2001 +From: Steve Peters +Date: Fri, 24 Jul 2020 17:24:42 -0700 +Subject: [PATCH] Don't force CMAKE_INSTALL_PREFIX on windows + +Fixes #1477. + +Signed-off-by: Steve Peters +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6552bedc162..47df721559b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,7 +51,7 @@ initialize_component_helpers(${PROJECT_NAME}) + + # System install paths on Windows + if(WIN32) +- set(CMAKE_INSTALL_PREFIX "C:/Golems" CACHE PATH "Install prefix" FORCE) ++ set(CMAKE_INSTALL_PREFIX "C:/Golems" CACHE PATH "Install prefix") + endif() + + #=============================================================================== diff --git a/ports/dartsim/1497.patch b/ports/dartsim/1497.patch new file mode 100644 index 0000000000..3f2b6b5b31 --- /dev/null +++ b/ports/dartsim/1497.patch @@ -0,0 +1,50 @@ +From 9fde9124927789ca2399f99c1be9b101ed1e8550 Mon Sep 17 00:00:00 2001 +From: Silvio Traversaro +Date: Thu, 3 Sep 2020 17:28:01 +0200 +Subject: [PATCH] CMake: Add DART_SKIP_ advanced option + +Add DART_SKIP_ option to permit to specify that +a dependecy should not used even if it is found in the system. +--- + cmake/DARTMacros.cmake | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/cmake/DARTMacros.cmake b/cmake/DARTMacros.cmake +index 8b1a89292ee..409b02bd742 100644 +--- a/cmake/DARTMacros.cmake ++++ b/cmake/DARTMacros.cmake +@@ -127,7 +127,9 @@ endfunction() + + #=============================================================================== + macro(dart_check_optional_package variable component dependency) +- if(${${variable}_FOUND}) ++ option(DART_SKIP_${variable} "If ON, do not use ${variable} even if it is found." OFF) ++ mark_as_advanced(DART_SKIP_${variable}) ++ if(${${variable}_FOUND} AND NOT ${DART_SKIP_${variable}}) + set(HAVE_${variable} TRUE CACHE BOOL "Check if ${variable} found." FORCE) + if(DART_VERBOSE) + message(STATUS "Looking for ${dependency} - version ${${variable}_VERSION}" +@@ -135,12 +137,17 @@ macro(dart_check_optional_package variable component dependency) + endif() + else() + set(HAVE_${variable} FALSE CACHE BOOL "Check if ${variable} found." FORCE) +- if(ARGV3) # version +- message(STATUS "Looking for ${dependency} - NOT found, to use" +- " ${component}, please install ${dependency} (>= ${ARGV3})") +- else() +- message(STATUS "Looking for ${dependency} - NOT found, to use" +- " ${component}, please install ${dependency}") ++ if(NOT ${${variable}_FOUND}) ++ if(ARGV3) # version ++ message(STATUS "Looking for ${dependency} - NOT found, to use" ++ " ${component}, please install ${dependency} (>= ${ARGV3})") ++ else() ++ message(STATUS "Looking for ${dependency} - NOT found, to use" ++ " ${component}, please install ${dependency}") ++ endif() ++ elseif(${DART_SKIP_${variable}} AND DART_VERBOSE) ++ message(STATUS "Not using ${dependency} - version ${${variable}_VERSION}" ++ " even if found because DART_SKIP_${variable} is ON.") + endif() + return() + endif() diff --git a/ports/dartsim/portfile.cmake b/ports/dartsim/portfile.cmake new file mode 100644 index 0000000000..0af5f8e9aa --- /dev/null +++ b/ports/dartsim/portfile.cmake @@ -0,0 +1,40 @@ +# Shared library support is broken upstream (https://github.com/dartsim/dart/issues/1005#issuecomment-375406260) +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO dartsim/dart + REF v6.9.4 + SHA512 a9e8712a294286772ee1e3c3899aac7d202f1d3c2b9242ebeaddb2a142787b192d5421a6e3f889dd9ff9ca9e9106b1f893a0c8ab2e1656b04fac6d0be13494ba + HEAD_REF release-6.9 + PATCHES 1478.patch + 1497.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS -DDART_VERBOSE=ON + -DDART_MSVC_DEFAULT_OPTIONS=ON + -DDART_SKIP_DOXYGEN=ON + -DDART_SKIP_FLANN=ON + -DDART_SKIP_IPOPT=ON + -DDART_SKIP_NLOPT=ON + -DDART_SKIP_OPENGL=ON + -DDART_SKIP_pagmo=ON +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH share/dart/cmake TARGET_PATH share/dart) + +# Remove pkg-config file as they are broken upstream (https://github.com/dartsim/dart/issues/1496) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/dartsim RENAME copyright) + diff --git a/ports/dartsim/vcpkg.json b/ports/dartsim/vcpkg.json new file mode 100644 index 0000000000..874754b878 --- /dev/null +++ b/ports/dartsim/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "dartsim", + "version-string": "9.4.0", + "description": "Dynamic Animation and Robotics Toolkit", + "homepage": "https://dartsim.github.io/", + "dependencies": [ + "assimp", + "boost-algorithm", + "boost-filesystem", + "boost-functional", + "boost-lexical-cast", + "boost-math", + "boost-optional", + "boost-regex", + "boost-system", + "bullet3", + "ccd", + "eigen3", + "fcl", + "octomap", + "ode", + "tinyxml2", + "urdfdom" + ] +}