-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
81 lines (68 loc) · 2.83 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
# CMakeList.txt: 顶层 CMake 项目文件,在此处执行全局配置
# 并包含子项目。
#
cmake_minimum_required (VERSION 3.5)
project ("libcpps")
if (CMAKE_HOST_WIN32)
set(WINDOWS 1)
elseif (CMAKE_HOST_APPLE)
set(MACOS 1)
elseif (CMAKE_HOST_UNIX)
set(LINUX 1)
endif ()
#默认不启动TCMALLOC
if (NOT CPPS_ENABLE_TCMALLOC)
set(CPPS_ENABLE_TCMALLOC "OFF")
endif()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
if (NOT CPPS_ENABLE_ZLIB)
set(CPPS_ENABLE_ZLIB "ON" CACHE STRING "" FORCE)
endif()
endif()
if (WINDOWS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set(CMAKE_CXX_STANDARD 11)
elseif (MACOS)
#default release.
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
endif()
set(CMAKE_CXX_STANDARD 11)
if(CMAKE_BUILD_TYPE STREQUAL "Release" )
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wfatal-errors -std=c++11 -Wno-format-y2k -fpermissive -m64 -Wimplicit-int-conversion -std=gnu++0x -fPIC -fpermissive -Wno-unused-function -O3 -Wall ")
add_definitions(-D__APPLE__ -D_GLIBCXX_USE_CXX11_ABI=1 -D_FILE_OFFSET_BITS=64 -DNDEBUG)
message("release build")
else()
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -Wfatal-errors -std=c++11 -Wno-format-y2k -Wimplicit-int-conversion -fpermissive -m64 -std=gnu++0x -Wdeprecated-declarations -Wunused-function -fPIC -fpermissive -Wno-unused-function -O0 -Wall -g -ggdb ")
add_definitions(-D__APPLE__ -D_GLIBCXX_USE_CXX11_ABI=1 -D_FILE_OFFSET_BITS=64 -DDEBUG)
message("debug build")
endif()
# TODO: 如有需要,请添加测试并安装目标。
set(CMAKE_INSTALL_PREFIX /usr/local/opt/cpps)
elseif (LINUX)
#default release.
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
endif()
set(CMAKE_CXX_STANDARD 11)
if(CMAKE_BUILD_TYPE STREQUAL "Release" )
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wfatal-errors -std=c++11 -Wno-format-y2k -fpermissive -m64 -std=gnu++0x -fPIC -fpermissive -Wno-unused-function -O3 -Wall")
add_definitions(-DLINUX -D_GLIBCXX_USE_CXX11_ABI=1 -D_FILE_OFFSET_BITS=64 -DNDEBUG)
message("release build")
else()
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -Wfatal-errors -std=c++11 -Wno-format-y2k -fpermissive -m64 -std=gnu++0x -fPIC -fpermissive -Wno-unused-function -O0 -Wall -g -ggdb")
add_definitions(-DLINUX -D_GLIBCXX_USE_CXX11_ABI=1 -D_FILE_OFFSET_BITS=64 -DDEBUG)
message("debug build")
endif()
# TODO: 如有需要,请添加测试并安装目标。
set(CMAKE_INSTALL_PREFIX /usr/local)
ENDIF()
# 包含子项目。
add_subdirectory ("src")
add_subdirectory ("cpps")
add_subdirectory ("example/demo")
add_subdirectory ("csharp/cpps_interface")