cmake_minimum_required(VERSION 3.17) project(madpose VERSION 0.0.1) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1) message(FATAL_ERROR "GCC version needs to be at least 9.1") endif() if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() add_compile_options(-O3 -ffast-math -fno-associative-math -DNDEBUG) # Options option(FETCH_POSELIB "Whether to use PoseLib with FetchContent or with self-installed software" ON) # Dependencies find_package(Eigen3 3.4 REQUIRED) find_package(Ceres 2.0.0 REQUIRED) find_package(OpenCV REQUIRED) # PoseLib include(FetchContent) FetchContent_Declare(PoseLib GIT_REPOSITORY https://github.com/PoseLib/PoseLib.git GIT_TAG v2.0.4 EXCLUDE_FROM_ALL ) message(STATUS "Configuring PoseLib...") if (FETCH_POSELIB) FetchContent_MakeAvailable(PoseLib) else() find_package(PoseLib REQUIRED) endif() message(STATUS "Configuring PoseLib... done") # Configure Ceres if(${CERES_VERSION} VERSION_LESS "2.2.0") # ceres 2.2.0 changes the interface of local parameterization add_definitions("-DCERES_PARAMETERIZATION_ENABLED") endif() add_subdirectory(ext/pybind11) include_directories( ${pybind11_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR} ${PROJECT_SOURCE_DIR} ${OpenCV_INCLUDE_DIRS} ext/RansacLib ) get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) foreach(dir ${dirs}) message(STATUS "dir='${dir}'") endforeach() add_subdirectory(src)