From 1aa216092b2437329df063a3062647f90556ed54 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Tue, 6 Jul 2021 14:29:39 +0200 Subject: [PATCH] Provide default for Ubuntu Focal --- CMakeLists.txt | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a00da4c86..3faf36e1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,25 @@ ign_find_package(sdformat10 #-------------------------------------- # Find dartsim for the dartsim plugin wrapper -option(USE_VENDOR_DART "Use internal Open Robotics fork of vendor" BOOL) +# respect user explicit values and also provide a default value for Ubuntu Focal +# to make ground vehicles to work properly +set(DEFAULT_VENDOR_DART:BOOL OFF) +if(NOT DEFINED USE_VENDOR_DART) + if(LSB_RELEASE_EXEC) + execute_process(COMMAND ${LSB_RELEASE_EXEC} -rs + OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (LSB_RELEASE_ID_SHORT == "20.04") + message(STATUS "DETECTED Ubuntu 20.04, default USE_VENDOR_DART set to ON" + "to make ground vehicles to work properly") + set(DEFAULT_VENDOR_DART:BOOL ON) + endif() + endif() +endif() + +option(USE_VENDOR_DART "Use internal Open Robotics fork of DART" ${DEFAULT_VENDOR_DART}) + +find_program(LSB_RELEASE_EXEC lsb_release) if(USE_VENDOR_DART) include(ExternalProject) @@ -70,18 +88,26 @@ if(USE_VENDOR_DART) set(DART_VENDOR_INCLUDE_DIRS "${DART_VENDOR_INSTALL_DIR}/include") set(DART_VENDOR_LIBRARY_DIR "${DART_VENDOR_INSTALL_DIR}/lib") # Three libraries needed - set(DART_VENDOR_LIBRARY_PATH + set(DART_VENDOR_LIBRARY_PATH "${DART_VENDOR_LIBRARY_DIR}/libdart.so.6.10.0") + set(DART_VENDOR_LIBRARY_LINK_PATH + "${DART_VENDOR_LIBRARY_DIR}/libdart.so.6.10") add_library(dart SHARED IMPORTED) set_target_properties(dart PROPERTIES IMPORTED_LOCATION ${DART_VENDOR_LIBRARY_PATH}) + set(DART_ODEL_VENDOR_LIBRARY_PATH "${DART_VENDOR_LIBRARY_DIR}/libdart-external-odelcpsolver.so.6.10.0") + set(DART_ODEL_VENDOR_LIBRARY_LINK_PATH + "${DART_VENDOR_LIBRARY_DIR}/libdart-external-odelcpsolver.so.6.10") add_library(dart_external_odelcpsolver SHARED IMPORTED) set_target_properties(dart_external_odelcpsolver PROPERTIES IMPORTED_LOCATION ${DART_ODEL_VENDOR_LIBRARY_PATH}) + set(DART_COLLISION_VENDOR_LIBRARY_PATH "${DART_VENDOR_LIBRARY_DIR}/libdart-collision-ode.so.6.10.0") + set(DART_COLLISION_VENDOR_LIBRARY_LINK_PATH + "${DART_VENDOR_LIBRARY_DIR}/libdart-collision-ode.so.6.10") add_library(dart_collision_ode SHARED IMPORTED) set_target_properties(dart_collision_ode PROPERTIES IMPORTED_LOCATION ${DART_COLLISION_VENDOR_LIBRARY_PATH})