diff --git a/interfaces/ros1/wavemap/CMakeLists.txt b/interfaces/ros1/wavemap/CMakeLists.txt index 6c157c5a2..996b3fdb3 100644 --- a/interfaces/ros1/wavemap/CMakeLists.txt +++ b/interfaces/ros1/wavemap/CMakeLists.txt @@ -27,8 +27,8 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../library/cpp # Include the library's tests in catkin's run_tests target include(cmake/append_to_catkin_tests.cmake) -append_to_catkin_tests(test_wavemap_io) append_to_catkin_tests(test_wavemap_core) +append_to_catkin_tests(test_wavemap_io) # Support installs # Mark targets for installation @@ -38,6 +38,6 @@ install(TARGETS wavemap_core wavemap_io wavemap_pipeline RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) # Mark headers for installation install(DIRECTORY - ${CMAKE_CURRENT_SOURCE_DIR}/../../../library/cpp/include/wavemap/ + "${CMAKE_CURRENT_SOURCE_DIR}/../../../library/cpp/include/wavemap/" DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} FILES_MATCHING PATTERN "*.h") diff --git a/library/cpp/CMakeLists.txt b/library/cpp/CMakeLists.txt index 39c81ec8d..400cf4c41 100644 --- a/library/cpp/CMakeLists.txt +++ b/library/cpp/CMakeLists.txt @@ -11,6 +11,7 @@ option(BUILD_SHARED_LIBS option(USE_SYSTEM_EIGEN "Use system pre-installed Eigen" ON) option(USE_SYSTEM_GLOG "Use system pre-installed glog" ON) option(USE_SYSTEM_BOOST "Use system pre-installed Boost" ON) +option(TRACY_ENABLE "Enable profiling with Tracy" OFF) # CMake helpers and general wavemap tooling (e.g. to run clang-tidy CI) include(GNUInstallDirs) diff --git a/library/cpp/cmake/find-wavemap-deps.cmake b/library/cpp/cmake/find-wavemap-deps.cmake index 695f0c98e..195945ec3 100644 --- a/library/cpp/cmake/find-wavemap-deps.cmake +++ b/library/cpp/cmake/find-wavemap-deps.cmake @@ -55,4 +55,14 @@ else () endif () # Optional dependencies -find_package(tracy QUIET) +if (TRACY_ENABLE) + find_package(Tracy QUIET) + if (NOT Tracy_FOUND) + message(FATAL_ERROR + "Profiling is enabled (TRACY_ENABLE=ON), but Tracy is not available. " + "Please switch it to OFF or install Tracy as a system package with: " + "cmake -S . -B build -DTRACY_ENABLE=ON -DBUILD_SHARED_LIBS=true " + "-DCMAKE_BUILD_TYPE=Release && cmake --build build --parallel && " + "sudo make install") + endif () +endif () diff --git a/library/cpp/cmake/wavemap-extras.cmake b/library/cpp/cmake/wavemap-extras.cmake index 33aa2e3cb..2cdae7cdf 100644 --- a/library/cpp/cmake/wavemap-extras.cmake +++ b/library/cpp/cmake/wavemap-extras.cmake @@ -38,6 +38,11 @@ function(set_wavemap_target_properties target) # General C++ defines target_compile_definitions(${target} PUBLIC EIGEN_INITIALIZE_MATRICES_BY_NAN) + # Profiling related C++ defines + if (TRACY_ENABLE) + target_compile_definitions(${target} PUBLIC TRACY_ENABLE) + endif () + # Conditional compilation options if (DCHECK_ALWAYS_ON) target_compile_definitions(${target} PUBLIC DCHECK_ALWAYS_ON) diff --git a/library/cpp/src/core/CMakeLists.txt b/library/cpp/src/core/CMakeLists.txt index a48abab05..00f39baa6 100644 --- a/library/cpp/src/core/CMakeLists.txt +++ b/library/cpp/src/core/CMakeLists.txt @@ -7,8 +7,8 @@ set_wavemap_target_properties(wavemap_core) add_wavemap_include_directories(wavemap_core) target_link_libraries(wavemap_core PUBLIC Eigen3::Eigen glog Boost::preprocessor) -if (tracy_FOUND) - target_link_libraries(wavemap_core PUBLIC TracyClient) +if (Tracy_FOUND) + target_link_libraries(wavemap_core PUBLIC TracyClient dl) endif () # Set sources