From 5203fbece2a942037f86fc0dc15ece1b109e9e18 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sun, 22 May 2016 02:53:54 +0100 Subject: [PATCH] Move db tagging functions to a new postgresql backend lib. --- CMakeLists.txt | 1 + .../backends/postgresql/tag.hpp | 0 src/backends/postgresql/CMakeLists.txt | 21 +++++++++++++++++++ .../postgresql/tag.cpp} | 2 +- src/tag/CMakeLists.txt | 2 +- src/tag/main.cpp | 2 +- 6 files changed, 25 insertions(+), 3 deletions(-) rename src/tag/tag_postgres.hpp => include/backends/postgresql/tag.hpp (100%) create mode 100644 src/backends/postgresql/CMakeLists.txt rename src/{tag/tag_postgres.cpp => backends/postgresql/tag.cpp} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75f887d..1cee3d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,7 @@ add_subdirectory(src/common) add_subdirectory(src/machinery) add_subdirectory(lib/pbl) add_subdirectory(lib/glob2regex) +add_subdirectory(src/backends/postgresql) #Actions add_subdirectory(src/main) diff --git a/src/tag/tag_postgres.hpp b/include/backends/postgresql/tag.hpp similarity index 100% rename from src/tag/tag_postgres.hpp rename to include/backends/postgresql/tag.hpp diff --git a/src/backends/postgresql/CMakeLists.txt b/src/backends/postgresql/CMakeLists.txt new file mode 100644 index 0000000..a57cd59 --- /dev/null +++ b/src/backends/postgresql/CMakeLists.txt @@ -0,0 +1,21 @@ +project(${bare_name}-backend-postgresql CXX) + +add_library(${PROJECT_NAME} STATIC + tag.cpp +) + +#target_include_directories(${PROJECT_NAME} +#) +#target_include_directories(${PROJECT_NAME} SYSTEM +#) + +target_link_libraries(${PROJECT_NAME} + PRIVATE ${bare_name}-if + PRIVATE pq +) + +install(TARGETS ${PROJECT_NAME} + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib/static +) diff --git a/src/tag/tag_postgres.cpp b/src/backends/postgresql/tag.cpp similarity index 99% rename from src/tag/tag_postgres.cpp rename to src/backends/postgresql/tag.cpp index 7a41096..cc46cea 100644 --- a/src/tag/tag_postgres.cpp +++ b/src/backends/postgresql/tag.cpp @@ -15,7 +15,7 @@ * along with "dindexer". If not, see . */ -#include "tag_postgres.hpp" +#include "backends/postgresql/tag.hpp" #include "pq/connection.hpp" #include "dindexer-common/settings.hpp" #include diff --git a/src/tag/CMakeLists.txt b/src/tag/CMakeLists.txt index e642dc2..3a992c6 100644 --- a/src/tag/CMakeLists.txt +++ b/src/tag/CMakeLists.txt @@ -3,7 +3,6 @@ project(${bare_name}-tag CXX) add_executable(${PROJECT_NAME} main.cpp commandline.cpp - tag_postgres.cpp ) target_include_directories(${PROJECT_NAME} @@ -16,6 +15,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ${bare_name}-if PRIVATE ${bare_name}-common PRIVATE glob2regex + PRIVATE ${bare_name}-backend-postgresql ) string(REPLACE "${bare_name}-" "" ACTION_NAME "${PROJECT_NAME}") diff --git a/src/tag/main.cpp b/src/tag/main.cpp index ed0e7e1..fba9d66 100644 --- a/src/tag/main.cpp +++ b/src/tag/main.cpp @@ -18,7 +18,7 @@ #include "commandline.hpp" #include "dindexer-common/settings.hpp" #include "dindexerConfig.h" -#include "tag_postgres.hpp" +#include "backends/postgresql/tag.hpp" #include "dindexer-common/split_tags.hpp" #include "glob2regex/glob2regex.hpp" #include "enum.h"