Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton3 committed Dec 13, 2024
1 parent e2dea06 commit 4c459fa
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ cmake-build-*
Testing/
.DS_Store
Makefile.local
CmakeUserPresets.json
81 changes: 81 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "debug",
"displayName": "Debug",
"description": "Fully featured Debug build, some platforms miss the required dependencies",
"inherits": [
"common-flags"
],
"binaryDir": "${sourceDir}/build_debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"USERVER_SANITIZE": "addr;ub"
}
},
{
"name": "release",
"displayName": "Release",
"description": "Fully featured Release build, some platforms miss the required dependencies",
"inherits": [
"common-flags"
],
"binaryDir": "${sourceDir}/build_release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "compat-debug",
"displayName": "Compatibility-mode Debug",
"description": "Debug build with some features (e.g. sanitizers) disabled for compatibility",
"inherits": [
"compat-flags",
"common-flags"
],
"binaryDir": "${sourceDir}/build_debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "compat-release",
"displayName": "Compatibility-mode Release",
"description": "Release build with some features disabled for compatibility",
"inherits": [
"common-flags",
"compat-flags"
],
"binaryDir": "${sourceDir}/build_release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "common-flags",
"hidden": true,
"generator": "Ninja",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_C_COMPILER": "cc",
"CMAKE_CXX_COMPILER": "c++"
}
},
{
"name": "compat-flags",
"hidden": true,
"generator": "Unix Makefiles",
"cacheVariables": {
"USERVER_FEATURE_CRYPTOPP_BLAKE2": "OFF",
"USERVER_FEATURE_GRPC_CHANNELZ": "OFF",
"USERVER_FEATURE_REDIS_HI_MALLOC": "ON"
}
}
]
}
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CMAKE_COMMON_FLAGS ?= -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
CMAKE_DEBUG_FLAGS ?= -DUSERVER_SANITIZE='addr ub'
CMAKE_RELEASE_FLAGS ?=
CMAKE_DEBUG_FLAGS ?= --preset debug
CMAKE_RELEASE_FLAGS ?= --preset release
NPROCS ?= $(shell nproc)
CLANG_FORMAT ?= clang-format
DOCKER_COMPOSE ?= docker-compose
Expand Down Expand Up @@ -42,7 +42,7 @@ test-debug test-release: test-%: build-%
# Start the service (via testsuite service runner)
.PHONY: start-debug start-release
start-debug start-release: start-%:
cmake --build build_$* -v --target=start-service_template
cmake --build build_$* -v --target start-service_template

.PHONY: service-start-debug service-start-release
service-start-debug service-start-release: service-start-%: start-%
Expand Down
18 changes: 13 additions & 5 deletions cmake/DownloadUserver.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@ function(download_userver)
ARG "${OPTIONS}" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN}
)

if(ARG_TRY_DIR AND EXISTS "${ARG_TRY_DIR}")
message(STATUS "Using userver from ${ARG_TRY_DIR}")
add_subdirectory("${ARG_TRY_DIR}")
return()
if(ARG_TRY_DIR)
get_filename_component(ARG_TRY_DIR "${ARG_TRY_DIR}" REALPATH)
if(EXISTS "${ARG_TRY_DIR}")
message(STATUS "Using userver from ${ARG_TRY_DIR}")
add_subdirectory("${ARG_TRY_DIR}" third_party/userver)
return()
endif()
endif()

include(get_cpm)

if(NOT DEFINED ARG_VERSION AND NOT DEFINED ARG_GIT_TAG)
set(ARG_GIT_TAG develop)
endif()

include(get_cpm)
if(NOT DEFINED CPM_USE_NAMED_CACHE_DIRECTORIES)
set(CPM_USE_NAMED_CACHE_DIRECTORIES ON)
endif()

CPMAddPackage(
NAME userver
GITHUB_REPOSITORY userver-framework/userver
Expand Down

0 comments on commit 4c459fa

Please sign in to comment.