diff --git a/native/cpp/CommonCpp/CMakeLists.txt b/native/cpp/CommonCpp/CMakeLists.txt index e8ff03213..008b2fa4a 100644 --- a/native/cpp/CommonCpp/CMakeLists.txt +++ b/native/cpp/CommonCpp/CMakeLists.txt @@ -1,21 +1,38 @@ project(comm-common-cpp) # 3.13+ required for CMP0079 to be set cmake_minimum_required(VERSION 3.13) include(GNUInstallDirs) add_subdirectory(grpc) add_subdirectory(CryptoTools) add_subdirectory(DatabaseManagers) add_subdirectory(NativeModules) add_subdirectory(Tools) target_link_libraries(comm-client comm-modules-native ) target_link_libraries(comm-cryptotools comm-tools comm-databasemanagers ) + +target_link_libraries(comm-modules-internal + comm-tools + comm-client +) + +target_link_libraries(comm-modules-native + comm-client + comm-cryptotools + comm-databasemanagers + comm-tools +) + +target_link_libraries(comm-modules-persistentstorage + comm-databasemanagers + comm-client +) diff --git a/native/cpp/CommonCpp/DatabaseManagers/CMakeLists.txt b/native/cpp/CommonCpp/DatabaseManagers/CMakeLists.txt index b779e1372..0c5713e3c 100644 --- a/native/cpp/CommonCpp/DatabaseManagers/CMakeLists.txt +++ b/native/cpp/CommonCpp/DatabaseManagers/CMakeLists.txt @@ -1,65 +1,66 @@ 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} ) target_include_directories(comm-databasemanagers PUBLIC + $ $ $ $ # TODO: Remove once native/cpp has a CMakeLists.txt $ PRIVATE # HACK "../../../node_modules/react-native/ReactCommon/jsi" "../../../node_modules/olm/include" ) target_link_libraries(comm-databasemanagers Folly::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) set(_builddir_export_path cmake/comm-tools/comm-databasemanagers-targets.cmake) export(TARGETS comm-databasemanagers NAMESPACE comm-databasemanagers:: FILE ${CMAKE_CURRENT_BINARY_DIR}/${_builddir_export_path} ) # For installation install(EXPORT comm-databasemanagers-export DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/comm-databasemanagers NAMESPACE comm-tools:: ) diff --git a/native/cpp/CommonCpp/NativeModules/CMakeLists.txt b/native/cpp/CommonCpp/NativeModules/CMakeLists.txt index 37cc22320..4c02a8c4c 100644 --- a/native/cpp/CommonCpp/NativeModules/CMakeLists.txt +++ b/native/cpp/CommonCpp/NativeModules/CMakeLists.txt @@ -1,153 +1,127 @@ project(comm-modules) cmake_minimum_required(VERSION 3.4) include(GNUInstallDirs) -# TODO: Remove once we can link between CommonCpp projects -find_package(gRPC REQUIRED) -find_package(Olm REQUIRED) -find_package(Folly REQUIRED) - set(INTERNAL_HDRS "InternalModules/GlobalNetworkSingleton.h" "InternalModules/GlobalNetworkSingletonJNIHelper.h" "InternalModules/NetworkModule.h" "InternalModules/SocketStatus.h" ) set(INTERNAL_SRCS "InternalModules/GlobalNetworkSingleton.cpp" "InternalModules/NetworkModule.cpp" ) add_library(comm-modules-internal ${INTERNAL_HDRS} ${INTERNAL_SRCS} ) target_include_directories(comm-modules-internal PUBLIC $ - $ - $ $ ) -target_link_libraries(comm-modules-internal - Folly::folly - gRPC::grpc++ -) - set(NATIVE_HDRS "CommCoreModule.h" "MessageStoreOperations.h" "ThreadStoreOperations.h" ) set(NATIVE_SRCS "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-native PUBLIC $ - $ - $ - $ $ # HACK PRIVATE "../../../../node_modules/react-native/ReactCommon/jsi" "../../../../node_modules/react-native/ReactCommon/react/nativemodule/core" "../../../../node_modules/react-native/ReactCommon/callinvoker" ) -target_link_libraries(comm-modules-native - Olm::Olm - Folly::folly - gRPC::grpc++ -) - set(_message_path ./PersistentStorageUtilities/MessageOperationsUtilities) set(MESSAGE_HDRS ${_message_path}/MessageOperationsUtilities.h ${_message_path}/MessageSpecs.h ) set(MESSAGE_SRCS ${_message_path}/MessageOperationsUtilities.cpp ) file(GLOB MESSAGE_SPEC_HDRS ${_message_path}/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" ) -target_link_libraries(comm-modules-persistentstorage - Olm::Olm - Folly::folly -) - 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/InternalModules) install(FILES ${NATIVE_HDRS} DESTINATION include/NativeModules) install(FILES ${MESSAGE_HDRS} DESTINATION include/PersistentStorageUtilities) install(FILES ${MESSAGE_SPEC_HDRS} DESTINATION include/PersistentStorageUtilities/MessageSpecs ) install(FILES ${THREAD_OP_HDRS} DESTINATION include/ThreadOperationsUtilities) 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:: )