-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
104 lines (88 loc) · 3.07 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
cmake_minimum_required(VERSION 3.18)
include(FetchContent)
# --------------------------------------------------
# Declarations
# --------------------------------------------------
FetchContent_Declare(arcana.cpp
GIT_REPOSITORY https://github.com/microsoft/arcana.cpp.git
GIT_TAG 1a8a5d6e95413ed14b38a6ac9419048f9a9c8009)
FetchContent_Declare(AndroidExtensions
GIT_REPOSITORY https://github.com/bghgary/AndroidExtensions.git
GIT_TAG c84cb305205338b6fd6ff121a0349a810967bbc8)
FetchContent_Declare(CMakeExtensions
GIT_REPOSITORY https://github.com/BabylonJS/CMakeExtensions.git
GIT_TAG ea28b7689530bfdc4905806f27ecf7e8ed4b5419)
FetchContent_Declare(ios-cmake
GIT_REPOSITORY https://github.com/leetal/ios-cmake.git
GIT_TAG 4.4.1)
# --------------------------------------------------
FetchContent_MakeAvailable(CMakeExtensions)
if(IOS)
FetchContent_MakeAvailable_With_Message(ios-cmake)
set(CMAKE_TOOLCHAIN_FILE "${ios-cmake_SOURCE_DIR}/ios.toolchain.cmake" CACHE PATH "")
set(PLATFORM "OS64COMBINED" CACHE STRING "")
set(DEPLOYMENT_TARGET "13" CACHE STRING "")
endif()
project(UrlLib)
FetchContent_MakeAvailable_With_Message(arcana.cpp)
if(ANDROID)
FetchContent_MakeAvailable_With_Message(AndroidExtensions)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(ANDROID)
set(ADDITIONAL_SOURCES
"Source/UrlRequest_Android.cpp"
"Source/WebSocket_Android.cpp")
set(ADDITIONAL_LIBRARIES
PRIVATE android
PRIVATE AndroidExtensions
PRIVATE log)
elseif(APPLE)
set(ADDITIONAL_SOURCES
"Source/UrlRequest_Apple.mm"
"Source/WebSocket_Apple.mm"
"Source/WebSocket_Apple_ObjC.h"
"Source/WebSocket_Apple_ObjC.m")
elseif(UNIX)
set(ADDITIONAL_SOURCES
"Source/UrlRequest_Unix.cpp"
"Source/WebSocket_Unix.cpp")
set(ADDITIONAL_LIBRARIES
PRIVATE curl)
elseif(WIN32)
set(ADDITIONAL_SOURCES
"Source/UrlRequest_Windows_Shared.h"
"Source/WebSocket_Windows.cpp")
if(WINDOWS_STORE)
set(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES}
"Source/UrlRequest_UWP.cpp")
else()
set(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES}
"Source/UrlRequest_Win32.cpp")
set(ADDITIONAL_LIBRARIES
PUBLIC onecoreuap.lib)
endif()
else()
message(FATAL_ERROR "Unrecognized platform: ${CMAKE_SYSTEM_NAME}")
endif()
set(SOURCES
"Include/UrlLib/UrlLib.h"
"Source/UrlRequest_Base.h"
"Source/UrlRequest_Shared.h"
"Source/WebSocket_Base.h"
"Source/WebSocket_Shared.h"
${ADDITIONAL_SOURCES})
add_library(UrlLib ${SOURCES})
target_include_directories(UrlLib PUBLIC "Include")
target_include_directories(UrlLib PRIVATE "Source")
target_link_libraries(UrlLib
PUBLIC arcana
${ADDITIONAL_LIBRARIES})
if(APPLE)
set_target_properties(UrlLib PROPERTIES
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
set_property(TARGET UrlLib PROPERTY UNITY_BUILD false)
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})