Skip to content

Commit

Permalink
feat build: macos full build
Browse files Browse the repository at this point in the history
Tests: протестировано CI
Pull Request resolved: #795

Co-authored-by: fdr400 <[email protected]>
commit_hash:8b0fa89caa2e2a73b5647b1e252310d4deb74824
  • Loading branch information
fdr400 committed Dec 25, 2024
1 parent 3a83d4d commit 77f43d2
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/workflows/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
-DUSERVER_BUILD_TESTS=1 \
-DUSERVER_FEATURE_JEMALLOC=OFF \
-DUSERVER_FEATURE_KAFKA=OFF \
-DUSERVER_FEATURE_CLICKHOUSE=OFF \
-DUSERVER_FEATURE_STACKTRACE=OFF \
-DUSERVER_FEATURE_PATCH_LIBPQ=OFF \
-DUSERVER_DOWNLOAD_PACKAGE_PROTOBUF=ON \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ jobs:
- name: Run tests (mongo)
# libbson unnecessarily overaligns structures and GCC-9 does not support overaligned new
if: matrix.info != 'g++-9 + debug + sanitize addr+ub'
if: matrix.info != 'g++-9 + release'
run: |
sudo apt install mongodb-mongosh
cd build_debug
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ jobs:
-DUSERVER_BUILD_TESTS=1
-DUSERVER_FEATURE_REDIS_HI_MALLOC=1
-DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0
-DUSERVER_FEATURE_POSTGRESQL=0
-DUSERVER_FEATURE_GRPC=0
-DUSERVER_FEATURE_GRPC_REFLECTION=0
-DUSERVER_FEATURE_OTLP=0
-DUSERVER_FEATURE_MYSQL=0
-DUSERVER_FEATURE_RABBITMQ=0
-DUSERVER_FEATURE_ROCKS=0
-DUSERVER_FEATURE_KAFKA=0
-DUSERVER_FEATURE_EASY=0
-DUSERVER_FEATURE_MONGODB=1
-DUSERVER_FEATURE_CLICKHOUSE=1
-DUSERVER_USE_LD=lld
-DUSERVER_FORCE_DOWNLOAD_ABSEIL=1
-DUSERVER_FORCE_DOWNLOAD_PROTOBUF=1
-DUSERVER_FORCE_DOWNLOAD_GRPC=1
steps:
- uses: actions/checkout@v4
Expand All @@ -44,7 +41,10 @@ jobs:
brew install $(cat scripts/docs/en/deps/macos.md)
brew install clang-format
brew install [email protected]
brew install lld
brew link postgresql@16
brew upgrade
- name: Run cmake
Expand Down
2 changes: 1 addition & 1 deletion .mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@
"cmake/modules/FindGssApi.cmake":"taxi/uservices/userver/cmake/modules/FindGssApi.cmake",
"cmake/modules/FindHiredis.cmake":"taxi/uservices/userver/cmake/modules/FindHiredis.cmake",
"cmake/modules/FindJemalloc.cmake":"taxi/uservices/userver/cmake/modules/FindJemalloc.cmake",
"cmake/modules/FindLZ4.cmake":"taxi/uservices/userver/cmake/modules/FindLZ4.cmake",
"cmake/modules/FindLibEv.cmake":"taxi/uservices/userver/cmake/modules/FindLibEv.cmake",
"cmake/modules/FindNghttp2.cmake":"taxi/uservices/userver/cmake/modules/FindNghttp2.cmake",
"cmake/modules/FindPostgreSQLInternal.cmake":"taxi/uservices/userver/cmake/modules/FindPostgreSQLInternal.cmake",
Expand All @@ -478,6 +477,7 @@
"cmake/modules/Findlibz.cmake":"taxi/uservices/userver/cmake/modules/Findlibz.cmake",
"cmake/modules/Findlibzip.cmake":"taxi/uservices/userver/cmake/modules/Findlibzip.cmake",
"cmake/modules/Findlibzstd.cmake":"taxi/uservices/userver/cmake/modules/Findlibzstd.cmake",
"cmake/modules/Findlz4.cmake":"taxi/uservices/userver/cmake/modules/Findlz4.cmake",
"cmake/modules/Findmongoc.cmake":"taxi/uservices/userver/cmake/modules/Findmongoc.cmake",
"cmake/sanitize-macos.blacklist.txt":"taxi/uservices/userver/cmake/sanitize-macos.blacklist.txt",
"cmake/sanitize.blacklist.txt":"taxi/uservices/userver/cmake/sanitize.blacklist.txt",
Expand Down
1 change: 1 addition & 0 deletions cmake/SetupClickhouseCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ CPMAddPackage(
OPTIONS
"WITH_SYSTEM_ABSEIL ON"
"WITH_SYSTEM_LZ4 ON"
"DEBUG_DEPENDENCIES OFF"
)

add_library(clickhouse-cpp ALIAS clickhouse-cpp-lib)
Expand Down
6 changes: 6 additions & 0 deletions cmake/SetupPostgresqlDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
find_package(libintl REQUIRED)
target_link_libraries(PostgreSQLInternal INTERFACE libintl)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_package(libintl REQUIRED)
find_package(Iconv REQUIRED)
target_link_libraries(PostgreSQLInternal INTERFACE libintl Iconv::Iconv "-framework Foundation")
endif()
2 changes: 1 addition & 1 deletion cmake/SetupRdKafka.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ find_package(OpenSSL COMPONENTS SSL Crypto REQUIRED)
find_package(CURL REQUIRED)
find_package(libz REQUIRED)
find_package(libzstd REQUIRED)
find_package(LZ4 REQUIRED)
find_package(lz4 REQUIRED)

if(NOT USERVER_FORCE_DOWNLOAD_PACKAGES)
if(USERVER_DOWNLOAD_PACKAGE_KAFKA)
Expand Down
5 changes: 3 additions & 2 deletions cmake/SetupRocksDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ option(USERVER_DOWNLOAD_PACKAGE_ROCKS "Download and setup RocksDB if no RocksDB

if(NOT USERVER_FORCE_DOWNLOAD_PACKAGES)
if(USERVER_DOWNLOAD_PACKAGE_ROCKS)
find_package(RocksDB QUIET)
find_package(RocksDB QUIET CONFIG)
else()
find_package(RocksDB REQUIRED)
find_package(RocksDB REQUIRED CONFIG)
endif()

if(RocksDB_FOUND)
Expand Down Expand Up @@ -36,3 +36,4 @@ CPMAddPackage(

mark_targets_as_system("${rocksdb_SOURCE_DIR}")
write_package_stub(rocksdb)
add_library(RocksDB::rocksdb ALIAS rocksdb)
2 changes: 1 addition & 1 deletion cmake/UserverGrpcTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function(userver_generate_grpc_files)
else()
set(GENERATED_PROTO_DIR "${CMAKE_CURRENT_BINARY_DIR}/proto")
endif()

get_filename_component(GENERATED_PROTO_DIR "${GENERATED_PROTO_DIR}" REALPATH BASE_DIR "/")

if(NOT "${GEN_RPC_SOURCE_PATH}" STREQUAL "")
Expand Down
3 changes: 2 additions & 1 deletion cmake/install/userver-kafka-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ find_package(userver REQUIRED COMPONENTS
core
)

include("${USERVER_CMAKE_DIR}/modules/FindLZ4.cmake")
include("${USERVER_CMAKE_DIR}/modules/Findlibz.cmake")
include("${USERVER_CMAKE_DIR}/modules/Findlz4.cmake")
include("${USERVER_CMAKE_DIR}/modules/FindRdKafka.cmake")

set(userver_kafka_FOUND TRUE)
1 change: 1 addition & 0 deletions cmake/modules/Findbson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _userver_module_find_include(
PATHS
/usr/include/libbson-1.0
/usr/local/opt/mongo-c-driver/include/libbson-1.0
/opt/homebrew/opt/mongo-c-driver/include/libbson-1.0
)

_userver_module_find_library(
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/Findlibmariadb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ _userver_module_begin(
NAME libmariadb
VERSION 3.0.3
DEBIAN_NAMES libmariadb-dev
FORMULA_NAMES mariadb
PKG_CONFIG_NAMES mariadb
)

Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/Findlibzstd.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
_userver_module_begin(
NAME libzstd
DEBIAN_NAMES libzstd-dev
FORMULA_NAMES libzstd
FORMULA_NAMES zstd
RPM_NAMES libzstd-dev
PACMAN_NAMES zstd
)
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/FindLZ4.cmake → cmake/modules/Findlz4.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_userver_module_begin(
NAME LZ4
NAME lz4
VERSION 1.9.2
DEBIAN_NAMES liblz4-dev
FORMULA_NAMES lz4
Expand All @@ -16,4 +16,4 @@ _userver_module_find_library(

_userver_module_end()

add_library(LZ4::LZ4 ALIAS LZ4)
add_library(lz4::lz4 ALIAS lz4)
1 change: 1 addition & 0 deletions cmake/modules/Findmongoc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _userver_module_find_include(
PATHS
/usr/include/libmongoc-1.0
/usr/local/opt/mongo-c/include/libmongoc-1.0
/opt/homebrew/opt/mongo-c-driver/include/libmongoc-1.0
)

_userver_module_find_library(
Expand Down
5 changes: 3 additions & 2 deletions kafka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()

userver_module(kafka
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
LINK_LIBRARIES_PRIVATE RdKafka sasl2 z libzstd LZ4 CURL::libcurl OpenSSL::SSL OpenSSL::Crypto
LINK_LIBRARIES_PRIVATE RdKafka sasl2 libz libzstd lz4::lz4 CURL::libcurl OpenSSL::SSL OpenSSL::Crypto
DBTEST_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests"
DBTEST_LINK_LIBRARIES userver::kafka-utest
DBTEST_DATABASES kafka
Expand All @@ -37,7 +37,8 @@ endif()
_userver_directory_install(COMPONENT kafka
FILES
"${USERVER_ROOT_DIR}/cmake/modules/FindRdKafka.cmake"
"${USERVER_ROOT_DIR}/cmake/modules/FindLZ4.cmake"
"${USERVER_ROOT_DIR}/cmake/modules/Findlibz.cmake"
"${USERVER_ROOT_DIR}/cmake/modules/Findlz4.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/userver/modules"
)

Expand Down
1 change: 1 addition & 0 deletions libraries/easy/src/easy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <iostream>
#include <unordered_map>

#include <fmt/ranges.h>
#include <boost/algorithm/string/replace.hpp>
#include <boost/program_options.hpp>

Expand Down
6 changes: 3 additions & 3 deletions mysql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ find_package(libmariadb REQUIRED)

userver_module(mysql
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
LINK_LIBRARIES_PRIVATE mariadb
LINK_LIBRARIES_PRIVATE libmariadb

DBTEST_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests"
UTEST_LINK_LIBRARIES mariadb
UTEST_LINK_LIBRARIES libmariadb
DBTEST_DATABASES mysql
UBENCH_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks"
UBENCH_LINK_LIBRARIES mariadb
UBENCH_LINK_LIBRARIES libmariadb
UBENCH_DATABASES mysql
)

Expand Down
2 changes: 1 addition & 1 deletion mysql/functional_tests/basic_chaos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(userver-mysql-tests-basic-chaos CXX)

add_executable(${PROJECT_NAME} "mysql_service.cpp")
target_link_libraries(${PROJECT_NAME} userver-mysql mariadb)
target_link_libraries(${PROJECT_NAME} userver::mysql)

userver_chaos_testsuite_add(
ENV "TESTSUITE_MYSQL_SERVER_START_TIMEOUT=120.0"
Expand Down
8 changes: 4 additions & 4 deletions mysql/include/userver/storages/mysql/statement_result_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ std::optional<T> StatementResultSet::AsOptionalSingleField() && {
return std::move(*this).DoAsOptionalSingleRow<T, FieldTag>();
}

template <typename Container, typename MapFrom, typename ExtractionTag>
template <typename Container, typename MapFromType, typename ExtractionTag>
Container StatementResultSet::DoAsContainerMapped() && {
static_assert(meta::kIsRange<Container>, "The type isn't actually a container");
using Extractor = impl::io::TypedExtractor<Container, MapFrom, ExtractionTag>;
using Extractor = impl::io::TypedExtractor<Container, MapFromType, ExtractionTag>;

Extractor extractor{};

Expand Down Expand Up @@ -379,13 +379,13 @@ std::vector<T> MappedStatementResultSet<DbType>::AsVector(FieldTag) && {
template <typename DbType>
template <typename Container>
Container MappedStatementResultSet<DbType>::AsContainer() && {
return std::move(result_set_).DoAsContainerMapped<Container, DbType, RowTag>();
return std::move(result_set_).template DoAsContainerMapped<Container, DbType, RowTag>();
}

template <typename DbType>
template <typename Container>
Container MappedStatementResultSet<DbType>::AsContainer(FieldTag) && {
return std::move(result_set_).DoAsContainerMapped<Container, DbType, FieldTag>();
return std::move(result_set_).template DoAsContainerMapped<Container, DbType, FieldTag>();
}

template <typename DbType>
Expand Down
2 changes: 1 addition & 1 deletion rocks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(SetupRocksDB)

userver_module(rocks
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
LINK_LIBRARIES rocksdb
LINK_LIBRARIES RocksDB::rocksdb
UTEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*_test.cpp"
)

Expand Down
1 change: 0 additions & 1 deletion samples/mysql_service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ find_package(userver COMPONENTS mysql REQUIRED)

add_executable(${PROJECT_NAME} "mysql_service.cpp")
target_link_libraries(${PROJECT_NAME} userver::mysql)
target_link_libraries(${PROJECT_NAME} mariadbclient)

userver_testsuite_add_simple()
5 changes: 2 additions & 3 deletions scripts/docs/en/deps/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ ares
cctz
libev
fmt
grpc
googletest
hiredis
jemalloc
krb5
nghttp2
ninja
protobuf
pugixml
openssl
yaml-cpp
Expand All @@ -24,6 +22,7 @@ rocksdb
postgresql@16
redis
zlib
amqp-cpp
c-ares
coreutils
mongo-c-driver
mariadb

0 comments on commit 77f43d2

Please sign in to comment.