Skip to content

Commit

Permalink
feat cmake: up userver (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton3 authored Dec 28, 2023
1 parent 1b69d22 commit 90c3e63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
cmake_minimum_required(VERSION 3.12)
project(pg_grpc_service_template CXX)

# Disable userver libraries that are not needed in this project
set(USERVER_FEATURE_MONGODB OFF CACHE BOOL "" FORCE)
set(USERVER_FEATURE_REDIS OFF CACHE BOOL "" FORCE)
set(USERVER_FEATURE_CLICKHOUSE OFF CACHE BOOL "" FORCE)
set(USERVER_FEATURE_RABBITMQ OFF CACHE BOOL "" FORCE)
# Enable userver libraries that are needed in this project
set(USERVER_FEATURE_POSTGRESQL ON CACHE BOOL "" FORCE)
set(USERVER_FEATURE_GRPC ON CACHE BOOL "" FORCE)

# Compatibility mode: some systems don't support these features
set(USERVER_FEATURE_CRYPTOPP_BLAKE2 OFF CACHE BOOL "" FORCE)
Expand All @@ -14,9 +12,8 @@ set(USERVER_FEATURE_REDIS_HI_MALLOC ON CACHE BOOL "" FORCE)


# Adding userver dependency
include(third_party/userver/cmake/SetupEnvironment.cmake)
include(GNUInstallDirs)
add_subdirectory(third_party/userver)
userver_setup_environment()


# Common sources
Expand All @@ -26,11 +23,12 @@ add_library(${PROJECT_NAME}_objs OBJECT
src/hello_client.hpp
src/hello_client.cpp
)
# Grpc enable
include(GrpcTargets)
add_grpc_library(${PROJECT_NAME}_proto PROTOS handlers/hello.proto)
target_link_libraries(${PROJECT_NAME}_objs PUBLIC userver-postgresql)

target_link_libraries(${PROJECT_NAME}_objs PUBLIC userver-postgresql ${PROJECT_NAME}_proto)
# Create a proto library with userver extensions
include(GrpcTargets)
userver_add_grpc_library(${PROJECT_NAME}_proto PROTOS handlers/hello.proto)
target_link_libraries(${PROJECT_NAME}_objs PUBLIC ${PROJECT_NAME}_proto)


# The Service
Expand Down Expand Up @@ -61,6 +59,8 @@ userver_testsuite_add_simple()


# Install
include(GNUInstallDirs)

if(DEFINED ENV{PREFIX})
message(STATUS "Set install prefix: $ENV{PREFIX}")
file(TO_CMAKE_PATH "$ENV{PREFIX}" PREFIX_PATH)
Expand Down
2 changes: 1 addition & 1 deletion third_party/userver
Submodule userver updated 115 files

0 comments on commit 90c3e63

Please sign in to comment.