From 1c5b027e316f99c7a00b9f15cd9516e051b9d9b8 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 11 Apr 2023 22:15:19 +0200 Subject: put SQL headers to a separate directory --- src/CMakeLists.txt | 6 +++--- src/generate-sql-header.py | 2 ++ src/storage_sqlite.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.3