diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c2c48e..4abcf4a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,12 +38,12 @@ jobs: with: package-name: | scitos2 + scitos2_behavior_tree scitos2_common scitos2_core - scitos2_msgs - scitos2_modules scitos2_mira - scitos2_behavior_tree + scitos2_modules + scitos2_msgs target-ros2-distro: humble colcon-defaults: | { diff --git a/scitos2_behavior_tree/CMakeLists.txt b/scitos2_behavior_tree/CMakeLists.txt index 6102d25..a2c6f89 100644 --- a/scitos2_behavior_tree/CMakeLists.txt +++ b/scitos2_behavior_tree/CMakeLists.txt @@ -1,6 +1,16 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.5) project(scitos2_behavior_tree) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to Release as none was specified.") + set(CMAKE_BUILD_TYPE "Release" CACHE + STRING "Choose the type of build." FORCE) + + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + # Default to C++17 if(NOT CMAKE_CXX_STANDARD) if("cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES) @@ -11,10 +21,18 @@ if(NOT CMAKE_CXX_STANDARD) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference) + # add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference) + add_compile_options(-Wall -Wextra -Wpedantic -Wdeprecated -fPIC -Wshadow -Wnull-dereference) add_compile_options("$<$:-Wnon-virtual-dtor>") endif() +option(COVERAGE_ENABLED "Enable code coverage" FALSE) +if(COVERAGE_ENABLED) + add_compile_options(--coverage) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") +endif() + # ############################################### # # Find dependencies ## # ############################################### @@ -97,6 +115,7 @@ if(BUILD_TESTING) # the following line skips the linter which checks for copyrights set(ament_cmake_copyright_FOUND TRUE) ament_lint_auto_find_test_dependencies() + find_package(ament_cmake_gtest REQUIRED) add_subdirectory(test) endif() diff --git a/scitos2_core/CMakeLists.txt b/scitos2_core/CMakeLists.txt index 71a7e6a..591ba10 100644 --- a/scitos2_core/CMakeLists.txt +++ b/scitos2_core/CMakeLists.txt @@ -1,6 +1,16 @@ cmake_minimum_required(VERSION 3.5) project(scitos2_core) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to Release as none was specified.") + set(CMAKE_BUILD_TYPE "Release" CACHE + STRING "Choose the type of build." FORCE) + + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + # Default to C++17 if(NOT CMAKE_CXX_STANDARD) if("cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES) @@ -15,6 +25,13 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options("$<$:-Wnon-virtual-dtor>") endif() +option(COVERAGE_ENABLED "Enable code coverage" FALSE) +if(COVERAGE_ENABLED) + add_compile_options(--coverage) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") +endif() + # ############################################### # # Find dependencies ## # ############################################### diff --git a/scitos2_mira/CMakeLists.txt b/scitos2_mira/CMakeLists.txt index 11cbaee..3baa2b5 100644 --- a/scitos2_mira/CMakeLists.txt +++ b/scitos2_mira/CMakeLists.txt @@ -1,6 +1,16 @@ cmake_minimum_required(VERSION 3.5) project(scitos2_mira) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to Release as none was specified.") + set(CMAKE_BUILD_TYPE "Release" CACHE + STRING "Choose the type of build." FORCE) + + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + # Default to C++17 if(NOT CMAKE_CXX_STANDARD) if("cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES) @@ -12,10 +22,17 @@ endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") # add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference) - add_compile_options(-Wall -Wextra) + add_compile_options(-Wall -Wextra -Wpedantic -Wdeprecated -fPIC -Wshadow -Wnull-dereference) add_compile_options("$<$:-Wnon-virtual-dtor>") endif() +option(COVERAGE_ENABLED "Enable code coverage" FALSE) +if(COVERAGE_ENABLED) + add_compile_options(--coverage) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") +endif() + # ############################################### # # Find dependencies ## # ############################################### @@ -100,6 +117,7 @@ if(BUILD_TESTING) # the following line skips the linter which checks for copyrights set(ament_cmake_copyright_FOUND TRUE) ament_lint_auto_find_test_dependencies() + find_package(ament_cmake_gtest REQUIRED) add_subdirectory(test) endif() diff --git a/scitos2_mira/test/test_mira_framework.cpp b/scitos2_mira/test/test_mira_framework.cpp index 1860433..1bd4488 100644 --- a/scitos2_mira/test/test_mira_framework.cpp +++ b/scitos2_mira/test/test_mira_framework.cpp @@ -17,6 +17,7 @@ #include "rclcpp/rclcpp.hpp" #include #include "lifecycle_msgs/msg/state.hpp" +#include "nav2_util/lifecycle_node.hpp" #include "nav2_util/node_utils.hpp" #include "scitos2_mira/mira_framework.hpp" #include "scitos2_core/module.hpp" diff --git a/scitos2_modules/CMakeLists.txt b/scitos2_modules/CMakeLists.txt index 8304c84..69bf7b8 100644 --- a/scitos2_modules/CMakeLists.txt +++ b/scitos2_modules/CMakeLists.txt @@ -1,6 +1,16 @@ cmake_minimum_required(VERSION 3.5) project(scitos2_modules) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to Release as none was specified.") + set(CMAKE_BUILD_TYPE "Release" CACHE + STRING "Choose the type of build." FORCE) + + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + # Default to C++17 if(NOT CMAKE_CXX_STANDARD) if("cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES) @@ -12,7 +22,15 @@ endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") # add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference) - # add_compile_options("$<$:-Wnon-virtual-dtor>") + add_compile_options(-Wall -Wextra -Wpedantic -Wdeprecated -fPIC -Wshadow -Wnull-dereference) + add_compile_options("$<$:-Wnon-virtual-dtor>") +endif() + +option(COVERAGE_ENABLED "Enable code coverage" FALSE) +if(COVERAGE_ENABLED) + add_compile_options(--coverage) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") endif() # ###############################################