Skip to content

Commit 01b0f65

Browse files
committed
add cmake
1 parent 9ae2635 commit 01b0f65

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
cmake_minimum_required(VERSION 3.6)
2+
3+
get_filename_component(PATH_TO_ROOT "../.." ABSOLUTE)
4+
5+
project("libHttpClient.iOS")
6+
7+
set(HC_WEBSOCKETS FALSE)
8+
9+
add_definitions(-D_NO_ASYNCRTIMP -D_NO_PPLXIMP -D_NO_XSAPIIMP -DXSAPI_BUILD)
10+
11+
if(HC_WEBSOCKETS)
12+
message(STATUS "websockets usage is on")
13+
else()
14+
message(STATUS "websockets usage is off")
15+
add_definitions(-DHC_NOWEBSOCKETS)
16+
endif()
17+
18+
###########################################
19+
### Set up paths for source and include ###
20+
###########################################
21+
22+
include("../libHttpClient.CMake/GetCommonHCSourceFiles.cmake")
23+
get_common_hc_source_files(
24+
PUBLIC_SOURCE_FILES
25+
HC_COMMON_SOURCE_FILES
26+
GLOBAL_SOURCE_FILES
27+
PLATFORM_SOURCE_FILES
28+
WEBSOCKET_SOURCE_FILES
29+
TASK_SOURCE_FILES
30+
MOCK_SOURCE_FILES
31+
HTTP_SOURCE_FILES
32+
LOGGER_SOURCE_FILES
33+
"${PATH_TO_ROOT}"
34+
)
35+
36+
set(COMMON_SOURCE_FILES
37+
"${PUBLIC_SOURCE_FILES}"
38+
"${HC_COMMON_SOURCE_FILES}"
39+
"${GLOBAL_SOURCE_FILES}"
40+
"${PLATFORM_SOURCE_FILES}"
41+
"${WEBSOCKET_SOURCE_FILES}"
42+
"${MOCK_SOURCE_FILES}"
43+
"${HTTP_SOURCE_FILES}"
44+
"${LOGGER_SOURCE_FILES}"
45+
"${TASK_SOURCE_FILES}"
46+
)
47+
48+
set(IOS_SOURCE_FILES
49+
# Task
50+
"${PATH_TO_ROOT}/Source/Task/ThreadPool_stl.cpp"
51+
"${PATH_TO_ROOT}/Source/Task/WaitTimer_stl.cpp"
52+
"${PATH_TO_ROOT}/Source/Task/iOS/ios_WaitTimer.mm"
53+
"${PATH_TO_ROOT}/Source/Task/iOS/ios_WaitTimer_target.mm"
54+
"${PATH_TO_ROOT}/Source/Task/iOS/ios_WaitTimer_target.h"
55+
"${PATH_TO_ROOT}/Source/Task/iOS/ios_WaitTimerImpl.h"
56+
# HTTP
57+
"${PATH_TO_ROOT}/Source/HTTP/Apple/http_apple.mm"
58+
"${PATH_TO_ROOT}/Source/HTTP/Apple/http_apple.h"
59+
# Common
60+
"${PATH_TO_ROOT}/Source/Common/Apple/utils_apple.mm"
61+
"${PATH_TO_ROOT}/Source/Common/Apple/utils_apple.h"
62+
# Platform
63+
"${PATH_TO_ROOT}/Source/Platform/Apple/PlatformComponents_Apple.cpp"
64+
"${PATH_TO_ROOT}/Source/Platform/Apple/PlatformTrace_Apple.cpp"
65+
)
66+
67+
set(COMMON_INCLUDE_DIRS
68+
"${PATH_TO_ROOT}/"
69+
"${PATH_TO_ROOT}/Source/"
70+
"${PATH_TO_ROOT}/Source/Common"
71+
"${PATH_TO_ROOT}/Source/HTTP"
72+
"${PATH_TO_ROOT}/Source/Logger"
73+
"${PATH_TO_ROOT}/Source/Platform"
74+
"${PATH_TO_ROOT}/Source/Task"
75+
"${PATH_TO_ROOT}/Source/WebSocket"
76+
"${PATH_TO_ROOT}/Include"
77+
"${PATH_TO_ROOT}/Include/httpClient"
78+
)
79+
80+
#########################
81+
### Set up static lib ###
82+
#########################
83+
84+
set(ALL_SOURCE_FILES ${COMMON_SOURCE_FILES} ${IOS_SOURCE_FILES})
85+
list(SORT ALL_SOURCE_FILES)
86+
87+
add_library(
88+
"${PROJECT_NAME}"
89+
${ALL_SOURCE_FILES}
90+
)
91+
92+
target_include_directories(
93+
"${PROJECT_NAME}"
94+
PRIVATE
95+
"${COMMON_INCLUDE_DIRS}"
96+
)
97+
98+
message(STATUS "CMAKE_SYSTEM_VERSION='${CMAKE_SYSTEM_VERSION}'")
99+
message(STATUS "CMAKE_SYSTEM_NAME='${CMAKE_SYSTEM_NAME}'")

0 commit comments

Comments
 (0)