Skip to content

Commit

Permalink
fix ydb: add SetupBrotli.cmake
Browse files Browse the repository at this point in the history
0ec8b712e1c06398c81ff76879d6eb5294051bc8
  • Loading branch information
kpavlov00 committed Jul 17, 2024
1 parent 8c64d69 commit 1568633
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
1 change: 1 addition & 0 deletions .mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
"cmake/Sanitizers.cmake":"taxi/uservices/userver/cmake/Sanitizers.cmake",
"cmake/SetupAbseil.cmake":"taxi/uservices/userver/cmake/SetupAbseil.cmake",
"cmake/SetupAmqpCPP.cmake":"taxi/uservices/userver/cmake/SetupAmqpCPP.cmake",
"cmake/SetupBrotli.cmake":"taxi/uservices/userver/cmake/SetupBrotli.cmake",
"cmake/SetupCAres.cmake":"taxi/uservices/userver/cmake/SetupCAres.cmake",
"cmake/SetupCCTZ.cmake":"taxi/uservices/userver/cmake/SetupCCTZ.cmake",
"cmake/SetupCURL.cmake":"taxi/uservices/userver/cmake/SetupCURL.cmake",
Expand Down
40 changes: 40 additions & 0 deletions cmake/SetupBrotli.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
option(USERVER_DOWNLOAD_PACKAGE_BROTLI "Download and setup Brotli if no Brotli of matching version was found" ${USERVER_DOWNLOAD_PACKAGES})

set(USERVER_BROTLI_VERSION 1.1.0)

if (NOT USERVER_FORCE_DOWNLOAD_PACKAGES)
if (USERVER_DOWNLOAD_PACKAGE_BROTLI)
find_package(Brotli ${USERVER_BROTLI_VERSION} QUIET)
else()
find_package(Brotli ${USERVER_BROTLI_VERSION} REQUIRED)
endif()

if (Brotli_FOUND)
if(NOT TARGET Brotli::dec)
add_library(Brotli::dec ALIAS brotlidec)
endif()
if(NOT TARGET Brotli::enc)
add_library(Brotli::enc ALIAS brotlienc)
endif()
return()
endif()
endif()

include(DownloadUsingCPM)
CPMAddPackage(
NAME Brotli
VERSION ${USERVER_BROTLI_VERSION}
GITHUB_REPOSITORY google/brotli
)

set(Brotli_FOUND TRUE)
set(Brotli_VERSION ${USERVER_BROTLI_VERSION})
add_custom_target(Brotli)
write_package_stub(Brotli)

if(NOT TARGET Brotli::dec)
add_library(Brotli::dec ALIAS brotlidec)
endif()
if(NOT TARGET Brotli::enc)
add_library(Brotli::enc ALIAS brotlienc)
endif()
11 changes: 2 additions & 9 deletions cmake/SetupYdbCppSDK.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
option(USERVER_DOWNLOAD_PACKAGE_YDBCPPSDK "Download and setup ydb-cpp-sdk" ${USERVER_DOWNLOAD_PACKAGES})

include(DownloadUsingCPM)
include(SetupBrotli)

CPMAddPackage(
NAME base64
Expand All @@ -10,15 +11,6 @@ CPMAddPackage(
write_package_stub(base64)
add_library(aklomp::base64 ALIAS base64)

CPMAddPackage(
NAME Brotli
VERSION 1.1.0
GITHUB_REPOSITORY google/brotli
)
write_package_stub(Brotli)
add_library(Brotli::dec ALIAS brotlidec)
add_library(Brotli::enc ALIAS brotlienc)

CPMAddPackage(
NAME jwt-cpp
VERSION 0.7.0
Expand All @@ -43,6 +35,7 @@ CPMAddPackage(
GIT_TAG main
GITHUB_REPOSITORY ydb-platform/ydb-cpp-sdk
OPTIONS
"Brotli_VERSION ${Brotli_VERSION}"
"RAPIDJSON_INCLUDE_DIRS ${RAPIDJSON_INCLUDE_DIRS}"
"YDB_SDK_GOOGLE_COMMON_PROTOS_TARGET ${YDB_SDK_GOOGLE_COMMON_PROTOS_TARGET}"
)
Expand Down
1 change: 1 addition & 0 deletions scripts/docs/en/userver/tutorial/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ The following CMake options are used by userver:
| USERVER_DOWNLOAD_PACKAGES | Download missing third party packages and use the downloaded versions | ON |
| USERVER_PIP_USE_SYSTEM_PACKAGES | Use system python packages inside venv | OFF |
| USERVER_PIP_OPTIONS | Options for all pip calls | '' |
| USERVER_DOWNLOAD_PACKAGE_BROTLI | Download and setup Brotli if no Brotli of matching version was found | ${USERVER_DOWNLOAD_PACKAGES} |
| USERVER_DOWNLOAD_PACKAGE_CARES | Download and setup c-ares if no c-ares of matching version was found | ${USERVER_DOWNLOAD_PACKAGES} |
| USERVER_DOWNLOAD_PACKAGE_CCTZ | Download and setup cctz if no cctz of matching version was found | ${USERVER_DOWNLOAD_PACKAGES} |
| USERVER_DOWNLOAD_PACKAGE_CLICKHOUSECPP | Download and setup clickhouse-cpp | ${USERVER_DOWNLOAD_PACKAGES} |
Expand Down

0 comments on commit 1568633

Please sign in to comment.