-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10a66c8
commit 7d3ca20
Showing
15 changed files
with
858 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,78 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
cmake_minimum_required(VERSION 3.8) | ||
project(eddie_platform_control) | ||
|
||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
project(PackageName) | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) | ||
|
||
option(ENABLE_DOC "Build documentation" Off) | ||
option(ENABLE_TESTS "Build unit tests" Off) | ||
option(ENABLE_PACKAGE_REGISTRY "Add this package to CMake's package registry" Off) | ||
|
||
add_subdirectory(src) | ||
|
||
if(ENABLE_TESTS) | ||
message(STATUS "Building tests") | ||
enable_testing() | ||
add_subdirectory(test) | ||
endif() | ||
|
||
if(ENABLE_DOC) | ||
# Find Doxygen package | ||
find_package(Doxygen REQUIRED) | ||
|
||
# Set Doxygen variables | ||
set(DOXYGEN_GENERATE_HTML YES) # Enable HTML documentation generation | ||
set(DOXYGEN_GENERATE_XML NO) # Disable XML output (optional, depends on your needs) | ||
set(DOXYGEN_EXCLUDE "test/*") # Optionally exclude test folders from documentation | ||
|
||
# Set the paths for the input sources and the output directory | ||
set(DOXYGEN_INPUT_DIR "${CMAKE_SOURCE_DIR}/src") # Path to source code directory | ||
set(DOXYGEN_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include") # Path to include directory | ||
set(DOXYGEN_README "${CMAKE_SOURCE_DIR}/README.md") # Path to README.md | ||
set(DOXYGEN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/docs") # Output directory for the docs | ||
set(HTML_EXTRA_STYLESHEET "${CMAKE_SOURCE_DIR}/docs/styles/doxy.css") # Path to custom CSS | ||
set(HTML_HEADER "${CMAKE_SOURCE_DIR}/docs/styles/doxy_header.html") # Path to custom header | ||
|
||
# Ensure that the output directory exists | ||
file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) | ||
|
||
# Provide path to Doxygen config file | ||
set(DOXYGEN_CONFIG_FILE "${CMAKE_SOURCE_DIR}/Doxyfile.in") # Path to your Doxygen configuration | ||
|
||
# Check if Doxygen configuration file exists | ||
if(EXISTS "${DOXYGEN_CONFIG_FILE}") | ||
message(STATUS "Doxygen config file found: ${DOXYGEN_CONFIG_FILE}") | ||
else() | ||
message(FATAL_ERROR "Doxygen config file not found!") | ||
endif() | ||
|
||
# Modify the Doxyfile variables in the CMakeLists.txt | ||
configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY) | ||
|
||
# Add custom target to generate docs using Doxygen | ||
add_custom_target( | ||
docs | ||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
COMMENT "Generating API documentation with Doxygen" | ||
VERBATIM) | ||
# Default to C++17 | ||
if(NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 17) | ||
endif() | ||
|
||
# Export this package to CMake's package registry | ||
if(ENABLE_PACKAGE_REGISTRY) | ||
export(PACKAGE ${PROJECT_NAME}) | ||
# Find dependencies | ||
find_package(ament_cmake REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(visualization_msgs REQUIRED) | ||
find_package(tf2 REQUIRED) | ||
find_package(nav_msgs REQUIRED) | ||
find_package(gazebo_msgs REQUIRED) | ||
find_package(kelo_tulip REQUIRED) | ||
find_package(tf2_geometry_msgs REQUIRED) | ||
find_package(Boost REQUIRED COMPONENTS thread) | ||
|
||
# Optional documentation build | ||
option(BUILD_DOC "Build documentation" OFF) | ||
if(BUILD_DOC) | ||
find_package(Doxygen) | ||
if(DOXYGEN_FOUND) | ||
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/config/doxygen/Doxyfile.in) | ||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) | ||
|
||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) | ||
|
||
add_custom_target(doc_doxygen ALL | ||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
COMMENT "Generating API documentation with Doxygen" | ||
VERBATIM) | ||
else() | ||
message("Doxygen needs to be installed to generate documentation") | ||
endif() | ||
endif() | ||
|
||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file( | ||
${PROJECT_NAME}-config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_DIR}) | ||
|
||
# Generate the version file for the config file | ||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" | ||
VERSION "0.1.0" | ||
COMPATIBILITY AnyNewerVersion) | ||
|
||
# Install cmake configuration and package version | ||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" | ||
DESTINATION ${CMAKE_INSTALL_DIR}) | ||
|
||
# Make the targets accessible from this packages's build tree | ||
export( | ||
EXPORT ${PROJECT_NAME}-targets | ||
NAMESPACE ${PROJECT_NAME}:: | ||
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake") | ||
|
||
# Make the targets accessible from this packages's install tree | ||
install( | ||
EXPORT ${PROJECT_NAME}-targets | ||
NAMESPACE ${PROJECT_NAME}:: | ||
DESTINATION ${CMAKE_INSTALL_DIR}) | ||
|
||
# Install all public header files | ||
install( | ||
DIRECTORY include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
FILES_MATCHING | ||
PATTERN "*.h" | ||
PATTERN "*.hpp") | ||
# Include directories | ||
include_directories( | ||
include | ||
${kelo_tulip_INCLUDE_DIRS} | ||
) | ||
|
||
# Executable | ||
add_executable(kelo_gazebo_platform_controller | ||
src/KeloDrive.cpp | ||
src/PlatformController.cpp | ||
src/main.cpp | ||
) | ||
|
||
# Link libraries | ||
ament_target_dependencies(kelo_gazebo_platform_controller | ||
rclcpp | ||
visualization_msgs | ||
tf2 | ||
tf2_geometry_msgs | ||
nav_msgs | ||
kelo_tulip | ||
Boost | ||
gazebo_msgs | ||
) | ||
|
||
# Install directories | ||
install(DIRECTORY | ||
launch | ||
DESTINATION share/${PROJECT_NAME} | ||
) | ||
|
||
# Install executable | ||
install(TARGETS | ||
kelo_gazebo_platform_controller | ||
DESTINATION lib/${PROJECT_NAME} | ||
) | ||
|
||
# Necessary for ament_package() | ||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.