forked from ppwwyyxx/OpenPano
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
65 lines (55 loc) · 2.09 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
59
60
61
62
63
64
65
cmake_minimum_required (VERSION 3.1)
# set a default build type if none was provided
# this has to be done before the project() instruction!
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
project (stitch)
# Detect the OS
if(${CMAKE_HOST_WIN32})
set(WINDOWS 1)
elseif(${CMAKE_HOST_APPLE})
set(MACOSX 1)
elseif(${CMAKE_HOST_UNIX})
set(LINUX 1)
else()
message(FATAL_ERROR "Unsupported operating system")
return()
endif()
# Set some env vars
set (VERSION_MAJOR 0)
set (VERSION_MINOR 1)
if (MSVC)
if(MSVC_VERSION LESS 1800) # 1700 = VS 2013
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
set(OBJ_EXT obj)
else()
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
set(OBJ_EXT o)
endif()
#################################################################################################################
# ============================================ General build definitions ====================================== #
#################################################################################################################
if(NOT EIGEN3_INCLUDE_DIR )
message(FATAL_ERROR "Set EIGEN3_INCLUDE_DIR")
endif()
include_directories(${EIGEN3_INCLUDE_DIR})
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32_LEAN_AND_MEAN -DVC_EXTRALEAN)
# /Zo makes debug symbol in pdb in release mode in VS2015
add_definitions(/fp:fast /GR- /Os /Zo /arch:AVX /openmp)
else()
add_definitions(-O3 -g -march=native -fopenmp -Wall -Wextra)
set(CMAKE_CXX_COMPILER g++-5)
endif()
add_subdirectory(src)