-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
177 lines (153 loc) · 6.08 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
cmake_minimum_required(VERSION 3.27.0)
set(CMAKE_CXX_STANDARD 20)
set(SQLITE_LIBRARY_PATH ${CMAKE_SOURCE_DIR}/WebFramework/vendor/sqlite3/lib)
set(SQLITE_DLL_PATH ${CMAKE_SOURCE_DIR}/WebFramework/vendor/sqlite3)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/WebFrameworkLibrary CACHE STRING "")
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
set(WEB_FRAMEWORK_LIBRARY_TYPE STATIC)
set(
LIBS
BaseTCPServer
FileManager
INIParser
Localization
Log
Networks
JSON
SocketStreams
SHA256
ThreadPool
UtilityLibrary
sqlite3
ssl
crypto
)
option(SHARED_WEB_FRAMEWORK "Build WebFramework shared library for using in different APIs" ON)
project(WebFramework VERSION 3.0.10)
if (UNIX)
add_definitions(-D__LINUX__)
add_compile_options(-fvisibility=hidden)
set(SQLITE_DLL_DESTINATION_PATH ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
add_definitions(-D__ANDROID__)
set(SQLITE_LIBRARY_PATH ${SQLITE_LIBRARY_PATH}/Android)
set(SQLITE_DLL_PATH ${SQLITE_DLL_PATH}/lib/Android/libsqlite3.so)
install(DIRECTORY WebFramework/vendor/sqlite3/lib/Android/ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/)
else()
set(SQLITE_LIBRARY_PATH ${SQLITE_LIBRARY_PATH}/Linux)
set(SQLITE_DLL_PATH ${SQLITE_DLL_PATH}/lib/Linux/libsqlite3.so)
add_compile_options(-rdynamic)
install(DIRECTORY WebFramework/vendor/sqlite3/lib/Linux/ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/)
endif()
else ()
add_definitions(-DNOMINMAX)
add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
set(SQLITE_LIBRARY_PATH ${SQLITE_LIBRARY_PATH}/Windows)
set(SQLITE_DLL_PATH ${SQLITE_DLL_PATH}/dll/sqlite3.dll)
set(SQLITE_DLL_DESTINATION_PATH ${CMAKE_INSTALL_PREFIX}/dll)
set(LIBS ${LIBS} crypt32)
install(DIRECTORY WebFramework/vendor/sqlite3/lib/Windows/ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/vendor/sqlite3)
endif ()
if (${SHARED_WEB_FRAMEWORK})
add_definitions(-DWEB_FRAMEWORK_DLL)
set(WEB_FRAMEWORK_LIBRARY_TYPE SHARED)
endif ()
add_library(
${PROJECT_NAME} ${WEB_FRAMEWORK_LIBRARY_TYPE}
WebFramework/src/DynamicPages/StandardWebFrameworkDynamicPagesFunctions.cpp
WebFramework/src/DynamicPages/WebFrameworkDynamicPages.cpp
WebFramework/src/Exceptions/BadRequestException.cpp
WebFramework/src/Exceptions/BaseExecutorException.cpp
WebFramework/src/Exceptions/BaseWebFrameworkException.cpp
WebFramework/src/Exceptions/CantFindFunctionException.cpp
WebFramework/src/Exceptions/CantLoadSourceException.cpp
WebFramework/src/Exceptions/DatabaseException.cpp
WebFramework/src/Exceptions/DynamicPagesSyntaxException.cpp
WebFramework/src/Exceptions/MissingLoadTypeException.cpp
WebFramework/src/Exceptions/NotImplementedException.cpp
WebFramework/src/Exceptions/SQLite3Exception.cpp
WebFramework/src/Executors/BaseExecutor.cpp
WebFramework/src/Executors/BaseHeavyOperationStatefulExecutor.cpp
WebFramework/src/Executors/BaseHeavyOperationStatelessExecutor.cpp
WebFramework/src/Executors/BaseStatefulExecutor.cpp
WebFramework/src/Executors/BaseStatelessExecutor.cpp
WebFramework/src/Executors/ResourceExecutor.cpp
WebFramework/src/LoadBalancer/LoadBalancerServer.cpp
WebFramework/src/LoadBalancer/Heuristics/BaseLoadBalancerHeuristic.cpp
WebFramework/src/LoadBalancer/Heuristics/Connections.cpp
WebFramework/src/Proxy/ProxyServer.cpp
WebFramework/src/SQLite3/SQLiteDatabase.cpp
WebFramework/src/SQLite3/SQLiteDatabaseModel.cpp
WebFramework/src/SQLite3/SQLiteResult.cpp
WebFramework/src/SQLite3/SQLiteManager.cpp
WebFramework/src/Utility/Sources.cpp
WebFramework/src/Utility/RouteParameters.cpp
WebFramework/src/Utility/JSONSettingsParser.cpp
WebFramework/src/Utility/Singletons/HTTPSSingleton.cpp
WebFramework/src/Utility/BaseConnectionData.cpp
WebFramework/src/Utility/DynamicLibraries.cpp
WebFramework/src/Managers/ExecutorsManager.cpp
WebFramework/src/Managers/SessionsManager.cpp
WebFramework/src/WebNetwork/HTTPRequest.cpp
WebFramework/src/WebNetwork/HTTPResponse.cpp
WebFramework/src/WebNetwork/WebServers/BaseWebServer.cpp
WebFramework/src/WebNetwork/WebServers/MultithreadedWebServer.cpp
WebFramework/src/WebNetwork/WebServers/ThreadPoolWebServer.cpp
WebFramework/src/WebNetwork/Interfaces/IExecutorFunctionality.cpp
WebFramework/src/Import/Config.cpp
WebFramework/src/Import/WebFramework.cpp
WebFramework/src/c_api/web_framework_c_api.cpp
)
if (WIN32)
target_compile_options(${PROJECT_NAME} PRIVATE "/MP")
endif (WIN32)
target_include_directories(
${PROJECT_NAME} PUBLIC
WebFramework/vendor/sqlite3/include/
WebFramework/src/
BaseTCPServer/src/
FileManager/src/
INIParser/src/
Localization/src/
Log/src/
Networks/src/
Networks/HTTP/src/
Networks/HTTP/JSON/src/
SHA256/src/
ThreadPool/src/
UtilityLibrary/include/
)
add_subdirectory(BaseTCPServer)
add_subdirectory(FileManager)
add_subdirectory(INIParser)
add_subdirectory(Localization)
add_subdirectory(Log)
add_subdirectory(Networks)
add_subdirectory(SHA256)
add_subdirectory(ThreadPool)
add_subdirectory(UtilityLibrary)
add_subdirectory(API)
target_link_directories(
${PROJECT_NAME} PUBLIC
${SQLITE_LIBRARY_PATH}
)
target_link_libraries(
${PROJECT_NAME}
${LIBS}
)
install(
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/dll
)
install(FILES ${SQLITE_DLL_PATH} DESTINATION ${SQLITE_DLL_DESTINATION_PATH})
install(FILES WebFrameworkConfig.cmake DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES FindWebFramework.cmake DESTINATION ${CMAKE_INSTALL_PREFIX})
if (NOT EXISTS ${CMAKE_INSTALL_PREFIX}/WebFrameworkAssets)
install(DIRECTORY WebFramework/WebFrameworkAssets/ DESTINATION ${CMAKE_INSTALL_PREFIX}/WebFrameworkAssets)
endif ()
install(DIRECTORY WebFramework/src/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h")
install(DIRECTORY WebFramework/vendor/sqlite3/include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/vendor/sqlite3/)
install(DIRECTORY WebFramework/certificates DESTINATION ${CMAKE_INSTALL_PREFIX})