aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-04-11 02:29:57 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-04-11 02:29:57 +0200
commit85357ce9b82d595415f64c9ee3517627d158de2e (patch)
tree56e29008040ae17d9a1756b3df1a7f0455b031e2 /src/CMakeLists.txt
parentadd .editorconfig (diff)
downloadcimple-85357ce9b82d595415f64c9ee3517627d158de2e.tar.gz
cimple-85357ce9b82d595415f64c9ee3517627d158de2e.zip
actually create some tables in SQLite database
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index da1f7b1..d8ded6d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -18,15 +18,33 @@ function(add_my_executable 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}/${engine}_sql.h"
+ COMMAND Python3::Interpreter
+ "${CMAKE_CURRENT_SOURCE_DIR}/generate-sql-header.py"
+ "${CMAKE_CURRENT_SOURCE_DIR}/${engine}/"
+ -o "${CMAKE_CURRENT_BINARY_DIR}/${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
+ sqlite.c
+ sqlite_sql.h
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