-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat cmake: add download_userver() and cmake presets #84
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d5814c7
feat cmake: download userver using CPM unless installed
Anton3 1c7dfee
Fix
Anton3 1e8dfd4
Fix
Anton3 ee74b54
Fix
Anton3 f6b25e4
Fix
Anton3 c872c8a
Fix
Anton3 4f5596b
Fix
Anton3 033e4ca
Fix
Anton3 e2dea06
Fix
Anton3 4c459fa
Fix
Anton3 ecb1964
Fix
Anton3 b619949
Scrap compat presets, leave them to the user
Anton3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,9 +44,9 @@ jobs: | |
|
||
- name: Install packages | ||
run: | | ||
(cd third_party && git clone -b develop --single-branch --depth 1 https://github.com/userver-framework/userver.git) | ||
DEPS_FILE="https://raw.githubusercontent.com/userver-framework/userver/refs/heads/develop/scripts/docs/en/deps/${{matrix.os}}.md" | ||
sudo apt update | ||
sudo apt install --allow-downgrades -y $(cat third_party/userver/scripts/docs/en/deps/${{matrix.os}}.md | tr '\n' ' ') | ||
sudo apt install --allow-downgrades -y $(wget -q -O - ${DEPS_FILE} | tr '\n' ' ') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tr не нужен |
||
python3 -m pip install -r requirements.txt | ||
|
||
- name: Setup ccache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
}, | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Убрал |
||
"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" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
include_guard(GLOBAL) | ||
|
||
function(download_userver) | ||
set(OPTIONS) | ||
set(ONE_VALUE_ARGS TRY_DIR VERSION GIT_TAG) | ||
set(MULTI_VALUE_ARGS) | ||
cmake_parse_arguments( | ||
ARG "${OPTIONS}" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN} | ||
) | ||
|
||
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() | ||
|
||
if(NOT DEFINED CPM_USE_NAMED_CACHE_DIRECTORIES) | ||
set(CPM_USE_NAMED_CACHE_DIRECTORIES ON) | ||
endif() | ||
|
||
CPMAddPackage( | ||
NAME userver | ||
GITHUB_REPOSITORY userver-framework/userver | ||
VERSION ${ARG_VERSION} | ||
GIT_TAG ${ARG_GIT_TAG} | ||
${ARG_UNPARSED_ARGUMENTS} | ||
) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors | ||
|
||
set(CPM_DOWNLOAD_VERSION 0.40.2) | ||
set(CPM_HASH_SUM "c8cdc32c03816538ce22781ed72964dc864b2a34a310d3b7104812a5ca2d835d") | ||
|
||
if(CPM_SOURCE_CACHE) | ||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
elseif(DEFINED ENV{CPM_SOURCE_CACHE}) | ||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
else() | ||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
endif() | ||
|
||
# Expand relative path. This is important if the provided path contains a tilde (~) | ||
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) | ||
|
||
file(DOWNLOAD | ||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} | ||
) | ||
|
||
include(${CPM_DOWNLOAD_LOCATION}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем качать самый новый список? почему не качать то, что есть в репозитории в ветке?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Качаю то, что есть в репозитории (userver) в ветке (develop)
Зачем качать отдельно - потому что чтобы userver скачался через CPM, нужно вначале корректно прогнать cmake для сервиса, а для этого нужно вначале поставить пакеты, а для этого нужно вначале получить список пакетов
Мне не нравится способ, когда мы прогоняем cmake сервиса с ожидаемой ошибкой сборки и смотрим в build-директорию