Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3341573
D4296.id14297.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Referenced Files
None
Subscribers
None
D4296.id14297.diff
View Options
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
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+target_include_directories(comm-modules-native
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+ 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
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+ 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 <Internal/NetworkModule.h>
+#include <Tools/WorkerThread.h>
#include <functional>
#include <memory>
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 <Internal/GlobalNetworkSingleton.h>
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 <Internal/SocketStatus.h>
+#include <grpc/Client.h>
#include <memory>
#include <string>
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 <Internal/NetworkModule.h>
+#include <Tools/Logger.h>
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 <CryptoTools/CryptoModule.h>
+#include <Tools/CommSecureStore.h>
+#include <Tools/WorkerThread.h>
+#include <_generated/NativeModules.h>
+#include <grpc/Client.h>
#include <jsi/jsi.h>
#include <memory>
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 <DatabaseManagers/DatabaseManager.h>
+#include <DatabaseManagers/entities/Media.h>
+#include <Internal/GlobalNetworkSingleton.h>
+#include <Internal/NetworkModule.h>
+#include <Native/CommCoreModule.h>
+#include <Native/MessageStoreOperations.h>
+#include <Native/ThreadStoreOperations.h>
+#include <Tools/Logger.h>
+#include <grpc/GRPCStreamHostObject.h>
#include <folly/Optional.h>
-#include "../DatabaseManagers/entities/Media.h"
-
#include <ReactCommon/TurboModuleUtils.h>
#include <future>
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 <DatabaseManagers/DatabaseManager.h>
+#include <DatabaseManagers/entities/Media.h>
+#include <DatabaseManagers/entities/Message.h>
#include <vector>
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 <DatabaseManagers/DatabaseManager.h>
+#include <DatabaseManagers/entities/Media.h>
+#include <DatabaseManagers/entities/Thread.h>
#include <vector>
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 <DatabaseManagers/DatabaseManager.h>
+#include <DatabaseManagers/entities/Media.h>
+#include <DatabaseManagers/entities/Message.h>
#include <folly/dynamic.h>
#include <string>
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 <Tools/Logger.h>
#include <folly/String.h>
#include <folly/json.h>
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 <DatabaseManagers/entities/Thread.h>
#include <string>
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 <DatabaseManagers/DatabaseManager.h>
+#include <Tools/Logger.h>
+
#include <folly/String.h>
#include <folly/json.h>
#include <stdexcept>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 11:14 PM (17 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2566423
Default Alt Text
D4296.id14297.diff (13 KB)
Attached To
Mode
D4296: [services] Export native modules as CMake project, normalize structure
Attached
Detach File
Event Timeline
Log In to Comment