sdformat/sdformat-1.4.10-urdfdom.patch
2013-11-21 22:48:49 -05:00

69 lines
2.1 KiB
Diff

diff -up ./cmake/SearchForStuff.cmake.urdfdom ./cmake/SearchForStuff.cmake
--- ./cmake/SearchForStuff.cmake.urdfdom 2013-11-08 18:54:46.000000000 -0500
+++ ./cmake/SearchForStuff.cmake 2013-11-18 20:58:38.478461983 -0500
@@ -24,3 +24,28 @@ else ()
"tinyxml include paths. Use this to override automatic detection.")
set (tinyxml_libraries "tinyxml" CACHE INTERNAL "tinyxml libraries")
endif ()
+
+################################################
+# Find urdfdom parser
+pkg_check_modules(URDF urdfdom)
+if (NOT URDF_FOUND)
+ set(HAVE_URDF OFF)
+else()
+ set (HAVE_URDF ON)
+endif()
+
+################################################
+# Find gtest
+find_package(GTest)
+if (GTEST_FOUND)
+ set(GTEST_LIBRARY ${GTEST_LIBRARIES})
+ set(GTEST_MAIN_LIBRARY ${GTEST_MAIN_LIBRARIES})
+ set(GTEST_INCLUDE_DIR ${GTEST_INCLUDE_DIRS})
+else()
+ add_library(gtest STATIC "${PROJECT_SOURCE_DIR}/test/gtest/src/gtest-all.cc")
+ add_library(gtest_main STATIC "${PROJECT_SOURCE_DIR}/test/gtest/src/gtest_main.cc")
+ target_link_libraries(gtest_main gtest)
+ set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a")
+ set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a")
+ set(GTEST_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/test/gtest/include")
+endif()
diff -up ./src/CMakeLists.txt.urdfdom ./src/CMakeLists.txt
--- ./src/CMakeLists.txt.urdfdom 2013-11-08 18:54:46.000000000 -0500
+++ ./src/CMakeLists.txt 2013-11-18 20:49:03.148208553 -0500
@@ -15,6 +15,13 @@ set (sources
parser_urdf.cc
Param.cc
SDF.cc
+)
+
+if (HAVE_URDF)
+ include_directories(${URDF_INCLUDE_DIRS})
+else(HAVE_URDF)
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/urdf)
+ set(sources ${sources}
urdf/urdf_parser/model.cpp
urdf/urdf_parser/link.cpp
urdf/urdf_parser/joint.cpp
@@ -24,6 +31,7 @@ set (sources
urdf/urdf_parser/urdf_sensor.cpp
urdf/urdf_parser/world.cpp
)
+endif(HAVE_URDF)
set (gtest_sources
SDF_TEST.cc
@@ -38,4 +46,10 @@ target_link_libraries(sdformat
${tinyxml_libraries}
${Boost_LIBRARIES}
)
+if (HAVE_URDF)
+ target_link_libraries(sdformat
+ ${URDF_LIBRARIES}
+ )
+endif(HAVE_URDF)
+
sdf_install_library(sdformat)