Skip to content

Commit d0075dd

Browse files
authored
Merge pull request #448 from henrygerardmoore/master
Enable building without ROS even if you have ROS
2 parents 5ec8e82 + a949b8d commit d0075dd

File tree

8 files changed

+24
-16
lines changed

8 files changed

+24
-16
lines changed

ov_core/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ endif ()
1111
find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time)
1212
message(STATUS "OPENCV: " ${OpenCV_VERSION} " | BOOST: " ${Boost_VERSION})
1313

14+
# By default we build with ROS, but you can disable this and just build as a library
15+
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
16+
1417
# If we will compile with aruco support
1518
option(ENABLE_ARUCO_TAGS "Enable or disable aruco tag (disable if no contrib modules)" ON)
1619
if (NOT ENABLE_ARUCO_TAGS)
@@ -51,14 +54,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -Wmaybe-uninit
5154
# NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo
5255
find_package(catkin QUIET COMPONENTS roscpp)
5356
find_package(ament_cmake QUIET)
54-
if (catkin_FOUND)
57+
if (catkin_FOUND AND ENABLE_ROS)
5558
message(STATUS "ROS *1* version found, building ROS1.cmake")
5659
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
57-
elseif (ament_cmake_FOUND)
60+
elseif (ament_cmake_FOUND AND ENABLE_ROS)
5861
message(STATUS "ROS *2* version found, building ROS2.cmake")
5962
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS2.cmake)
6063
else ()
61-
message(STATUS "No ROS versions found, building ROS1.cmake")
64+
message(STATUS "No ROS versions found or building with ROS disabled, building ROS1.cmake without ROS")
6265
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
6366
endif ()
6467

ov_core/cmake/ROS1.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.3)
44
find_package(catkin QUIET COMPONENTS roscpp rosbag sensor_msgs cv_bridge)
55

66
# Describe ROS project
7-
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
87
if (catkin_FOUND AND ENABLE_ROS)
98
add_definitions(-DROS_AVAILABLE=1)
109
catkin_package(

ov_eval/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ project(ov_eval)
55
find_package(Eigen3 REQUIRED)
66
find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time)
77

8+
# By default we build with ROS, but you can disable this and just build as a library
9+
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
10+
811
# check if we have our python libs files (will search for python3 then python2 installs)
912
# sudo apt-get install python-matplotlib python-numpy python-dev
1013
# 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
3639
# NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo
3740
find_package(catkin QUIET COMPONENTS roscpp)
3841
find_package(ament_cmake QUIET)
39-
if (catkin_FOUND)
42+
if (catkin_FOUND AND ENABLE_ROS)
4043
message(STATUS "ROS *1* version found, building ROS1.cmake")
4144
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
42-
elseif (ament_cmake_FOUND)
45+
elseif (ament_cmake_FOUND AND ENABLE_ROS)
4346
message(STATUS "ROS *2* version found, building ROS2.cmake")
4447
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS2.cmake)
4548
else ()
46-
message(STATUS "No ROS versions found, building ROS1.cmake")
49+
message(STATUS "No ROS versions found or building with ROS disabled, building ROS1.cmake without ROS")
4750
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
4851
endif ()
4952

ov_eval/cmake/ROS1.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.3)
44
find_package(catkin QUIET COMPONENTS roscpp rospy geometry_msgs nav_msgs sensor_msgs ov_core)
55

66
# Describe ROS project
7-
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
87
if (catkin_FOUND AND ENABLE_ROS)
98
add_definitions(-DROS_AVAILABLE=1)
109
catkin_package(

ov_init/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time)
1313
find_package(Ceres REQUIRED)
1414
message(STATUS "OPENCV: " ${OpenCV_VERSION} " | BOOST: " ${Boost_VERSION} " | CERES: " ${Ceres_VERSION})
1515

16+
# By default we build with ROS, but you can disable this and just build as a library
17+
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
18+
1619
# check if we have our python libs files (will search for python3 then python2 installs)
1720
# sudo apt-get install python-matplotlib python-numpy python-dev
1821
# 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
4447
# NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo
4548
find_package(catkin QUIET COMPONENTS roscpp)
4649
find_package(ament_cmake QUIET)
47-
if (catkin_FOUND)
50+
if (catkin_FOUND AND ENABLE_ROS)
4851
message(STATUS "ROS *1* version found, building ROS1.cmake")
4952
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
50-
elseif (ament_cmake_FOUND)
53+
elseif (ament_cmake_FOUND AND ENABLE_ROS)
5154
message(STATUS "ROS *2* version found, building ROS2.cmake")
5255
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS2.cmake)
5356
else ()
54-
message(STATUS "No ROS versions found, building ROS1.cmake")
57+
message(STATUS "No ROS versions found or building with ROS disabled, building ROS1.cmake without ROS")
5558
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
5659
endif ()
5760

ov_init/cmake/ROS1.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.3)
44
find_package(catkin QUIET COMPONENTS roscpp ov_core)
55

66
# Describe ROS project
7-
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
87
if (catkin_FOUND AND ENABLE_ROS)
98
add_definitions(-DROS_AVAILABLE=1)
109
catkin_package(

ov_msckf/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time)
1212
find_package(Ceres REQUIRED)
1313
message(STATUS "OPENCV: " ${OpenCV_VERSION} " | BOOST: " ${Boost_VERSION} " | CERES: " ${Ceres_VERSION})
1414

15+
# By default we build with ROS, but you can disable this and just build as a library
16+
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
17+
1518
# If we will compile with aruco support
1619
option(ENABLE_ARUCO_TAGS "Enable or disable aruco tag (disable if no contrib modules)" ON)
1720
if (NOT ENABLE_ARUCO_TAGS)
@@ -38,14 +41,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -fno-omit-fram
3841
# NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo
3942
find_package(catkin QUIET COMPONENTS roscpp)
4043
find_package(ament_cmake QUIET)
41-
if (catkin_FOUND)
44+
if (catkin_FOUND AND ENABLE_ROS)
4245
message(STATUS "ROS *1* version found, building ROS1.cmake")
4346
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
44-
elseif (ament_cmake_FOUND)
47+
elseif (ament_cmake_FOUND AND ENABLE_ROS)
4548
message(STATUS "ROS *2* version found, building ROS2.cmake")
4649
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS2.cmake)
4750
else ()
48-
message(STATUS "No ROS versions found, building ROS1.cmake")
51+
message(STATUS "No ROS versions found or building with ROS disabled, building ROS1.cmake without ROS")
4952
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
5053
endif ()
5154

ov_msckf/cmake/ROS1.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.3)
44
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)
55

66
# Describe ROS project
7-
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
87
if (catkin_FOUND AND ENABLE_ROS)
98
add_definitions(-DROS_AVAILABLE=1)
109
catkin_package(

0 commit comments

Comments
 (0)