blob: 07fea51827bdb0146e56d20f0f324460ae6ea510 (
plain) (
blame)
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
|
if(MSVC)
add_compile_options(/W4 /WX)
else()
add_compile_options(-Wall -Wextra -Werror)
endif()
add_compile_definitions(_GNU_SOURCE)
add_compile_definitions(VERSION="${PROJECT_VERSION}")
set(DEFAULT_HOST "127.0.0.1" CACHE STRING "Set the default --host value")
add_compile_definitions(DEFAULT_HOST="${DEFAULT_HOST}")
function(add_my_executable name)
list(POP_FRONT ARGV)
add_executable("${name}" ${ARGV})
set_target_properties("${name}" PROPERTIES OUTPUT_NAME "${PROJECT_NAME}-${name}")
install(TARGETS "${name}" RUNTIME DESTINATION bin)
endfunction()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
function(generate_sql_header engine)
file(GLOB sql_files "${CMAKE_CURRENT_SOURCE_DIR}/${engine}/*.sql")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/sql/${engine}_sql.h"
COMMAND Python3::Interpreter
"${CMAKE_CURRENT_SOURCE_DIR}/generate-sql-header.py"
"${CMAKE_CURRENT_SOURCE_DIR}/${engine}/"
-o "${CMAKE_CURRENT_BINARY_DIR}/sql/${engine}_sql.h"
DEPENDS ${sql_files})
endfunction()
generate_sql_header(sqlite)
add_my_executable(server server_main.c server.c
ci_queue.c
msg.c
net.c
signal.c
sql/sqlite_sql.h
sqlite.c
storage.c
storage_sqlite.c
tcp_server.c)
target_link_libraries(server PRIVATE pthread sqlite3)
target_include_directories(server PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
add_my_executable(client client_main.c client.c
msg.c
net.c)
add_my_executable(worker worker_main.c worker.c
ci.c
file.c
git.c
msg.c
net.c
process.c
signal.c)
target_link_libraries(worker PRIVATE git2 pthread)
|