-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
146 lines (121 loc) · 5.38 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
#*********************************************************************************
# Project
# _______ _________ _______ _______ __ ______
# ( ____ \\__ __/( ____ \( __ )/ \ ( __ \
# | ( \/ ) ( | ( \/| ( ) |\/) ) | ( \ )
# | | | | | (__ | | / | | | | | ) |
# | | | | | __) | (/ /) | | | | | | |
# | | | | | ( | / | | | | | | ) |
# | (____/\ | | | ) | (__) |__) (_| (__/ )
# (_______/ )_( |/ (_______)\____/(______/
#
# MIT License
# Copyright (c) 2018-2023 Evgenii Sopov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
##################################################################################
# ctf01d CMake script
cmake_minimum_required(VERSION 3.18)
project(ctf01d)
include(${CMAKE_CURRENT_SOURCE_DIR}/src.wsjcpp/CMakeLists.txt)
#### BEGIN_WSJCPP_APPEND
#### END_WSJCPP_APPEND
set(CMAKE_CXX_STANDARD 17)
set(EXECUTABLE_OUTPUT_PATH ${ctf01d_SOURCE_DIR})
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Sources
# include header dirs
list (APPEND WSJCPP_INCLUDE_DIRS "src")
list (APPEND WSJCPP_INCLUDE_DIRS "src/argument_processors")
list (APPEND WSJCPP_INCLUDE_DIRS "src/checker")
list (APPEND WSJCPP_INCLUDE_DIRS "src/scoreboard")
list (APPEND WSJCPP_INCLUDE_DIRS "src/employees")
list (APPEND WSJCPP_INCLUDE_DIRS "src/store")
list (APPEND WSJCPP_INCLUDE_DIRS "src/3rdparty/sqlite3/src")
# argument processors
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_check.cpp")
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_clean.cpp")
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_ctf01d_main.cpp")
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_services.cpp")
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_start.cpp")
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_teams.cpp")
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_version.cpp")
list (APPEND WSJCPP_SOURCES "./src/argument_processors/argument_processor_web_test.cpp")
# employees
list (APPEND WSJCPP_SOURCES "./src/employees/employ_team_logos.cpp")
list (APPEND WSJCPP_SOURCES "./src/employees/employ_flags.cpp")
list (APPEND WSJCPP_SOURCES "./src/employees/employ_scoreboard.cpp")
list (APPEND WSJCPP_SOURCES "./src/employees/employ_config.cpp")
list (APPEND WSJCPP_SOURCES "./src/employees/employ_database.cpp")
# checker
list (APPEND WSJCPP_SOURCES "src/checker/dorunchecker.cpp")
list (APPEND WSJCPP_SOURCES "src/checker/service_checker_thread.cpp")
# http_server
list (APPEND WSJCPP_SOURCES "src/ctf01d_http_server.cpp")
# scoreboard
list (APPEND WSJCPP_SOURCES "src/scoreboard/ctf01d_scoreboard.cpp")
# store
list (APPEND WSJCPP_SOURCES "src/store/ctf01d_store.cpp")
list (APPEND WSJCPP_SOURCES "src/store/http_downloader.cpp")
# main
list (APPEND WSJCPP_SOURCES "src/main.cpp")
# ZLIB
# find_package( ZLIB REQUIRED )
# if ( ZLIB_FOUND )
# list (APPEND WSJCPP_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
# include_directories( ${ZLIB_INCLUDE_DIRS} )
# list (APPEND WSJCPP_LIBRARIES ${ZLIB_LIBRARIES})
# endif( ZLIB_FOUND )
# # CURL
FIND_PACKAGE(CURL)
IF(CURL_FOUND)
list (APPEND WSJCPP_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
list (APPEND WSJCPP_LIBRARIES ${CURL_LIBRARIES})
ELSE(CURL_FOUND)
MESSAGE(FATAL_ERROR "Could not find the CURL library and development files.")
ENDIF(CURL_FOUND)
# libhv
set(WITH_OPENSSL OFF CACHE BOOL "")
set(WITH_CURL OFF CACHE BOOL "")
# set(WITH_MQTT OFF CACHE BOOL "")
# set(WITH_EVPP OFF CACHE BOOL "")
set(BUILD_EXAMPLES OFF CACHE BOOL "")
# set(WITH_HTTP_CLIENT OFF CACHE BOOL "")
set(BUILD_SHARED OFF CACHE BOOL "")
add_subdirectory(src/3rdparty/libhv)
list (APPEND WSJCPP_LIBRARIES hv_static)
list (APPEND WSJCPP_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/src/3rdparty/libhv/include/hv")
add_subdirectory(src/3rdparty/sqlite3)
# https://www.sqlite.org/threadsafe.html
# target_compile_definitions(sqlite3-static
# PRIVATE
# SQLITE_THREADSAFE=0
# )
list (APPEND WSJCPP_LIBRARIES sqlite3-static)
list (APPEND WSJCPP_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/src/3rdparty/sqlite3/src")
include_directories(${WSJCPP_INCLUDE_DIRS})
add_executable (ctf01d ${WSJCPP_SOURCES})
target_link_libraries(ctf01d -lpthread ${WSJCPP_LIBRARIES} )
install(
TARGETS
ctf01d
RUNTIME DESTINATION
${CMAKE_INSTALL_PREFIX}/bin
)