diff --git a/native/cpp/CommonCpp/CMakeLists.txt b/native/cpp/CommonCpp/CMakeLists.txt --- a/native/cpp/CommonCpp/CMakeLists.txt +++ b/native/cpp/CommonCpp/CMakeLists.txt @@ -32,3 +32,7 @@ target_link_libraries(comm-cryptotools comm-tools ) + +target_link_libraries(comm-databasemanagers + comm-cryptotools +) diff --git a/native/cpp/CommonCpp/DatabaseManagers/CMakeLists.txt b/native/cpp/CommonCpp/DatabaseManagers/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/native/cpp/CommonCpp/DatabaseManagers/CMakeLists.txt @@ -0,0 +1,63 @@ +project(comm-databasemanagers) +cmake_minimum_required(VERSION 3.4) + +include(GNUInstallDirs) + +find_package(folly REQUIRED) + +set(DBM_HDRS + "DatabaseManager.h" + "DatabaseQueryExecutor.h" + "SQLiteQueryExecutor.h" + "entities/Draft.h" + "entities/Media.h" + "entities/Message.h" + "entities/Metadata.h" + "entities/OlmPersistAccount.h" + "entities/OlmPersistSession.h" + "entities/Thread.h" +) + +set(DBM_SRCS + "SQLiteQueryExecutor.cpp" +) + +add_library(comm-databasemanagers + ${DBM_HDRS} + ${DBM_SRCS} +) + +# reference local directory when building, use installation path when installing +target_include_directories(comm-databasemanagers + PUBLIC + $ + $ + PRIVATE + # HACK + "../../../node_modules/react-native/ReactCommon/jsi" + "../../../node_modules/olm/include" +) + +target_link_libraries(comm-databasemanagers + folly +) + +install(TARGETS comm-databasemanagers EXPORT comm-databasemanagers-export + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT comm-databasemanagers + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-databasemanagers + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-databasemanagers +) + +install(FILES ${TOOLS_HDRS} DESTINATION include/comm/DatabaseManagers) + +# For development purposes, can point cmake to this directory if doing development +export(TARGETS comm-databasemanagers + NAMESPACE comm-databasemanagers:: + FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/comm-tools/comm-databasemanagers-targets.cmake +) + +# For installation +install(EXPORT comm-databasemanagers-export + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/comm-databasemanagers + NAMESPACE comm-tools:: +) diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h --- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h +++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h @@ -1,12 +1,12 @@ #pragma once -#include "../CryptoTools/Persist.h" -#include "entities/Draft.h" -#include "entities/Media.h" -#include "entities/Message.h" -#include "entities/OlmPersistAccount.h" -#include "entities/OlmPersistSession.h" -#include "entities/Thread.h" +#include +#include +#include +#include +#include +#include +#include #include diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h @@ -1,8 +1,8 @@ #pragma once -#include "../CryptoTools/Persist.h" -#include "DatabaseQueryExecutor.h" -#include "entities/Draft.h" +#include +#include +#include #include #include diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp @@ -1,10 +1,10 @@ -#include "SQLiteQueryExecutor.h" -#include "CommSecureStore.h" -#include "Logger.h" -#include "sqlite_orm.h" +#include +#include +#include +#include -#include "entities/Media.h" -#include "entities/Metadata.h" +#include +#include #include #include #include