Skip to content

Commit

Permalink
Provides compatibilities for spdlog which internally uses fmt::format…
Browse files Browse the repository at this point in the history
… instead of std::format.
  • Loading branch information
refvalue committed Nov 13, 2024
1 parent 9c3e103 commit ff6b414
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [ 11, 12, 13, 'latest' ]
compiler: [ 11, 12, 13 ]
preset: [ 'linux-release-user' ]
container: gcc:${{ matrix.compiler }}
steps:
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [ 16, 17, 'latest' ]
compiler: [ 16, 17 ]
preset: [ 'linux-release-user' ]
container: silkeh/clang:${{ matrix.compiler }}
steps:
Expand Down
41 changes: 21 additions & 20 deletions Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,28 @@ if(ES_WITH_TESTS)
FetchContent_MakeAvailable(googletest)
endif()

set(extra_cmake_args
-DCMAKE_CXX_STANDARD=20
-DCMAKE_CXX_STANDARD_REQUIRED=ON
)

set(extra_openssl_args no-tests no-afalgeng no-aria no-async no-autoload-config no-blake2 no-bf no-camellia no-cast no-chacha no-cmac no-cms no-cmp no-comp no-ct no-des no-dgram no-dh no-dsa no-dtls no-ec2m no-engine no-filenames no-gost no-idea no-ktls no-mdc2 no-md4 no-multiblock no-nextprotoneg no-ocsp no-ocb no-poly1305 no-psk no-rc2 no-rc4 no-rmd160 no-seed no-siphash no-siv no-srp no-srtp no-ssl3 no-ssl3-method no-ts no-ui-console no-whirlpool)

if(CMAKE_CROSSCOMPILING AND NOT EMSCRIPTEN)
# The Boost library is unnecessary if the websocketpp library is excluded
# when compiling the cpprestsdk on Windows.
message(STATUS "======== CROSS-COMPILING ========")
set(
extra_cmake_args
list(
APPEND extra_cmake_args
-DES_TOOLCHAIN_PREFIX=${ES_TOOLCHAIN_PREFIX}
)

if(ANDROID)
list(APPEND extra_openssl_args CC ${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}clang)
list(APPEND extra_cmake_args -DES_NDK_ROOT=${ES_NDK_ROOT})
endif()
elseif(EMSCRIPTEN)
set(extra_cmake_args "")
else()
set(extra_cmake_args "")
endif()

es_make_openssl(
REQUIRED
STATIC
${runtime_args}
PARALLEL_BUILD
SYNC_BUILD_TYPE
${extra_openssl_args}
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/third-party/openssl
)

message(STATUS "====OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}")

es_make_install_third_party_library(
fmt
REQUIRED
Expand All @@ -93,8 +82,6 @@ es_make_install_third_party_library(
GENERATOR ${CMAKE_GENERATOR}
CMAKE_ARGS
-DFMT_TEST=OFF
-DCMAKE_CXX_STANDARD=20
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
${extra_cmake_args}
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/third-party/fmt
Expand All @@ -116,13 +103,27 @@ es_make_install_third_party_library(
GENERATOR ${CMAKE_GENERATOR}
CMAKE_ARGS
-DSPDLOG_BUILD_PIC=ON
-DSPDLOG_BUILD_EXAMPLE=OFF
-DSPDLOG_BUILD_EXAMPLE_HO=OFF
-DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX}
${extra_cmake_args}
${spdlog_extra_args}
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/third-party/spdlog
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
)

es_make_openssl(
REQUIRED
STATIC
${runtime_args}
PARALLEL_BUILD
SYNC_BUILD_TYPE
${extra_openssl_args}
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/third-party/openssl
)

message(STATUS "====OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}")

set(
zlibng_cmake_args
-DZLIB_ENABLE_TESTS=OFF
Expand Down
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ target_include_directories(
target_compile_definitions(
${target_name}
PUBLIC
$<$<BOOL:${ES_HAVE_STD_FORMAT}>:CPP_ESSENCE_USE_STD_FORMAT=1>
_TURN_OFF_PLATFORM_STRING=1 # For cpprestsdk.
$<$<BOOL:${ES_HAVE_STD_FORMAT}>:CPP_ESSENCE_USE_STD_FORMAT=1>
)

target_compile_definitions(
Expand All @@ -186,6 +186,7 @@ target_compile_definitions(
INTERFACE
CPP_ESSENCE_HEADER_ONLY=1
_TURN_OFF_PLATFORM_STRING=1 # For cpprestsdk.
$<$<BOOL:${ES_HAVE_STD_FORMAT}>:CPP_ESSENCE_USE_STD_FORMAT=1>
)

target_link_libraries(
Expand Down

0 comments on commit ff6b414

Please sign in to comment.