-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
180 lines (156 loc) · 3.95 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
178
179
cmake_minimum_required(VERSION 3.10)
project(vnx)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT WIN32)
add_compile_options(-Wall)
endif()
find_package(Threads REQUIRED)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
add_compile_options(-fdiagnostics-color=auto)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
endif()
file(GLOB GENERATED_SOURCE_FILES generated/src/*.cpp)
if(WIN32)
list(APPEND PLATFORM_SOURCE_FILES
src/win32/Directory.cpp
src/win32/Endpoint.cpp
src/win32/Process.cpp
src/win32/Terminal.cpp
src/win32/File.cpp
src/win32/Util.cpp
)
else()
list(APPEND PLATFORM_SOURCE_FILES
src/linux/Directory.cpp
src/linux/Endpoint.cpp
src/linux/Process.cpp
src/linux/Terminal.cpp
src/linux/File.cpp
src/linux/Util.cpp
)
endif()
list(APPEND SRC_FILES
${GENERATED_SOURCE_FILES}
${PLATFORM_SOURCE_FILES}
src/test/Test.cpp
src/Authentication.cpp
src/Binary.cpp
src/Client.cpp
src/JRPC_Client.cpp
src/Config.cpp
src/CRC64.cpp
src/SHA256.cpp
src/Input.cpp
src/Module.cpp
src/ModuleBase.cpp
src/Node.cpp
src/Output.cpp
src/Pipe.cpp
src/Process.cpp
src/BaseProxy.cpp
src/Proxy.cpp
src/JRPC_Proxy.cpp
src/Publisher.cpp
src/Router.cpp
src/BaseServer.cpp
src/Server.cpp
src/JRPC_Server.cpp
src/SpyTool.cpp
src/Subscriber.cpp
src/Terminal.cpp
src/TerminalInput.cpp
src/Time.cpp
src/TimeServer.cpp
src/Topic.cpp
src/Type.cpp
src/Util.cpp
src/Value.cpp
src/Visitor.cpp
src/Variant.cpp
src/Memory.cpp
src/Object.cpp
src/Endpoint.cpp
src/Buffer.cpp
src/Thread.cpp
src/File.cpp
src/Recorder.cpp
src/RecordWriter.cpp
src/Player.cpp
src/RecordReader.cpp
src/MultiRecordReader.cpp
src/AsyncClient.cpp
src/ThreadPool.cpp
src/Return.cpp
src/LogMsg.cpp
src/Generic.cpp
src/GenericClient.cpp
src/GenericAsyncClient.cpp
src/InternalError.cpp
src/Exception.cpp
src/Session.cpp
src/JSON.cpp
src/Tuple.cpp
src/ToObject.cpp
src/PrettyPrinter.cpp
src/ModuleInfo.cpp
src/JRPC_Request.cpp
src/JRPC_Response.cpp
src/Stream.cpp
src/Gateway.cpp
src/RequestQueue.cpp
)
add_library(vnx_base SHARED
${SRC_FILES}
)
add_library(vnx_base_static STATIC
${SRC_FILES}
)
include(GenerateExportHeader)
GENERATE_EXPORT_HEADER(vnx_base)
target_include_directories(vnx_base
PUBLIC include generated/include ${CMAKE_CURRENT_BINARY_DIR}
)
target_include_directories(vnx_base_static
PUBLIC include generated/include ${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(vnx_base Threads::Threads)
target_link_libraries(vnx_base_static Threads::Threads)
target_compile_definitions(vnx_base PUBLIC NOGDI NOMINMAX)
target_compile_definitions(vnx_base_static PUBLIC NOGDI NOMINMAX VNX_BASE_STATIC_DEFINE)
if(MSVC)
include(FetchContent)
FetchContent_Declare(dirent
GIT_REPOSITORY https://github.com/tronkko/dirent.git
GIT_TAG "a318cee5adaed3dec654773fd0a02723d844461c"
)
set(DIRENT_BUILD_TESTS "off" CACHE STRING "")
FetchContent_MakeAvailable(dirent)
set(dirent_INCLUDE_DIR ${dirent_SOURCE_DIR}/include)
target_include_directories(vnx_base PUBLIC ${dirent_INCLUDE_DIR})
target_include_directories(vnx_base_static PUBLIC ${dirent_INCLUDE_DIR})
set_target_properties(vnx_base PROPERTIES ENABLE_EXPORTS ON)
set_target_properties(vnx_base PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
target_link_libraries(vnx_base ws2_32)
target_link_libraries(vnx_base_static ws2_32)
endif()
if(VNX_BUILD_TESTS)
add_subdirectory(test)
endif()
if(VNX_BUILD_TOOLS)
add_subdirectory(tools)
endif()
get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if("${LIB64}" STREQUAL "TRUE")
set(LIBSUFFIX 64)
else()
set(LIBSUFFIX "")
endif()
install(DIRECTORY include/vnx generated/include/vnx DESTINATION include)
install(DIRECTORY interface/ modules/ DESTINATION interface/vnx)
install(TARGETS vnx_base DESTINATION lib${LIBSUFFIX})
install(TARGETS vnx_base_static DESTINATION lib${LIBSUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vnx_base_export.h DESTINATION include)