diff --git a/native/cpp/CommonCpp/NativeModules/CMakeLists.txt b/native/cpp/CommonCpp/NativeModules/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/native/cpp/CommonCpp/NativeModules/CMakeLists.txt @@ -0,0 +1,128 @@ +project(comm-modules) +cmake_minimum_required(VERSION 3.4) + +include(GNUInstallDirs) + +set(INTERNAL_HDRS + "Internal/GlobalNetworkSingleton.h" + "Internal/GlobalNetworkSingletonJNIHelper.h" + "Internal/NetworkModule.h" + "Internal/SocketStatus.h" +) + +set(INTERNAL_SRCS + "Internal/GlobalNetworkSingleton.cpp" + "Internal/NetworkModule.cpp" +) + +add_library(comm-modules-internal + ${INTERNAL_HDRS} + ${INTERNAL_SRCS} +) + +target_link_libraries(comm-modules-internal + comm-tools +) + +set(NATIVE_HDRS + "Native/CommCoreModule.h" + "Native/MessageStoreOperations.h" + "Native/ThreadStoreOperations.h" +) + +set(NATIVE_SRCS + "Native/CommCoreModule.cpp" +) + +add_library(comm-modules-native + ${NATIVE_HDRS} + ${NATIVE_SRCS} +) + +set_target_properties(comm-modules-native PROPERTIES LINKER_LANGUAGE CXX) + +# reference local directory when building, use installation path when installing +target_include_directories(comm-modules-internal + PUBLIC + $ + $ +) + +target_include_directories(comm-modules-native + PUBLIC + $ + $ + PRIVATE + # HACK + "../../../node_modules/react-native/ReactCommon/jsi" + "../../../node_modules/react-native/ReactCommon/react/nativemodule/core" + "../../../node_modules/react-native/ReactCommon/callinvoker" +) + +set(MESSAGE_HDRS + ./PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.h + ./PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs.h +) + +set(MESSAGE_SRCS + ./PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.h +) + +file(GLOB MESSAGE_SPEC_HDRS + ./PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs/*.h +) + +file(GLOB THREAD_OP_HDRS + ./PersistentStorageUtilities/ThreadOperationsUtilities/*.h +) +set(THREAD_OP_SRCS + ./PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.cpp +) + +add_library(comm-modules-persistentstorage + ${MESSAGE_HDRS} + ${MESSAGE_SRCS} + ${MESSAGE_SPEC_HDRS} + ${THREAD_OP_HDRS} + ${THREAD_OP_SRCS} +) + +# reference local directory when building, use installation path when installing +target_include_directories(comm-modules-persistentstorage + PUBLIC + $ + $ + PRIVATE + # HACK + "../../../node_modules/react-native/ReactCommon/jsi" +) + +set(_components internal native persistentstorage) +foreach(_component ${_components}) + + install(TARGETS comm-modules-${_component} EXPORT comm-modules-export + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT comm-modules + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-modules + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-modules + ) + +endforeach() + +install(FILES ${INTERNAL_HDRS} DESTINATION include/Internal) +install(FILES ${NATIVE_HDRS} DESTINATION include/Native) +install(FILES ${MESSAGE_HDRS} DESTINATION include/PersistentStorageUtilities) +install(FILES ${MESSAGE_SPEC_HDRS} DESTINATION include/PersistentStorageUtilities/MessageSpecs) +install(FILES ${THREAD_OP_HDRS} DESTINATION include/ThreadOperationsUtilities) + +# For development purposes, can point cmake to this directory if doing development +export(TARGETS comm-modules-internal comm-modules-native + NAMESPACE comm-modules:: + FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/comm-modules/comm-modules-targets.cmake +) + +# For installation +install(EXPORT comm-modules-export + FILE comm-modules-targets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/comm-modules + NAMESPACE comm-modules:: +) diff --git a/native/cpp/CommonCpp/NativeModules/InternalModules/GlobalNetworkSingleton.h b/native/cpp/CommonCpp/NativeModules/Internal/GlobalNetworkSingleton.h rename from native/cpp/CommonCpp/NativeModules/InternalModules/GlobalNetworkSingleton.h rename to native/cpp/CommonCpp/NativeModules/Internal/GlobalNetworkSingleton.h --- a/native/cpp/CommonCpp/NativeModules/InternalModules/GlobalNetworkSingleton.h +++ b/native/cpp/CommonCpp/NativeModules/Internal/GlobalNetworkSingleton.h @@ -1,7 +1,7 @@ #pragma once -#include "../../Tools/WorkerThread.h" -#include "NetworkModule.h" +#include +#include #include #include diff --git a/native/cpp/CommonCpp/NativeModules/InternalModules/GlobalNetworkSingleton.cpp b/native/cpp/CommonCpp/NativeModules/Internal/GlobalNetworkSingleton.cpp rename from native/cpp/CommonCpp/NativeModules/InternalModules/GlobalNetworkSingleton.cpp rename to native/cpp/CommonCpp/NativeModules/Internal/GlobalNetworkSingleton.cpp --- a/native/cpp/CommonCpp/NativeModules/InternalModules/GlobalNetworkSingleton.cpp +++ b/native/cpp/CommonCpp/NativeModules/Internal/GlobalNetworkSingleton.cpp @@ -1,4 +1,4 @@ -#include "GlobalNetworkSingleton.h" +#include namespace comm { GlobalNetworkSingleton GlobalNetworkSingleton::instance; diff --git a/native/cpp/CommonCpp/NativeModules/InternalModules/GlobalNetworkSingletonJNIHelper.h b/native/cpp/CommonCpp/NativeModules/Internal/GlobalNetworkSingletonJNIHelper.h rename from native/cpp/CommonCpp/NativeModules/InternalModules/GlobalNetworkSingletonJNIHelper.h rename to native/cpp/CommonCpp/NativeModules/Internal/GlobalNetworkSingletonJNIHelper.h diff --git a/native/cpp/CommonCpp/NativeModules/InternalModules/NetworkModule.h b/native/cpp/CommonCpp/NativeModules/Internal/NetworkModule.h rename from native/cpp/CommonCpp/NativeModules/InternalModules/NetworkModule.h rename to native/cpp/CommonCpp/NativeModules/Internal/NetworkModule.h --- a/native/cpp/CommonCpp/NativeModules/InternalModules/NetworkModule.h +++ b/native/cpp/CommonCpp/NativeModules/Internal/NetworkModule.h @@ -1,7 +1,7 @@ #pragma once -#include "../../grpc/Client.h" -#include "SocketStatus.h" +#include +#include #include #include diff --git a/native/cpp/CommonCpp/NativeModules/InternalModules/NetworkModule.cpp b/native/cpp/CommonCpp/NativeModules/Internal/NetworkModule.cpp rename from native/cpp/CommonCpp/NativeModules/InternalModules/NetworkModule.cpp rename to native/cpp/CommonCpp/NativeModules/Internal/NetworkModule.cpp --- a/native/cpp/CommonCpp/NativeModules/InternalModules/NetworkModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/Internal/NetworkModule.cpp @@ -1,5 +1,5 @@ -#include "NetworkModule.h" -#include "Logger.h" +#include +#include namespace comm { void NetworkModule::initializeNetworkModule( diff --git a/native/cpp/CommonCpp/NativeModules/InternalModules/SocketStatus.h b/native/cpp/CommonCpp/NativeModules/Internal/SocketStatus.h rename from native/cpp/CommonCpp/NativeModules/InternalModules/SocketStatus.h rename to native/cpp/CommonCpp/NativeModules/Internal/SocketStatus.h diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/Native/CommCoreModule.h rename from native/cpp/CommonCpp/NativeModules/CommCoreModule.h rename to native/cpp/CommonCpp/NativeModules/Native/CommCoreModule.h --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h +++ b/native/cpp/CommonCpp/NativeModules/Native/CommCoreModule.h @@ -1,10 +1,10 @@ #pragma once -#include "../CryptoTools/CryptoModule.h" -#include "../Tools/CommSecureStore.h" -#include "../Tools/WorkerThread.h" -#include "../_generated/NativeModules.h" -#include "../grpc/Client.h" +#include +#include +#include +#include <_generated/NativeModules.h> +#include #include #include diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/Native/CommCoreModule.cpp rename from native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp rename to native/cpp/CommonCpp/NativeModules/Native/CommCoreModule.cpp --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/Native/CommCoreModule.cpp @@ -1,16 +1,15 @@ -#include "CommCoreModule.h" -#include "DatabaseManager.h" -#include "GRPCStreamHostObject.h" -#include "InternalModules/GlobalNetworkSingleton.h" -#include "InternalModules/NetworkModule.h" -#include "Logger.h" -#include "MessageStoreOperations.h" -#include "ThreadStoreOperations.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include "../DatabaseManagers/entities/Media.h" - #include #include diff --git a/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h b/native/cpp/CommonCpp/NativeModules/Native/MessageStoreOperations.h rename from native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h rename to native/cpp/CommonCpp/NativeModules/Native/MessageStoreOperations.h --- a/native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h +++ b/native/cpp/CommonCpp/NativeModules/Native/MessageStoreOperations.h @@ -1,8 +1,8 @@ #pragma once -#include "../DatabaseManagers/entities/Media.h" -#include "../DatabaseManagers/entities/Message.h" -#include "DatabaseManager.h" +#include +#include +#include #include namespace comm { diff --git a/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h b/native/cpp/CommonCpp/NativeModules/Native/ThreadStoreOperations.h rename from native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h rename to native/cpp/CommonCpp/NativeModules/Native/ThreadStoreOperations.h --- a/native/cpp/CommonCpp/NativeModules/ThreadStoreOperations.h +++ b/native/cpp/CommonCpp/NativeModules/Native/ThreadStoreOperations.h @@ -1,8 +1,8 @@ #pragma once -#include "../DatabaseManagers/entities/Media.h" -#include "../DatabaseManagers/entities/Thread.h" -#include "DatabaseManager.h" +#include +#include +#include #include namespace comm { diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.h --- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.h +++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.h @@ -1,8 +1,8 @@ #pragma once -#include "../../../DatabaseManagers/DatabaseManager.h" -#include "../../../DatabaseManagers/entities/Media.h" -#include "../../../DatabaseManagers/entities/Message.h" +#include +#include +#include #include #include diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.cpp --- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.cpp +++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilities.cpp @@ -1,6 +1,6 @@ #include "MessageOperationsUtilities.h" -#include "Logger.h" #include "MessageSpecs.h" +#include #include #include diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.h --- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.h +++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.h @@ -1,6 +1,6 @@ #pragma once -#include "../../../DatabaseManagers/entities/Thread.h" +#include #include diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.cpp --- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.cpp +++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.cpp @@ -1,6 +1,7 @@ #include "ThreadOperations.h" -#include "../../../DatabaseManagers/DatabaseManager.h" -#include "Logger.h" +#include +#include + #include #include #include