58 lines
2.4 KiB
CMake
58 lines
2.4 KiB
CMake
cmake_minimum_required(VERSION 3.3)
|
|
project(ov_init)
|
|
|
|
|
|
# Include libraries (if we don't have opencv 4, then fallback to opencv 3)
|
|
# The OpenCV version needs to match the one used by cv_bridge otherwise you will get a segmentation fault!
|
|
find_package(Eigen3 REQUIRED)
|
|
find_package(OpenCV 3 QUIET)
|
|
if (NOT OpenCV_FOUND)
|
|
find_package(OpenCV 4 REQUIRED)
|
|
endif ()
|
|
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})
|
|
|
|
# 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
|
|
find_package(PythonLibs QUIET)
|
|
option(DISABLE_MATPLOTLIB "Disable or enable matplotlib plot scripts in ov_eval" OFF)
|
|
if (PYTHONLIBS_FOUND AND NOT DISABLE_MATPLOTLIB)
|
|
add_definitions(-DHAVE_PYTHONLIBS=1)
|
|
message(STATUS "PYTHON VERSION: " ${PYTHONLIBS_VERSION_STRING})
|
|
message(STATUS "PYTHON INCLUDE: " ${PYTHON_INCLUDE_DIRS})
|
|
message(STATUS "PYTHON LIBRARIES: " ${PYTHON_LIBRARIES})
|
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
|
list(APPEND thirdparty_libraries ${PYTHON_LIBRARIES})
|
|
endif ()
|
|
|
|
# We need c++14 for ROS2, thus just require it for everybody
|
|
# NOTE: To future self, hope this isn't an issue...
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
# Enable compile optimizations
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fsee -fomit-frame-pointer -fno-signed-zeros -fno-math-errno -funroll-loops")
|
|
|
|
# Enable debug flags (use if you want to debug in gdb)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -Wmaybe-uninitialized")
|
|
|
|
# Find our ROS version!
|
|
# NOTE: Default to using the ROS1 package if both are in our enviroment
|
|
# NOTE: https://github.com/romainreignier/share_ros1_ros2_lib_demo
|
|
find_package(catkin QUIET COMPONENTS roscpp)
|
|
find_package(ament_cmake QUIET)
|
|
if (catkin_FOUND)
|
|
message(STATUS "ROS *1* version found, building ROS1.cmake")
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
|
|
elseif (ament_cmake_FOUND)
|
|
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")
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ROS1.cmake)
|
|
endif ()
|
|
|