-
Notifications
You must be signed in to change notification settings - Fork 51
/
CMakeLists.txt
46 lines (35 loc) · 1.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
PROJECT(bundle_adjustment)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)
SET(TARGET_EXEC "bundle_adjuster")
SET(TARGET_SCRIPTS "camera_calibration")
SET(BA_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src")
SET(SCRIPTS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
FIND_PACKAGE(Ceres REQUIRED)
MESSAGE(STATUS "Found ceres-solver library version ${CERES_VERSION}")
INCLUDE_DIRECTORIES(${CERES_INCLUDE_DIRS})
SET(glog_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake-external/")
FIND_PACKAGE(glog REQUIRED PATHS cmake_external)
INCLUDE_DIRECTORIES(${GLOG_INCLUDE_DIRS})
SET(gflags_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake-external/")
FIND_PACKAGE(gflags REQUIRED PATHS cmake_external)
INCLUDE_DIRECTORIES(${GFLAGS_INCLUDE_DIRS})
SET(SETTINGS "-std=c++14 -fopenmp -fexceptions -fpic")
SET(OPTIMIZATIONS "-D_FORTIFY_SOURCE=2 -march=native -mtune=native -ffast-math")
SET(DIAGNOSTICS "-Wall -Wextra -pedantic -Werror")
SET(BUILD_FLAGS "${SETTINGS} ${OPTIMIZATIONS} ${DIAGNOSTICS}")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
#dirty hacky workaround
ADD_DEFINITIONS( -D__extern_always_inline=inline )
if(UNIX)
if(CMAKE_GENERATOR STREQUAL "Ninja")
LIST(APPEND CMAKE_C_FLAGS "-fcolor-diagnostics")
LIST(APPEND CMAKE_CXX_FLAGS "-fcolor-diagnostics")
endif(CMAKE_GENERATOR STREQUAL "Ninja")
endif(UNIX)
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
ADD_SUBDIRECTORY(${BA_PATH})
ADD_SUBDIRECTORY(${SCRIPTS_PATH})