diff --git a/ov_core/CMakeLists.txt b/ov_core/CMakeLists.txt index a4a1bc23d..ecc1cc82b 100644 --- a/ov_core/CMakeLists.txt +++ b/ov_core/CMakeLists.txt @@ -11,6 +11,9 @@ endif () find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time) message(STATUS "OPENCV: " ${OpenCV_VERSION} " | BOOST: " ${Boost_VERSION}) +# By default we build with ROS, but you can disable this and just build as a library +option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON) + # If we will compile with aruco support option(ENABLE_ARUCO_TAGS "Enable or disable aruco tag (disable if no contrib modules)" ON) if (NOT ENABLE_ARUCO_TAGS) @@ -51,14 +54,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -Wmaybe-uninit # NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo find_package(catkin QUIET COMPONENTS roscpp) find_package(ament_cmake QUIET) -if (catkin_FOUND) +if (catkin_FOUND AND ENABLE_ROS) message(STATUS "ROS *1* version found, building ROS1.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake) -elseif (ament_cmake_FOUND) +elseif (ament_cmake_FOUND AND ENABLE_ROS) message(STATUS "ROS *2* version found, building ROS2.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS2.cmake) else () - message(STATUS "No ROS versions found, building ROS1.cmake") + message(STATUS "No ROS versions found or building with ROS disabled, building ROS1.cmake without ROS") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake) endif () diff --git a/ov_core/cmake/ROS1.cmake b/ov_core/cmake/ROS1.cmake index 6db18fbeb..93d016424 100644 --- a/ov_core/cmake/ROS1.cmake +++ b/ov_core/cmake/ROS1.cmake @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.3) find_package(catkin QUIET COMPONENTS roscpp rosbag sensor_msgs cv_bridge) # Describe ROS project -option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON) if (catkin_FOUND AND ENABLE_ROS) add_definitions(-DROS_AVAILABLE=1) catkin_package( diff --git a/ov_eval/CMakeLists.txt b/ov_eval/CMakeLists.txt index 27abb8920..f60c1959e 100644 --- a/ov_eval/CMakeLists.txt +++ b/ov_eval/CMakeLists.txt @@ -5,6 +5,9 @@ project(ov_eval) find_package(Eigen3 REQUIRED) find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time) +# By default we build with ROS, but you can disable this and just build as a library +option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON) + # check if we have our python libs files (will search for python3 then python2 installs) # sudo apt-get install python-matplotlib python-numpy python-dev # https://cmake.org/cmake/help/v3.10/module/FindPythonLibs.html @@ -36,14 +39,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -Wmaybe-uninit # NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo find_package(catkin QUIET COMPONENTS roscpp) find_package(ament_cmake QUIET) -if (catkin_FOUND) +if (catkin_FOUND AND ENABLE_ROS) message(STATUS "ROS *1* version found, building ROS1.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake) -elseif (ament_cmake_FOUND) +elseif (ament_cmake_FOUND AND ENABLE_ROS) message(STATUS "ROS *2* version found, building ROS2.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS2.cmake) else () - message(STATUS "No ROS versions found, building ROS1.cmake") + message(STATUS "No ROS versions found or building with ROS disabled, building ROS1.cmake without ROS") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake) endif () diff --git a/ov_eval/cmake/ROS1.cmake b/ov_eval/cmake/ROS1.cmake index 12ed33bf9..9d10e6f57 100644 --- a/ov_eval/cmake/ROS1.cmake +++ b/ov_eval/cmake/ROS1.cmake @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.3) find_package(catkin QUIET COMPONENTS roscpp rospy geometry_msgs nav_msgs sensor_msgs ov_core) # Describe ROS project -option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON) if (catkin_FOUND AND ENABLE_ROS) add_definitions(-DROS_AVAILABLE=1) catkin_package( diff --git a/ov_init/CMakeLists.txt b/ov_init/CMakeLists.txt index 7df06547a..0e7c58ade 100644 --- a/ov_init/CMakeLists.txt +++ b/ov_init/CMakeLists.txt @@ -13,6 +13,9 @@ find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time) find_package(Ceres REQUIRED) message(STATUS "OPENCV: " ${OpenCV_VERSION} " | BOOST: " ${Boost_VERSION} " | CERES: " ${Ceres_VERSION}) +# By default we build with ROS, but you can disable this and just build as a library +option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON) + # check if we have our python libs files (will search for python3 then python2 installs) # sudo apt-get install python-matplotlib python-numpy python-dev # https://cmake.org/cmake/help/v3.10/module/FindPythonLibs.html @@ -44,14 +47,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -Wmaybe-uninit # NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo find_package(catkin QUIET COMPONENTS roscpp) find_package(ament_cmake QUIET) -if (catkin_FOUND) +if (catkin_FOUND AND ENABLE_ROS) message(STATUS "ROS *1* version found, building ROS1.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake) -elseif (ament_cmake_FOUND) +elseif (ament_cmake_FOUND AND ENABLE_ROS) message(STATUS "ROS *2* version found, building ROS2.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS2.cmake) else () - message(STATUS "No ROS versions found, building ROS1.cmake") + message(STATUS "No ROS versions found or building with ROS disabled, building ROS1.cmake without ROS") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake) endif () diff --git a/ov_init/cmake/ROS1.cmake b/ov_init/cmake/ROS1.cmake index f058e5ef6..c83be64c3 100644 --- a/ov_init/cmake/ROS1.cmake +++ b/ov_init/cmake/ROS1.cmake @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.3) find_package(catkin QUIET COMPONENTS roscpp ov_core) # Describe ROS project -option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON) if (catkin_FOUND AND ENABLE_ROS) add_definitions(-DROS_AVAILABLE=1) catkin_package( diff --git a/ov_msckf/CMakeLists.txt b/ov_msckf/CMakeLists.txt index d62570fe0..5f8a2eb63 100644 --- a/ov_msckf/CMakeLists.txt +++ b/ov_msckf/CMakeLists.txt @@ -12,6 +12,9 @@ find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time) find_package(Ceres REQUIRED) message(STATUS "OPENCV: " ${OpenCV_VERSION} " | BOOST: " ${Boost_VERSION} " | CERES: " ${Ceres_VERSION}) +# By default we build with ROS, but you can disable this and just build as a library +option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON) + # If we will compile with aruco support option(ENABLE_ARUCO_TAGS "Enable or disable aruco tag (disable if no contrib modules)" ON) if (NOT ENABLE_ARUCO_TAGS) @@ -38,14 +41,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -fno-omit-fram # NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo find_package(catkin QUIET COMPONENTS roscpp) find_package(ament_cmake QUIET) -if (catkin_FOUND) +if (catkin_FOUND AND ENABLE_ROS) message(STATUS "ROS *1* version found, building ROS1.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake) -elseif (ament_cmake_FOUND) +elseif (ament_cmake_FOUND AND ENABLE_ROS) message(STATUS "ROS *2* version found, building ROS2.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS2.cmake) else () - message(STATUS "No ROS versions found, building ROS1.cmake") + message(STATUS "No ROS versions found or building with ROS disabled, building ROS1.cmake without ROS") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake) endif () diff --git a/ov_msckf/cmake/ROS1.cmake b/ov_msckf/cmake/ROS1.cmake index 5f3a9a494..2ea4292cf 100644 --- a/ov_msckf/cmake/ROS1.cmake +++ b/ov_msckf/cmake/ROS1.cmake @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.3) find_package(catkin QUIET COMPONENTS roscpp rosbag tf std_msgs geometry_msgs sensor_msgs nav_msgs visualization_msgs image_transport cv_bridge ov_core ov_init) # Describe ROS project -option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON) if (catkin_FOUND AND ENABLE_ROS) add_definitions(-DROS_AVAILABLE=1) catkin_package(