Skip to content

Commit

Permalink
update dependencies (#619)
Browse files Browse the repository at this point in the history
fmtlib now conditionally injects /utf-8, which breaks our build_info
generator. Instead we disable FMT_UNICODE for dependencies, and instead
enable this flag in our scripts. The effect is the same, but more
consistent. This patch also makes it more clean for multi-config builds
(now build_info.hxx generated for each configuration independently)
  • Loading branch information
avsej committed Jul 8, 2024
1 parent 3155d04 commit f0c530d
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ endif()
add_library(couchbase_cxx_client::couchbase_cxx_client ALIAS couchbase_cxx_client)
set_target_properties(couchbase_cxx_client PROPERTIES POSITION_INDEPENDENT_CODE ON)

target_include_directories(couchbase_cxx_client PRIVATE ${PROJECT_BINARY_DIR}/generated)
target_include_directories(couchbase_cxx_client PRIVATE ${PROJECT_BINARY_DIR}/generated ${PROJECT_BINARY_DIR}/generated_$<CONFIG>)
target_include_directories(couchbase_cxx_client PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/private)
target_include_directories(couchbase_cxx_client SYSTEM PUBLIC ${PROJECT_SOURCE_DIR}/third_party/cxx_function
${PROJECT_SOURCE_DIR}/third_party/expected/include)
Expand Down
1 change: 1 addition & 0 deletions cmake/CompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function(set_project_warnings project_name)
/w14906 # string literal cast to 'LPWSTR'
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
/permissive- # standards conformance mode for MSVC compiler.
/utf-8 # enable Unicode support
)

set(COMMON_WARNINGS
Expand Down
2 changes: 1 addition & 1 deletion cmake/StandardProjectSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(ENABLE_IPO)
endif()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" AND NOT WIN32)
add_compile_options(-fcolor-diagnostics)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
add_compile_options(-fdiagnostics-color=always)
Expand Down
12 changes: 8 additions & 4 deletions cmake/Testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ set_property(GLOBAL PROPERTY COUCHBASE_INTEGRATION_TESTS "")

macro(integration_test name)
add_executable(test_integration_${name} "${PROJECT_SOURCE_DIR}/test/test_integration_${name}.cxx")
target_include_directories(test_integration_${name} PRIVATE ${PROJECT_BINARY_DIR}/generated)
target_include_directories(test_integration_${name} PRIVATE ${PROJECT_BINARY_DIR}/generated
${PROJECT_BINARY_DIR}/generated_$<CONFIG>)
target_link_libraries(
test_integration_${name}
project_options
Expand Down Expand Up @@ -60,7 +61,8 @@ set_property(GLOBAL PROPERTY COUCHBASE_TRANSACTION_TESTS "")

macro(transaction_test name)
add_executable(test_transaction_${name} "${PROJECT_SOURCE_DIR}/test/test_transaction_${name}.cxx")
target_include_directories(test_transaction_${name} PRIVATE ${PROJECT_BINARY_DIR}/generated)
target_include_directories(test_transaction_${name} PRIVATE ${PROJECT_BINARY_DIR}/generated
${PROJECT_BINARY_DIR}/generated_$<CONFIG>)
target_link_libraries(
test_transaction_${name}
project_options
Expand Down Expand Up @@ -98,7 +100,8 @@ define_property(
set_property(GLOBAL PROPERTY COUCHBASE_UNIT_TESTS "")
macro(unit_test name)
add_executable(test_unit_${name} "${PROJECT_SOURCE_DIR}/test/test_unit_${name}.cxx")
target_include_directories(test_unit_${name} PRIVATE ${PROJECT_BINARY_DIR}/generated)
target_include_directories(test_unit_${name} PRIVATE ${PROJECT_BINARY_DIR}/generated
${PROJECT_BINARY_DIR}/generated_$<CONFIG>)
target_link_libraries(
test_unit_${name}
project_options
Expand Down Expand Up @@ -136,7 +139,8 @@ define_property(
set_property(GLOBAL PROPERTY COUCHBASE_BENCHMARKS "")
macro(integration_benchmark name)
add_executable(benchmark_integration_${name} "${PROJECT_SOURCE_DIR}/test/benchmark_integration_${name}.cxx")
target_include_directories(benchmark_integration_${name} PRIVATE ${PROJECT_BINARY_DIR}/generated)
target_include_directories(benchmark_integration_${name} PRIVATE ${PROJECT_BINARY_DIR}/generated
${PROJECT_BINARY_DIR}/generated_$<CONFIG>)
target_link_libraries(
benchmark_integration_${name}
project_options
Expand Down
24 changes: 14 additions & 10 deletions cmake/ThirdPartyDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ if(NOT TARGET fmt::fmt)
NAME
fmt
GIT_TAG
10.2.1
11.0.1
VERSION
10.2.1
11.0.1
GITHUB_REPOSITORY
"fmtlib/fmt"
OPTIONS
# Unicode support for MSVC enabled in CompilerWarnings.cmake
"FMT_UNICODE OFF"
"FMT_DOC OFF"
"FMT_INSTALL OFF"
"BUILD_SHARED_LIBS OFF"
"CMAKE_C_VISIBILITY_PRESET hidden"
"CMAKE_CXX_VISIBILITY_PRESET hidden"
Expand All @@ -39,7 +43,7 @@ if(NOT TARGET spdlog::spdlog)
NAME
spdlog
VERSION
1.13.0
1.14.1
GITHUB_REPOSITORY
"gabime/spdlog"
OPTIONS
Expand Down Expand Up @@ -92,9 +96,9 @@ if(NOT TARGET llhttp::llhttp)
NAME
llhttp
GIT_TAG
release/v9.2.0
release/v9.2.1
VERSION
9.2.0
9.2.1
GITHUB_REPOSITORY
"nodejs/llhttp"
OPTIONS
Expand All @@ -111,9 +115,9 @@ if(NOT TARGET snappy)
NAME
snappy
GIT_TAG
1.1.10
1.2.1
VERSION
1.1.10
1.2.1
GITHUB_REPOSITORY
"google/snappy"
OPTIONS
Expand Down Expand Up @@ -154,14 +158,14 @@ if(NOT TARGET taocpp::json)
endif()

if(NOT TARGET asio::asio)
# https://github.com/chriskohlhoff/asio
# https://github.com/chriskohlhoff/asio/tags
cpmaddpackage(
NAME
asio
GIT_TAG
asio-1-29-0
asio-1-30-2
VERSION
1.29.0
1.30.2
GITHUB_REPOSITORY
"chriskohlhoff/asio")
endif()
Expand Down
6 changes: 3 additions & 3 deletions cmake/VersionInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/build_config.hxx.in

file(
GENERATE
OUTPUT ${PROJECT_BINARY_DIR}/generated/couchbase/build_info.hxx
OUTPUT ${PROJECT_BINARY_DIR}/generated_$<CONFIG>/couchbase/build_info.hxx
CONTENT
"
#pragma once
Expand All @@ -87,8 +87,8 @@ file(
#define OPENSSL_PKG_CONFIG_INTERFACE_INCLUDE_DIRECTORIES \"$<$<TARGET_EXISTS:PkgConfig::PKG_CONFIG_OPENSSL>:$<TARGET_PROPERTY:PkgConfig::PKG_CONFIG_OPENSSL,INTERFACE_INCLUDE_DIRECTORIES>>\"
#define OPENSSL_PKG_CONFIG_INTERFACE_LINK_LIBRARIES \"$<$<TARGET_EXISTS:PkgConfig::PKG_CONFIG_OPENSSL>:$<TARGET_PROPERTY:PkgConfig::PKG_CONFIG_OPENSSL,INTERFACE_LINK_LIBRARIES>>\"
#define CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\"
#define CMAKE_BUILD_TYPE \"$<CONFIG>\"
#define CMAKE_VERSION \"${CMAKE_VERSION}\"
#define COUCHBASE_CXX_CLIENT_DEBUG_BUILD $<STREQUAL:$<UPPER_CASE:\"${CMAKE_BUILD_TYPE}\">,\"DEBUG\">
#define COUCHBASE_CXX_CLIENT_DEBUG_BUILD $<STREQUAL:$<UPPER_CASE:$<CONFIG>>,DEBUG>
")
1 change: 1 addition & 0 deletions core/mcbp/operation_queue.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <fmt/core.h>

#include <algorithm>
#include <iterator>
#include <memory>

namespace couchbase::core::mcbp
Expand Down
2 changes: 2 additions & 0 deletions core/mcbp/packet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <fmt/core.h>
#include <spdlog/fmt/bin_to_hex.h>

#include <iterator>

namespace couchbase::core::mcbp
{
auto
Expand Down
4 changes: 3 additions & 1 deletion core/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ target_link_libraries(
taocpp::json
fmt::fmt
spdlog::spdlog)
target_include_directories(couchbase_meta PRIVATE ${PROJECT_BINARY_DIR}/generated ${PROJECT_SOURCE_DIR}
target_include_directories(couchbase_meta PRIVATE ${PROJECT_BINARY_DIR}/generated
${PROJECT_BINARY_DIR}/generated_$<CONFIG>
${PROJECT_SOURCE_DIR}
${hdr_histogram_SOURCE_DIR}/include)

if(COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL AND COUCHBASE_CXX_CLIENT_USE_BORINGSSL_PREFIX)
Expand Down
4 changes: 3 additions & 1 deletion core/metrics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ target_link_libraries(
fmt::fmt
taocpp::json
spdlog::spdlog)
target_include_directories(couchbase_metrics PRIVATE ${PROJECT_BINARY_DIR}/generated ${PROJECT_SOURCE_DIR}
target_include_directories(couchbase_metrics PRIVATE ${PROJECT_BINARY_DIR}/generated
${PROJECT_BINARY_DIR}/generated_$<CONFIG>
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/third_party/hdr_histogram_c/src)
4 changes: 3 additions & 1 deletion core/tracing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ target_link_libraries(
taocpp::json
fmt::fmt
spdlog::spdlog)
target_include_directories(couchbase_tracing PRIVATE ${PROJECT_BINARY_DIR}/generated ${PROJECT_SOURCE_DIR})
target_include_directories(couchbase_tracing PRIVATE ${PROJECT_BINARY_DIR}/generated
${PROJECT_BINARY_DIR}/generated_$<CONFIG>
${PROJECT_SOURCE_DIR})
10 changes: 5 additions & 5 deletions couchbase-sdk-cxx-black-duck-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ components:
versions: [ 20200921 ]
fmt:
bd-id: eae20828-18b8-478f-83b3-4a058748a28b
versions: [ 10.2.1 ]
versions: [ 11.0.1 ]
spdlog:
bd-id: 7785114c-5b78-4aad-8771-72a739a1f06e
versions: [ v1.13.0 ]
versions: [ v1.14.1 ]
gsl:
bd-id: 9e753ffd-aa29-46e6-a7fc-d4b972710c0b
versions: [ 4.0.0 ]
Expand All @@ -17,13 +17,13 @@ components:
versions: [ 0.11.8 ]
llhttp:
bd-id: 0bcb0de9-f810-47e1-826b-4c3696a0c276
versions: [ v9.2.0 ]
versions: [ v9.2.1 ]
snappy:
bd-id: fd5e5c60-2c67-4d20-8be9-b7648156cef3
versions: [ 1.1.10 ]
versions: [ 1.2.1 ]
asio:
bd-id: 3739d5e9-9ad8-4845-8077-1770167a69c2
versions: [ 1.29.0 ]
versions: [ 1.30.2 ]
json:
bd-id: cae0f7d2-4279-473a-9f71-eabdd121d2e3
versions: [ 1.0.0-beta.14 ]
2 changes: 2 additions & 0 deletions test/test_integration_examples.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <tao/json.hpp>

#include <fmt/chrono.h>
#include <fmt/ranges.h>

#ifndef _WIN32
#include <sys/wait.h>
Expand Down Expand Up @@ -665,6 +666,7 @@ namespace example_fork
#include <couchbase/fmt/cas.hxx>
#include <couchbase/fmt/mutation_token.hxx>

#include <fmt/ranges.h>
#include <tao/json.hpp>

#include <sys/wait.h>
Expand Down
1 change: 1 addition & 0 deletions test/utils/test_data.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "core/mcbp/big_endian.hxx"

#include <fmt/format.h>
#include <fmt/ranges.h>

#include <chrono>
#include <filesystem>
Expand Down
1 change: 1 addition & 0 deletions tools/beam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <couchbase/fmt/retry_reason.hxx>

#include <fmt/chrono.h>
#include <fmt/ranges.h>

#include <csignal>

Expand Down

0 comments on commit f0c530d

Please sign in to comment.