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(protobuf REQUIRED) +find_package(gRPC REQUIRED) + +target_link_libraries(comm-services-common + gRPC::grpc++ + ${AWSSDK_LINK_LIBRARIES} +) + +# reference local directory when building, use installation path when installing +target_include_directories(comm-services-common + PUBLIC + $ + $ +) + +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 +#include + +namespace comm { +namespace network { +namespace database { + +template std::shared_ptr createItemByType() { + static_assert(std::is_base_of::value, "T must inherit from Item"); + return std::make_shared(); +} + +} // 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 #include 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"