Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please CI #2

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 50 additions & 21 deletions beluga_vdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,18 @@ set(OPENVDB_CMAKE_MODULE_PATH
${OPENVDB_CMAKE_MODULE_PATH}
CACHE PATH "Path to OpenVDB CMake module")

add_library(${PROJECT_NAME} INTERFACE)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "Build type" FORCE)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(
-Wall
-Wconversion
-Wextra
-Werror
-Wpedantic)
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_options(${PROJECT_NAME} INTERFACE -fno-inline)
endif()
find_package(beluga REQUIRED)

find_package(Eigen3 REQUIRED NO_MODULE)
find_package(range-v3 REQUIRED)
find_package(Sophus REQUIRED)
find_package(TBB REQUIRED)
find_package(beluga REQUIRED)

if(NOT OPENVDB_CMAKE_MODULE_PATH)
file(
Expand Down Expand Up @@ -78,12 +65,42 @@ if(OPENVDB_CMAKE_MODULE_PATH)
list(POP_BACK CMAKE_MODULE_PATH)
endif()

add_library(${PROJECT_NAME} INTERFACE)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(
${PROJECT_NAME}
INTERFACE -Wall
-Wconversion
-Wextra
-Werror
-Wpedantic)
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_options(${PROJECT_NAME} INTERFACE -fno-inline)
endif()

target_include_directories(
${PROJECT_NAME}
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>)
target_link_libraries(${PROJECT_NAME} INTERFACE beluga::beluga OpenVDB::openvdb)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
target_compile_definitions(${PROJECT_NAME} INTERFACE EIGEN_NO_DEBUG
SOPHUS_USE_BASIC_LOGGING)

add_executable(clang_tidy_findable)
target_sources(clang_tidy_findable PRIVATE src/clang_tidy_findable.cpp)
target_link_libraries(clang_tidy_findable PRIVATE ${PROJECT_NAME})

option(BUILD_TESTING "Build the testing tree." ON)
if(BUILD_TESTING)
message(STATUS "Build testing enabled.")
enable_testing()
add_subdirectory(test)
endif()

install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})

install(
TARGETS ${PROJECT_NAME}
Expand All @@ -92,11 +109,23 @@ install(
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
set(INSTALL_CMAKEDIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/cmake)

option(BUILD_TESTING "Build the testing tree." ON)
if(BUILD_TESTING)
message(STATUS "Build testing enabled.")
enable_testing()
add_subdirectory(test)
endif()
install(
EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${INSTALL_CMAKEDIR})

include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${INSTALL_CMAKEDIR})
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
COMPATIBILITY SameMajorVersion)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${INSTALL_CMAKEDIR})
42 changes: 42 additions & 0 deletions beluga_vdb/cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(Eigen3 REQUIRED NO_MODULE)
find_dependency(range-v3 REQUIRED)
find_dependency(Sophus REQUIRED)
find_dependency(beluga REQUIRED)

set(OPENVDB_CMAKE_MODULE_PATH
${OPENVDB_CMAKE_MODULE_PATH}
CACHE PATH "Path to OpenVDB CMake module")

if(NOT OPENVDB_CMAKE_MODULE_PATH)
file(
GLOB_RECURSE
OPENVDB_MODULES
/usr/lib/*/FindOpenVDB.cmake
/usr/local/lib/*/FindOpenVDB.cmake)
list(LENGTH OPENVDB_MODULES NUM_OPENVDB_MODULES)
if(NUM_OPENVDB_MODULES EQUAL 1)
list(GET OPENVDB_MODULES 0 OPENVDB_MODULE)
get_filename_component(OPENVDB_CMAKE_MODULE_PATH ${OPENVDB_MODULE} DIRECTORY)
endif()
unset(NUM_OPENVDB_MODULES)
unset(OPENVDB_MODULES)
endif()

if(OPENVDB_CMAKE_MODULE_PATH)
list(APPEND CMAKE_MODULE_PATH ${OPENVDB_CMAKE_MODULE_PATH})
endif()

find_dependency(OpenVDB REQUIRED)

if(OPENVDB_CMAKE_MODULE_PATH)
list(POP_BACK CMAKE_MODULE_PATH)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

set(@PROJECT_NAME@_LIBRARIES @PROJECT_NAME@::@PROJECT_NAME@)

check_required_components($@PROJECT_NAME@)
27 changes: 27 additions & 0 deletions beluga_vdb/src/clang_tidy_findable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2022-2023 Ekumen, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*
* This file exists in this header-only library as a workaround for
* clang-tidy to find and process the headers, since all the source files
* inside the test folder are ignored.
* It will not be exported or installed with the rest of the targets of this
* library.
*/

#include <beluga/beluga.hpp>

int main() {
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ auto make_map(const double voxel_size, const std::vector<T>& world_points) {
}

// Check grid
openvdb::tools::CheckLevelSet<GridT> checker(*grid);
const openvdb::tools::CheckLevelSet<GridT> checker(*grid);
// Check inactive values have a magnitude equal to the background value
assert(checker.checkInactiveValues() == "");

Expand Down
2 changes: 1 addition & 1 deletion tools/run-clang-tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ COLCON_EXTRA_ARGS=""
if [ "${ROS_DISTRO}" != "noetic" ]; then
ROS_PACKAGES="beluga beluga_ros beluga_amcl beluga_system_tests"
if [ "${ROS_DISTRO}" != "humble" ] && [ "${ROS_DISTRO}" != "iron" ]; then
ROS_PACKAGES="beluga beluga_ros beluga_amcl beluga_system_tests beluga_tools beluga_vdb"
ROS_PACKAGES="beluga beluga_ros beluga_amcl beluga_system_tests beluga_vdb"
fi
else
ROS_PACKAGES="beluga beluga_ros beluga_amcl"
Expand Down