-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
124 lines (100 loc) · 3.92 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#
# CMakeLists.txt
# Copyright © 2010 François-Xavier 'Bombela' Bourlet <[email protected]>
#
#
cmake_minimum_required(VERSION 2.6)
project(zia CXX)
###############################################################################
# BOOST CONFIGURATION
###############################################################################
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(BOOST_INCLUDEDIR "/usr/local/include")
set(Boost_ADDITIONAL_VERSIONS 1.47 1.46 1.44 1.43 1.42 1.41 1.40 1.39)
add_definitions(-DBOOST_ALL_NO_LIB)
###############################################################################
# COMPILER FLAGS
###############################################################################
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
set(PROFILING false CACHE BOOL "Use profilling")
if (PROFILING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector")
set(EXTRADEBUG false CACHE BOOL "Force extra debug info")
set(NATIVECODE false CACHE BOOL "Generate native code")
if (NATIVECODE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
set(NOELIDECTOR false CACHE BOOL "Disable elide contructors optimization")
if (NOELIDECTOR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-elide-constructors")
endif()
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if (EXTRADEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
endif()
set(OMIT_FRAME_POINTER true CACHE BOOL "Omit frame pointer")
if (OMIT_FRAME_POINTER)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
endif()
# ugly temparary hack
include_directories(
"/usr/include/x86_64-linux-gnu/"
"/usr/include/i386-linux-gnu/"
)
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if (EXTRADEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -D_GLIBCXX_DEBUG")
endif()
include(CheckCXXCompilerFlag OPTIONAL RESULT_VARIABLE CMAKE_CHECK_CXX_FLAGS)
if (CMAKE_CHECK_CXX_FLAGS)
CHECK_CXX_COMPILER_FLAG(-flto GCC_WITH_LTO)
if (GCC_WITH_LTO)
set(LTO true CACHE BOOL "Use GCC Link Time Optimisation.")
endif(GCC_WITH_LTO)
CHECK_CXX_COMPILER_FLAG(-fwhole-program GCC_WITH_WP)
if (GCC_WITH_WP)
set(LTO_WP false CACHE BOOL
"Use GCC Whole Program Link Time Optimisation.")
endif(GCC_WITH_WP)
endif(CMAKE_CHECK_CXX_FLAGS)
if (LTO)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto")
endif()
if (LTO_WP)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -fwhole-program")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE}
-fwhole-program")
endif()
endif(CMAKE_COMPILER_IS_GNUCXX)
###############################################################################
# COROUTINE CONFIGURATION
###############################################################################
include_directories(${CMAKE_SOURCE_DIR}/include)
set(LINUX_8664_2SWAPSITE true CACHE BOOL
"Linux x86_64: swapContext copy pasted for help CPU prediction")
if (NOT LINUX_8664_2SWAPSITE)
add_definitions(-DNO_CORO_LINUX_8664_2SWAPSITE)
endif()
set(LINUX_8632_2SWAPSITE true CACHE BOOL
"Linux x86_32: swapContext copy pasted for help CPU prediction")
if (NOT LINUX_8632_2SWAPSITE)
add_definitions(-DNO_CORO_LINUX_8632_2SWAPSITE)
endif()
###############################################################################
# SUBDIRS
###############################################################################
enable_testing()
add_subdirectory(tests)
add_subdirectory(benchmarks)