-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCMakeLists.txt
88 lines (67 loc) · 1.9 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
cmake_minimum_required(VERSION 3.18)
project(apsdk)
option(BUILD_APS_DEMO "Build the demo project" OFF)
option(BUILD_APS_STATIC "Build as static library" OFF)
message(STATUS "++++++++++ Current build target system:" ${CMAKE_SYSTEM_NAME})
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(WINDOWS TRUE)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LINUX TRUE)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Android")
set(ANDROID TRUE)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX TRUE)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "iOS")
set(IOS TRUE)
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
message(FATAL_ERROR "CMake Version is too low to build for iOS platform, 3.14+ is required.")
endif()
endif()
# Flags
# C standard
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 11)
# C++ standard
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)
# Hide symbols
if (NOT APPLE)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
endif()
# Enable project folder
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (WINDOWS)
elseif (LINUX)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
elseif (ANDROID)
elseif (MACOSX)
elseif (IOS)
endif()
# Definitions
add_definitions(-DASIO_STANDALONE)
if (WINDOWS)
add_definitions(-D_WIN32_WINNT=0x0600) # Windows Vista +
add_definitions(-DINCL_EXTRA_HTON_FUNCTIONS)
elseif (LINUX)
elseif (ANDROID)
elseif (MACOS)
elseif (IOS)
endif()
set(AP_PLATFORM_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/platforms)
# Include paths
include_directories(
include
third-party
third-party/asio/include
)
# srouce
add_subdirectory(src)
# third-party
add_subdirectory(third-party)
# aps-demo
if (BUILD_APS_DEMO)
add_subdirectory(demo)
endif()