aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-04-11 22:15:19 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-04-11 22:15:19 +0200
commit1c5b027e316f99c7a00b9f15cd9516e051b9d9b8 (patch)
tree9ab37f9471e74359fdeecf9ad51c7ec0d579b4dd
parentsqlite: create indices (diff)
downloadcimple-1c5b027e316f99c7a00b9f15cd9516e051b9d9b8.tar.gz
cimple-1c5b027e316f99c7a00b9f15cd9516e051b9d9b8.zip
put SQL headers to a separate directory
Diffstat (limited to '')
-rw-r--r--src/CMakeLists.txt6
-rwxr-xr-xsrc/generate-sql-header.py2
-rw-r--r--src/storage_sqlite.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d8ded6d..07fea51 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,11 +23,11 @@ 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"
+ 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}/${engine}_sql.h"
+ -o "${CMAKE_CURRENT_BINARY_DIR}/sql/${engine}_sql.h"
DEPENDS ${sql_files})
endfunction()
@@ -38,8 +38,8 @@ add_my_executable(server server_main.c server.c
msg.c
net.c
signal.c
+ sql/sqlite_sql.h
sqlite.c
- sqlite_sql.h
storage.c
storage_sqlite.c
tcp_server.c)
diff --git a/src/generate-sql-header.py b/src/generate-sql-header.py
index 2cb2862..a250376 100755
--- a/src/generate-sql-header.py
+++ b/src/generate-sql-header.py
@@ -75,6 +75,8 @@ def open_output(path):
if path is None:
yield sys.stdout
else:
+ path = os.path.abspath(path)
+ os.makedirs(os.path.dirname(path))
with open(path, 'w') as fd:
yield fd
diff --git a/src/storage_sqlite.c b/src/storage_sqlite.c
index 3f2c5c5..abde621 100644
--- a/src/storage_sqlite.c
+++ b/src/storage_sqlite.c
@@ -7,8 +7,8 @@
#include "storage_sqlite.h"
#include "log.h"
+#include "sql/sqlite_sql.h"
#include "sqlite.h"
-#include "sqlite_sql.h"
#include "storage.h"
#include <sqlite3.h>