Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthou committed Aug 9, 2024
2 parents cfec24e + 3ba1c0f commit b3b425a
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ launch.json

# CMake
*.cmake
!cmake/*.cmake
*.bin
build/
61 changes: 58 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ endif()

include(cmake/Sanitizers.cmake)

# add_compile_options(-DONTO_ROS_VERSION=$ENV{ROS_VERSION})
function(add_onto_library TARGET)
if(NOT TARGET)
message(FATAL_ERROR "Expected the target name as first argument")
Expand Down Expand Up @@ -121,6 +120,7 @@ if($ENV{ROS_VERSION} STREQUAL "1")
LIBRARIES ontologenius_lib ontologenius_interface
CATKIN_DEPENDS roscpp rospy std_msgs
DEPENDS TinyXML OpenCV
CFG_EXTRAS ontologenius_compatConfigExtras.cmake
)
elseif($ENV{ROS_VERSION} STREQUAL "2")
ament_export_dependencies(rosidl_default_runtime pluginlib)
Expand Down Expand Up @@ -231,7 +231,10 @@ function(add_ros_library TARGET)

if($ENV{ROS_VERSION} STREQUAL "1")
add_dependencies(${TARGET} ontologenius_gencpp ${catkin_EXPORTED_TARGETS})
target_include_directories(${TARGET} PUBLIC include ${catkin_INCLUDE_DIRS})
target_include_directories(${TARGET} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${catkin_INCLUDE_DIRS})
target_link_libraries(${TARGET} PUBLIC ${catkin_LIBRARIES}) # PRIVATE has been removed fot ontoloGUI
elseif($ENV{ROS_VERSION} STREQUAL "2")
ament_target_dependencies(${TARGET} PUBLIC rclcpp pluginlib builtin_interfaces std_msgs)
Expand Down Expand Up @@ -464,11 +467,49 @@ target_include_directories(ontoloGUI PUBLIC include)
# # Install ##
# ##################################
if($ENV{ROS_VERSION} STREQUAL "1")
install(TARGETS ontoloGUI RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
# Generate CMake package config file
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/ontologenius_compatConfigIntermediate.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ontologenius_compatConfigIntermediate.cmake
INSTALL_DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ontologenius_compatConfigIntermediate.cmake
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake
)

install(
TARGETS ontologenius_compat
EXPORT ontologenius_compatTargets
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)

# Install the target file
install(
EXPORT ontologenius_compatTargets
FILE ontologenius_compatTargets.cmake
NAMESPACE ontologenius::
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake
)

install(TARGETS
ontoloGUI
ontologenius_single
ontologenius_multi
ontologenius_draw
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

install(TARGETS
ontologenius_lib
ontologenius_interface
ontologenius_compat
ontologenius_operators
ontologenius_feeder_lib
ontologenius_plugin_lib
ontologenius_ontoGraphs_lib
ontologenius_reasoner_plugin
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
Expand All @@ -481,6 +522,12 @@ if($ENV{ROS_VERSION} STREQUAL "1")
PATTERN ".svn" EXCLUDE
)

install(DIRECTORY include/${PROJECT_NAME}/API/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)

install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
Expand All @@ -489,6 +536,14 @@ if($ENV{ROS_VERSION} STREQUAL "1")
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/files
)

install(DIRECTORY configuration/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/configuration
)

install(FILES reasoners_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

elseif($ENV{ROS_VERSION} STREQUAL "2")
install(TARGETS
ontologenius_lib
Expand Down
1 change: 1 addition & 0 deletions cmake/ontologenius_compatConfigExtras.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/ontologenius_compatConfigIntermediate.cmake)
Empty file.
33 changes: 33 additions & 0 deletions cmake/ontologenius_compatConfigIntermediate.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@PACKAGE_INIT@

# Handle transitive dependencies
# No dependencies for now
# include(CMakeFindDependencyMacro)
# find_dependency(Boost REQUIRED)

FUNCTION(PREPEND var prefix)
SET(listVar "")
FOREACH(f ${ARGN})
LIST(APPEND listVar "${prefix}/${f}")
ENDFOREACH(f)
SET(${var} "${listVar}" PARENT_SCOPE)
ENDFUNCTION(PREPEND)

# Components that are always including
if (NOT "ontologenius_compat" IN_LIST ontologenius_compat_FIND_COMPONENTS)
set(ontologenius_compat_FIND_COMPONENTS "ontologenius_compat" ${ontologenius_compat_FIND_COMPONENTS})
#list(PREPEND ontologenius_compat_FIND_COMPONENTS "ontologenius_compat")
endif()

foreach(component ${ontologenius_compat_FIND_COMPONENTS})
# For requested component, execute its "config" script
include(
${CMAKE_CURRENT_LIST_DIR}/${component}Targets.cmake
RESULT_VARIABLE ontologenius_compat_${component}_FOUND
)
endforeach()

# No macro file for now
# include("${CMAKE_CURRENT_LIST_DIR}/ontologenius_compatMacros.cmake")

check_required_components(ontologenius_compat)

0 comments on commit b3b425a

Please sign in to comment.