Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32600302
D4489.1767431630.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D4489.1767431630.diff
View Options
diff --git a/services/lib/src/CMakeLists.txt b/services/lib/src/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/services/lib/src/CMakeLists.txt
@@ -0,0 +1,58 @@
+project(comm-services-common)
+cmake_minimum_required(VERSION 3.4)
+
+include(GNUInstallDirs)
+
+# Export reactors
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/client-base-reactors)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/server-base-reactors)
+
+file(GLOB COMMON_HDRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+)
+
+file(GLOB COMMON_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+)
+
+add_library(comm-services-common
+ ${COMMON_HDRS}
+ ${COMMON_SRCS}
+)
+
+find_package(AWSSDK REQUIRED COMPONENTS core dynamodb)
+find_package(gRPC REQUIRED)
+
+target_link_libraries(comm-services-common
+ aws-sdk-cpp-core
+ aws-sdk-cpp-dynamodb
+ gRPC::grpc++
+)
+
+# reference local directory when building, use installation path when installing
+target_include_directories(comm-services-common
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+install(TARGETS comm-services-common EXPORT comm-services-common-export
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT comm-services-common
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-services-common
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-services-common
+)
+
+install(FILES ${COMMON_HDRS} DESTINATION include)
+
+# For development purposes, can point cmake to this directory if doing development
+export(TARGETS comm-services-common
+ NAMESPACE comm-services-common::
+ FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/comm-services-common/comm-services-common-targets.cmake
+)
+
+# For installation
+install(EXPORT comm-services-common-export
+ FILE comm-services-common-targets.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/comm-tool
+ NAMESPACE comm-services-common::
+)
diff --git a/services/lib/src/DatabaseEntitiesTools.h b/services/lib/src/DatabaseEntitiesTools.h
new file mode 100644
--- /dev/null
+++ b/services/lib/src/DatabaseEntitiesTools.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "Item.h"
+
+#include <memory>
+#include <type_traits>
+
+namespace comm {
+namespace network {
+namespace database {
+
+template <typename T> std::shared_ptr<T> createItemByType() {
+ static_assert(std::is_base_of<Item, T>::value, "T must inherit from Item");
+ return std::make_shared<T>();
+}
+
+} // namespace database
+} // namespace network
+} // namespace comm
diff --git a/services/lib/src/DynamoDBTools.h b/services/lib/src/DynamoDBTools.h
--- a/services/lib/src/DynamoDBTools.h
+++ b/services/lib/src/DynamoDBTools.h
@@ -1,7 +1,5 @@
#pragma once
-#include "Constants.h"
-
#include <aws/core/Aws.h>
#include <aws/dynamodb/DynamoDBClient.h>
diff --git a/services/lib/src/DynamoDBTools.cpp b/services/lib/src/DynamoDBTools.cpp
--- a/services/lib/src/DynamoDBTools.cpp
+++ b/services/lib/src/DynamoDBTools.cpp
@@ -1,5 +1,4 @@
#include "DynamoDBTools.h"
-#include "Constants.h"
#include "GlobalConstants.h"
#include "GlobalTools.h"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 3, 9:13 AM (11 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5887451
Default Alt Text
D4489.1767431630.diff (2 KB)
Attached To
Mode
D4489: [Services] Export shared services cpp as CMake Project
Attached
Detach File
Event Timeline
Log In to Comment