Skip to content
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

update serdepp dependencies #61

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 12 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ cppm_setting()
cppm_cxx_standard(17)
cppm_compiler_option(
DEBUG
CLANG "-fprofile-instr-generate -fcoverage-mapping --coverage"
CLANG "-fprofile-instr-generate -fcoverage-mapping --coverage"
)

find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF)
find_cppkg(RapidJSON 1.1.1 MODULE rapidjson TYPE lib OPTIONAL OFF)
find_cppkg(nlohmann_json 3.10.5 MODULE nlohmann_json::nlohmann_json TYPE lib OPTIONAL OFF)
find_cppkg(Catch2 3.5.0 MODULE Catch2::Catch2WithMain TYPE lib OPTIONAL OFF)
find_cppkg(toml11 3.7.0 MODULE toml11::toml11 TYPE lib OPTIONAL OFF)
find_cppkg(RapidJSON 1.1.1 MODULE rapidjson TYPE lib OPTIONAL OFF)
find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF)
find_cppkg(fmt 10.2.0 MODULE fmt::fmt-header-only TYPE lib OPTIONAL OFF)
find_cppkg(magic_enum 0.9.5 MODULE magic_enum::magic_enum TYPE lib)
find_cppkg(nameof 0.10.3 MODULE nameof::nameof TYPE lib)
find_cppkg(nlohmann_json 3.11.3 MODULE nlohmann_json::nlohmann_json TYPE lib OPTIONAL OFF)
find_cppkg(toml11 3.7.1 MODULE toml11::toml11 TYPE lib OPTIONAL OFF)
find_cppkg(yaml-cpp 0.6.3 MODULE yaml-cpp TYPE lib OPTIONAL OFF)
find_cppkg(fmt 8.0.1 MODULE fmt::fmt-header-only TYPE lib OPTIONAL OFF)
find_cppkg(magic_enum 0.7.3 MODULE magic_enum::magic_enum TYPE lib)
find_cppkg(nameof 0.10.0 MODULE nameof::nameof TYPE lib)


cppm_target_define(serdepp STATIC
Expand Down Expand Up @@ -124,8 +124,10 @@ SOURCES

endif()

set(serdepp_global_deps PRIVATE benchmark Catch2
PUBLIC RapidJSON nlohmann_json toml11 yaml-cpp fmt magic_enum nameof)
set(serdepp_global_deps
PRIVATE benchmark Catch2
PUBLIC RapidJSON nlohmann_json toml11 yaml-cpp fmt magic_enum nameof)

cppm_target_dependencies(serdepp
${serdepp_global_deps})

Expand All @@ -144,7 +146,6 @@ cppm_target_dependencies(simple_example
cppm_target_dependencies(flatten_example
${serdepp_global_deps}
serdepp)

cppm_target_dependencies(variant_example
${serdepp_global_deps}
serdepp)
Expand Down Expand Up @@ -189,18 +190,4 @@ cppm_target_dependencies(syntax_sugar_benchmark
${serdepp_global_deps}
serdepp)


cppm_target_install(serdepp)
cppm_target_install(unittest)
cppm_target_install(serde_example1)
cppm_target_install(serde_example)
cppm_target_install(simple_example)
cppm_target_install(flatten_example)
cppm_target_install(variant_example)
cppm_target_install(parse_file_example)
cppm_target_install(struct_attribute_example)
cppm_target_install(sugar)
cppm_target_install(reflection)
cppm_target_install(print)
cppm_target_install(pointer)

1 change: 0 additions & 1 deletion cmake/cppm_loader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ endif()
#include(${CMAKE_CURRENT_BINARY_DIR}/_deps/cppm_loader_toolchains-src/load.cmake)

endif()

12 changes: 6 additions & 6 deletions cppm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@
name = "syntax_sugar_benchmark"
source = ["benchmark/syntax_benchmark.cpp"]

[[tests]]
[[test]]
name = "unittest"
source = ["tests/.*"]

[dependencies]
nameof = { version="0.10.0", link="public"}
magic_enum = { version= "0.7.3", link="public"}
fmt = {version="8.0.1", link="public", optional=true}
nameof = { version="0.10.3", link="public"}
magic_enum = { version= "0.9.5", link="public"}
fmt = {version="10.2.0", link="public", optional=true}
yaml-cpp = { version="0.6.3", link="public", optional=true}
toml11 = { version="3.7.0", link="public", optional=true}
nlohmann_json = { version="3.10.5", link="public", optional=true}
toml11 = { version="3.7.1", link="public", optional=true}
nlohmann_json = { version="3.11.3", link="public", optional=true}
RapidJSON = { version="1.1.1", link="public", optional=true}
benchmark = { version="1.5.2", optional=true}
Catch2 = {version="3.5.0", optional=true}
Expand Down
15 changes: 8 additions & 7 deletions include/serdepp/adaptor/fmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
#ifndef __SERDEPP_ADAPTOR_FMT_HPP__
#define __SERDEPP_ADAPTOR_FMT_HPP__

#include <serdepp/adaptor/sstream.hpp>
#include <fmt/format.h>
#include <fmt/ranges.h>
#include <serdepp/adaptor/sstream.hpp>

template <typename T>
struct fmt::formatter<T, std::enable_if_t<serde::type::is_struct_v<T>, char>>
: fmt::formatter<std::string> {
template <typename FormatCtx>
auto format(const T& serde_type, FormatCtx& ctx) {
return fmt::formatter<std::string>::format(serde::to_string(serde_type), ctx);
}
template <typename FormatCtx>
auto format(const T &serde_type, FormatCtx &ctx) const {
return fmt::formatter<std::string>::format(serde::to_string(serde_type),
ctx);
}
};
//
//template<>
//struct fmt::formatter<serde::serde_sstream> : fmt::formatter<std::string> {
// template<>
// struct fmt::formatter<serde::serde_sstream> : fmt::formatter<std::string> {
// template <typename FormatCtx>
// auto format(const serde::serde_sstream& serde_type, FormatCtx& ctx) {
// return fmt::formatter<std::string>::format(serde_type.str(), ctx);
Expand Down
4 changes: 2 additions & 2 deletions include/serdepp/utility.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "serdepp/serializer.hpp"
#include "serdepp/attributes.hpp"
#include <serdepp/serializer.hpp>
#include <serdepp/attributes.hpp>
#include <cstdarg>

#ifndef __SERDE_UTILITY_HPP__
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/Catch2/3.5.0/Catch2.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ project(Catch2-3.5.0-install)

set(CPPM_VERSION ${CPPM_VERSION})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(Catch2 3.5.0 URL https://github.com/catchorg/Catch2/archive/refs/tags/v3.5.0.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DCATCH_BUILD_TESTING=OFF)
download_package(Catch2 3.5.0 URL https://github.com/catchorg/Catch2/archive/refs/tags/v3.5.0.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DCATCH_BUILD_TESTING=OFF)

2 changes: 1 addition & 1 deletion thirdparty/Catch2/3.5.0/cppkg.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Catch2]
version = "3.5.0"
description = "modern, C++-native, header-only, test framework for unit-tests"
module = "Catch2::Catch2"
module = "Catch2::Catch2WithMain"
url="https://github.com/catchorg/Catch2/archive/refs/tags/v3.5.0.tar.gz"
flags="-DCATCH_BUILD_TESTING=OFF"
6 changes: 6 additions & 0 deletions thirdparty/fmt/10.2.0/cppkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[fmt]
version = "10.2.0"
description = "A modern formatting library"
module = "fmt::fmt-header-only"
url="https://github.com/fmtlib/fmt/archive/refs/tags/10.2.0.tar.gz"
flags="-DFMT_DOC=OFF -DFMT_TEST=OFF"
8 changes: 8 additions & 0 deletions thirdparty/fmt/10.2.0/fmt.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cppkg Base Dependency Downloader
cmake_minimum_required(VERSION 3.6)
project(fmt-10.2.0-install)

set(CPPM_VERSION ${CPPM_VERSION})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(fmt 10.2.0 URL https://github.com/fmtlib/fmt/archive/refs/tags/10.2.0.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DFMT_DOC=OFF -DFMT_TEST=OFF)

2 changes: 1 addition & 1 deletion thirdparty/fmt/8.0.1/fmt.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.6)
project(fmt-8.0.1-install)

set(CPPM_VERSION ${CPPM_VERSION})
set(CPPM_VERSION 0.0.13)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(fmt 8.0.1 URL https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DFMT_DOC=OFF -DFMT_TEST=OFF)

2 changes: 1 addition & 1 deletion thirdparty/magic_enum/0.7.3/magic_enum.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.6)
project(magic_enum-0.7.3-install)

set(CPPM_VERSION ${CPPM_VERSION})
set(CPPM_VERSION 0.0.13)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(magic_enum 0.7.3 URL https://github.com/Neargye/magic_enum/archive/refs/tags/v0.7.3.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF -DMAGIC_ENUM_OPT_BUILD_TESTS=OFF)

9 changes: 9 additions & 0 deletions thirdparty/magic_enum/0.9.5/cppkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[magic_enum]
version="0.9.5" #(require)
type="lib" #lib(default) | bin | cmake
description="magic enum" #(require)
module="magic_enum::magic_enum" #(require) if none_module=true -> no require
url="https://github.com/Neargye/magic_enum/releases/download/v0.9.5/magic_enum-v0.9.5.tar.gz" #(require)
flags= "-DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF -DMAGIC_ENUM_OPT_BUILD_TESTS=OFF"
#branch="" #(optional & require git)
#link="public" #default
8 changes: 8 additions & 0 deletions thirdparty/magic_enum/0.9.5/magic_enum.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cppkg Base Dependency Downloader
cmake_minimum_required(VERSION 3.6)
project(magic_enum-0.9.5-install)

set(CPPM_VERSION ${CPPM_VERSION})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(magic_enum 0.9.5 URL https://github.com/Neargye/magic_enum/releases/download/v0.9.5/magic_enum-v0.9.5.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF -DMAGIC_ENUM_OPT_BUILD_TESTS=OFF)

2 changes: 1 addition & 1 deletion thirdparty/nameof/0.10.0/nameof.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.6)
project(nameof-0.10.0-install)

set(CPPM_VERSION ${CPPM_VERSION})
set(CPPM_VERSION 0.0.13)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(nameof 0.10.0 URL https://github.com/Neargye/nameof/archive/refs/tags/v0.10.0.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DNAMEOF_OPT_BUILD_EXAMPLES=OFF -DNAMEOF_OPT_BUILD_TESTS=OFF)

7 changes: 7 additions & 0 deletions thirdparty/nameof/0.10.3/cppkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[nameof]
version="0.10.3" #(require)
type="lib" #lib(default) | bin | cmake
description="c++ name of library" #(require)
module="nameof::nameof" #(require) if none_module=true -> no require
url="https://github.com/Neargye/nameof/archive/refs/tags/v0.10.3.tar.gz" #(require)
flags="-DNAMEOF_OPT_BUILD_EXAMPLES=OFF -DNAMEOF_OPT_BUILD_TESTS=OFF"
8 changes: 8 additions & 0 deletions thirdparty/nameof/0.10.3/nameof.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cppkg Base Dependency Downloader
cmake_minimum_required(VERSION 3.6)
project(nameof-0.10.3-install)

set(CPPM_VERSION ${CPPM_VERSION})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(nameof 0.10.3 URL https://github.com/Neargye/nameof/archive/refs/tags/v0.10.3.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DNAMEOF_OPT_BUILD_EXAMPLES=OFF -DNAMEOF_OPT_BUILD_TESTS=OFF)

2 changes: 1 addition & 1 deletion thirdparty/nlohmann_json/3.10.5/cppkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description = "JSON for Morden C++"
module = "nlohmann_json::nlohmann_json"
# write download value git or url
url="https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.tar.gz"
flags="-DJSON_BuildTests=OFF -DJSON_HAS_CPP_17=ON"
flags="-DJSON_BucildTests=OFF -DJSON_HAS_CPP_17=ON"
7 changes: 7 additions & 0 deletions thirdparty/nlohmann_json/3.11.3/cppkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[nlohmann_json]
version="3.11.3" #(require)
type="lib" #lib(default) | bin | cmake
description="JSON for Morden C++" #(require)
module="nlohmann_json::nlohmann_json" #(require) if none_module=true -> no require
url="https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz" #(require)
flags="-DJSON_BuildTests=OFF -DJSON_HAS_CPP_17=ON"
8 changes: 8 additions & 0 deletions thirdparty/nlohmann_json/3.11.3/nlohmann_json.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cppkg Base Dependency Downloader
cmake_minimum_required(VERSION 3.6)
project(nlohmann_json-3.11.3-install)

set(CPPM_VERSION ${CPPM_VERSION})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(nlohmann_json 3.11.3 URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DJSON_BuildTests=OFF -DJSON_HAS_CPP_17=ON)

2 changes: 1 addition & 1 deletion thirdparty/toml11/3.7.0/toml11.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.6)
project(toml11-3.7.0-install)

set(CPPM_VERSION ${CPPM_VERSION})
set(CPPM_VERSION 0.0.13)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(toml11 3.7.0 URL https://github.com/ToruNiina/toml11/archive/refs/tags/v3.7.0.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} )

8 changes: 8 additions & 0 deletions thirdparty/toml11/3.7.1/cppkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[toml11]
version="3.7.1" #(require)
type="lib" #lib(default) | bin | cmake
description="c++ toml parser" #(require)
module="toml11::toml11" #(require) if none_module=true -> no require
url="https://github.com/ToruNiina/toml11/archive/refs/tags/v3.7.1.tar.gz" #(require)
#branch="" #(optional & require git)
#link="public" #default
8 changes: 8 additions & 0 deletions thirdparty/toml11/3.7.1/toml11.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cppkg Base Dependency Downloader
cmake_minimum_required(VERSION 3.6)
project(toml11-3.7.1-install)

set(CPPM_VERSION ${CPPM_VERSION})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(toml11 3.7.1 URL https://github.com/ToruNiina/toml11/archive/refs/tags/v3.7.1.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} )

7 changes: 7 additions & 0 deletions thirdparty/yaml-cpp/0.8.0/cppkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[yaml-cpp]
version="0.8.0" #(require)
type="lib" #lib(default) | bin | cmake
description="" #(require)
module="yaml-cpp" #(require) if none_module=true -> no require
flags="-DYAML_CPP_BUILD_TESTS=OFF"
url="https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz" #(require)
8 changes: 8 additions & 0 deletions thirdparty/yaml-cpp/0.8.0/yaml-cpp.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cppkg Base Dependency Downloader
cmake_minimum_required(VERSION 3.6)
project(yaml-cpp-0.8.0-install)

set(CPPM_VERSION ${CPPM_VERSION})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppm_loader.cmake)
download_package(yaml-cpp 0.8.0 URL https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz TYPE lib CMAKE_ARGS ${CMAKE_ARGS} -DYAML_CPP_BUILD_TESTS=OFF)