From e4ce6370667e05a0b2338c720ada9a23c9555843 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 12 May 2020 00:44:34 +0200 Subject: [PATCH] =?UTF-8?q?[sdformat9]=20Add=20new=20port=20=F0=9F=A4=96?= =?UTF-8?q?=20(#11265)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [sdformat9] Add new port * Update ports/sdformat9/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/sdformat9/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/sdformat9/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * [sdformat9] Fix indent Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/sdformat9/CONTROL | 6 + ports/sdformat9/portfile.cmake | 43 +++++ ports/sdformat9/respect-build-testing.patch | 182 ++++++++++++++++++++ scripts/ci.baseline.txt | 3 + 4 files changed, 234 insertions(+) create mode 100644 ports/sdformat9/CONTROL create mode 100644 ports/sdformat9/portfile.cmake create mode 100644 ports/sdformat9/respect-build-testing.patch diff --git a/ports/sdformat9/CONTROL b/ports/sdformat9/CONTROL new file mode 100644 index 000000000..2242dfcab --- /dev/null +++ b/ports/sdformat9/CONTROL @@ -0,0 +1,6 @@ +Source: sdformat9 +Version: 9.2.0 +Homepage: http://sdformat.org/ +Build-Depends: ignition-math6, urdfdom, tinyxml +Description: Simulation Description Format (SDF) parser and description files. +Supports: !(linux|uwp) \ No newline at end of file diff --git a/ports/sdformat9/portfile.cmake b/ports/sdformat9/portfile.cmake new file mode 100644 index 000000000..828f04525 --- /dev/null +++ b/ports/sdformat9/portfile.cmake @@ -0,0 +1,43 @@ +vcpkg_fail_port_install(ON_TARGET "linux" "uwp") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO osrf/sdformat + REF sdformat9_9.2.0 + SHA512 6fc7d0ce46d9a7d1cae4fd905ebe6a07bb4ba98faa267be92a32b3409d6d82a99d5082485008a15484f7b5be2c347b5b24bc472fb1a4be5eb8b678b105cae6af + HEAD_REF sdf9 + # Backport of https://github.com/osrf/sdformat/pull/269 + PATCHES respect-build-testing.patch +) + +# Ruby is required by the sdformat build process +vcpkg_find_acquire_program(RUBY) +get_filename_component(RUBY_PATH ${RUBY} DIRECTORY) +set(_path $ENV{PATH}) +vcpkg_add_to_path(${RUBY_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_TESTING=OFF + -DUSE_EXTERNAL_URDF=ON + -DUSE_EXTERNAL_TINYXML=ON +) + +vcpkg_install_cmake() + +# Restore original path +set(ENV{PATH} ${_path}) + +# Fix cmake targets and pkg-config file location +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/sdformat9") +vcpkg_fixup_pkgconfig() + +# Remove debug files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/lib/cmake + ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/sdformat9/respect-build-testing.patch b/ports/sdformat9/respect-build-testing.patch new file mode 100644 index 000000000..8509b91ea --- /dev/null +++ b/ports/sdformat9/respect-build-testing.patch @@ -0,0 +1,182 @@ +From f31b1d65e0cc550d37ff9f67a01af055534282d0 Mon Sep 17 00:00:00 2001 +From: Silvio +Date: Sat, 2 May 2020 12:39:02 +0200 +Subject: [PATCH] If defined observe the CMake variable BUILD_TESTING + +For backward compatibility if it is not defined compile the tests + +Signed-off-by: Silvio +--- + CMakeLists.txt | 10 +++- + src/CMakeLists.txt | 136 +++++++++++++++++++++++---------------------- + 2 files changed, 78 insertions(+), 68 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c0b934f9..38a71649 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -265,7 +265,15 @@ else (build_errors) + + link_directories(${PROJECT_BINARY_DIR}/src) + +- add_subdirectory(test) ++ if (NOT DEFINED BUILD_TESTING OR BUILD_TESTING) ++ set(BUILD_SDF_TEST TRUE) ++ else() ++ set(BUILD_SDF_TEST FALSE) ++ endif() ++ ++ if (BUILD_SDF_TEST) ++ add_subdirectory(test) ++ endif() + add_subdirectory(src) + add_subdirectory(include/sdf) + add_subdirectory(sdf) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 7dbb9536..c283a00a 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -91,74 +91,76 @@ else() + include_directories(${URDF_INCLUDE_DIRS}) + endif() + +-set (gtest_sources +- Actor_TEST.cc +- AirPressure_TEST.cc +- Altimeter_TEST.cc +- Atmosphere_TEST.cc +- Box_TEST.cc +- Camera_TEST.cc +- Collision_TEST.cc +- Console_TEST.cc +- Cylinder_TEST.cc +- Element_TEST.cc +- Error_TEST.cc +- Exception_TEST.cc +- Frame_TEST.cc +- Filesystem_TEST.cc +- Geometry_TEST.cc +- Gui_TEST.cc +- Imu_TEST.cc +- Joint_TEST.cc +- JointAxis_TEST.cc +- Lidar_TEST.cc +- Light_TEST.cc +- Link_TEST.cc +- Magnetometer_TEST.cc +- Material_TEST.cc +- Mesh_TEST.cc +- Model_TEST.cc +- Noise_TEST.cc +- parser_urdf_TEST.cc +- Param_TEST.cc +- parser_TEST.cc +- Pbr_TEST.cc +- Physics_TEST.cc +- Plane_TEST.cc +- Root_TEST.cc +- Scene_TEST.cc +- SemanticPose_TEST.cc +- SDF_TEST.cc +- Sensor_TEST.cc +- Sphere_TEST.cc +- Surface_TEST.cc +- Types_TEST.cc +- Visual_TEST.cc +- World_TEST.cc +-) +- +-# Build this test file only if Ignition Tools is installed. +-if (IGNITION-TOOLS_BINARY_DIRS) +- set (gtest_sources ${gtest_sources} +- ign_TEST.cc ++if (BUILD_SDF_TEST) ++ set (gtest_sources ++ Actor_TEST.cc ++ AirPressure_TEST.cc ++ Altimeter_TEST.cc ++ Atmosphere_TEST.cc ++ Box_TEST.cc ++ Camera_TEST.cc ++ Collision_TEST.cc ++ Console_TEST.cc ++ Cylinder_TEST.cc ++ Element_TEST.cc ++ Error_TEST.cc ++ Exception_TEST.cc ++ Frame_TEST.cc ++ Filesystem_TEST.cc ++ Geometry_TEST.cc ++ Gui_TEST.cc ++ Imu_TEST.cc ++ Joint_TEST.cc ++ JointAxis_TEST.cc ++ Lidar_TEST.cc ++ Light_TEST.cc ++ Link_TEST.cc ++ Magnetometer_TEST.cc ++ Material_TEST.cc ++ Mesh_TEST.cc ++ Model_TEST.cc ++ Noise_TEST.cc ++ parser_urdf_TEST.cc ++ Param_TEST.cc ++ parser_TEST.cc ++ Pbr_TEST.cc ++ Physics_TEST.cc ++ Plane_TEST.cc ++ Root_TEST.cc ++ Scene_TEST.cc ++ SemanticPose_TEST.cc ++ SDF_TEST.cc ++ Sensor_TEST.cc ++ Sphere_TEST.cc ++ Surface_TEST.cc ++ Types_TEST.cc ++ Visual_TEST.cc ++ World_TEST.cc + ) +-endif() +- +-sdf_build_tests(${gtest_sources}) +- +-if (NOT WIN32) +- set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Utils.cc) +- sdf_build_tests(Utils_TEST.cc) +-endif() +- +-if (NOT WIN32) +- set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS FrameSemantics.cc) +- sdf_build_tests(FrameSemantics_TEST.cc) +-endif() +- +-if (NOT WIN32) +- set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc) +- sdf_build_tests(Converter_TEST.cc) ++ ++ # Build this test file only if Ignition Tools is installed. ++ if (IGNITION-TOOLS_BINARY_DIRS) ++ set (gtest_sources ${gtest_sources} ++ ign_TEST.cc ++ ) ++ endif() ++ ++ sdf_build_tests(${gtest_sources}) ++ ++ if (NOT WIN32) ++ set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Utils.cc) ++ sdf_build_tests(Utils_TEST.cc) ++ endif() ++ ++ if (NOT WIN32) ++ set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS FrameSemantics.cc) ++ sdf_build_tests(FrameSemantics_TEST.cc) ++ endif() ++ ++ if (NOT WIN32) ++ set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc) ++ sdf_build_tests(Converter_TEST.cc) ++ endif() + endif() + + sdf_add_library(${sdf_target} ${sources}) diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index bf962053a..a366fb7d4 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1645,6 +1645,9 @@ sdformat6:arm64-windows=fail sdformat6:arm-uwp=fail sdformat6:x64-uwp=fail sdformat6:x64-linux=ignore +sdformat9:x64-linux=fail +sdformat9:arm-uwp=fail +sdformat9:x64-uwp=fail sdl1:arm-uwp=fail sdl1:x64-uwp=fail sdl1:x64-osx=fail