mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-07 03:06:18 +08:00
+25
-6
@@ -13,6 +13,8 @@ option(REFLECTCPP_YAML "Enable YAML support" OFF)
|
||||
option(REFLECTCPP_BUILD_BENCHMARKS "Build benchmarks" OFF)
|
||||
option(REFLECTCPP_BUILD_TESTS "Build tests" OFF)
|
||||
|
||||
option(REFLECTCPP_USE_BUNDLED_DEPENDENCIES "Use the bundled dependencies" ON)
|
||||
|
||||
set(REFLECTCPP_USE_VCPKG_DEFAULT OFF)
|
||||
if (REFLECTCPP_BUILD_TESTS OR REFLECTCPP_BUILD_BENCHMARKS OR REFLECTCPP_BSON OR REFLECTCPP_CBOR OR REFLECTCPP_FLEXBUFFERS OR REFLECTCPP_MSGPACK OR REFLECTCPP_XML OR REFLECTCPP_TOML OR REFLECTCPP_YAML)
|
||||
# enable vcpkg per default if require features other than JSON
|
||||
@@ -29,15 +31,32 @@ project(reflectcpp)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
if (REFLECTCPP_BUILD_SHARED)
|
||||
add_library(reflectcpp SHARED src/yyjson.c)
|
||||
else ()
|
||||
add_library(reflectcpp STATIC src/yyjson.c)
|
||||
endif ()
|
||||
if(REFLECTCPP_USE_BUNDLED_DEPENDENCIES)
|
||||
if (REFLECTCPP_BUILD_SHARED)
|
||||
add_library(reflectcpp SHARED src/yyjson.c)
|
||||
else()
|
||||
add_library(reflectcpp STATIC src/yyjson.c)
|
||||
endif()
|
||||
else()
|
||||
if (REFLECTCPP_BUILD_SHARED)
|
||||
add_library(reflectcpp SHARED)
|
||||
else()
|
||||
add_library(reflectcpp STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(reflectcpp PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_compile_features(reflectcpp PUBLIC cxx_std_20)
|
||||
|
||||
target_include_directories(reflectcpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> )
|
||||
if(REFLECTCPP_USE_BUNDLED_DEPENDENCIES)
|
||||
target_include_directories(reflectcpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/rfl/thirdparty>)
|
||||
else()
|
||||
target_include_directories(reflectcpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DREFLECTCPP_NO_BUNDLED_DEPENDENCIES")
|
||||
find_package(ctre CONFIG REQUIRED)
|
||||
find_package(yyjson CONFIG REQUIRED)
|
||||
target_link_libraries(reflectcpp INTERFACE yyjson::yyjson)
|
||||
endif()
|
||||
|
||||
if (REFLECTCPP_BSON OR REFLECTCPP_BUILD_BENCHMARKS)
|
||||
find_package(bson-1.0 CONFIG REQUIRED)
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../ctre.hpp"
|
||||
#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES
|
||||
#include <ctre.hpp>
|
||||
#else
|
||||
#include "thirdparty/ctre.hpp"
|
||||
#endif
|
||||
|
||||
#include "Literal.hpp"
|
||||
#include "Result.hpp"
|
||||
#include "internal/StringLiteral.hpp"
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef RFL_JSON_READER_HPP_
|
||||
#define RFL_JSON_READER_HPP_
|
||||
|
||||
#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES
|
||||
#include <yyjson.h>
|
||||
#else
|
||||
#include "../thirdparty/yyjson.h"
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <concepts>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef RFL_JSON_WRITER_HPP_
|
||||
#define RFL_JSON_WRITER_HPP_
|
||||
|
||||
#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES
|
||||
#include <yyjson.h>
|
||||
#else
|
||||
#include "../thirdparty/yyjson.h"
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
#include <map>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef RFL_JSON_READ_HPP_
|
||||
#define RFL_JSON_READ_HPP_
|
||||
|
||||
#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES
|
||||
#include <yyjson.h>
|
||||
#else
|
||||
#include "../thirdparty/yyjson.h"
|
||||
#endif
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef RFL_JSON_SAVE_HPP_
|
||||
#define RFL_JSON_SAVE_HPP_
|
||||
|
||||
#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES
|
||||
#include <yyjson.h>
|
||||
#else
|
||||
#include "../thirdparty/yyjson.h"
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef RFL_JSON_TOSCHEMA_HPP_
|
||||
#define RFL_JSON_TOSCHEMA_HPP_
|
||||
|
||||
#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES
|
||||
#include <yyjson.h>
|
||||
#else
|
||||
#include "../thirdparty/yyjson.h"
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef RFL_JSON_WRITE_HPP_
|
||||
#define RFL_JSON_WRITE_HPP_
|
||||
|
||||
#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES
|
||||
#include <yyjson.h>
|
||||
#else
|
||||
#include "../thirdparty/yyjson.h"
|
||||
#endif
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
"version-string": "0.8.0",
|
||||
"builtin-baseline": "50bffcc62d7f6571eb32bc1a0b1807e77af1166c",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "ctre",
|
||||
"version>=": "3.8"
|
||||
},
|
||||
{
|
||||
"name": "flatbuffers",
|
||||
"version>=": "23.5.26#1"
|
||||
@@ -43,6 +47,10 @@
|
||||
"name": "yaml-cpp",
|
||||
"version>=": "0.8.0#1"
|
||||
},
|
||||
{
|
||||
"name": "yyjson",
|
||||
"version>=": "0.8.0"
|
||||
},
|
||||
{
|
||||
"name": "benchmark",
|
||||
"version>=": "1.8.3"
|
||||
|
||||
Reference in New Issue
Block a user