-
Notifications
You must be signed in to change notification settings - Fork 96
/
CMakeLists.txt
58 lines (48 loc) · 1.94 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
47
48
49
50
51
52
53
54
55
56
57
58
cmake_minimum_required(VERSION 3.28)
project(glomap VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES ON)
option(TESTS_ENABLED "Whether to build test binaries" OFF)
option(ASAN_ENABLED "Whether to enable AddressSanitizer flags" OFF)
option(CCACHE_ENABLED "Whether to enable compiler caching, if available" ON)
option(FETCH_COLMAP "Whether to use COLMAP with FetchContent or with self-installed software" ON)
option(FETCH_POSELIB "Whether to use PoseLib with FetchContent or with self-installed software" ON)
include(cmake/FindDependencies.cmake)
# Propagate options to vcpkg manifest.
if (TESTS_ENABLED)
enable_testing()
endif()
if(ASAN_ENABLED)
message(STATUS "Enabling ASan")
add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope)
add_link_options(-fsanitize=address)
endif()
if(CCACHE_ENABLED)
find_program(CCACHE ccache)
if(CCACHE)
message(STATUS "Enabling ccache support")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
else()
message(STATUS "Disabling ccache support")
endif()
else()
message(STATUS "Disabling ccache support")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Some fixes for the Glog library.
add_definitions("-DGLOG_USE_GLOG_EXPORT")
add_definitions("-DGLOG_NO_ABBREVIATED_SEVERITIES")
add_definitions("-DGL_GLEXT_PROTOTYPES")
add_definitions("-DNOMINMAX")
add_compile_options(/EHsc)
# Disable warning: 'initializing': conversion from 'X' to 'Y', possible loss of data
add_compile_options(/wd4244 /wd4267 /wd4305)
# Enable object level parallel builds in Visual Studio.
add_compile_options(/MP)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
add_compile_options(/bigobj)
endif()
endif()
add_subdirectory(glomap)