diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 2445f3ce..b5056c26 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -64,4 +64,39 @@ jobs: ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY + windows-msvc-shared: + strategy: + fail-fast: false + matrix: + format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "PARQUET", "TOML", "UBJSON", "XML", "YAML"] + name: "windows-msvc-shared (${{ matrix.format }})" + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - uses: ilammy/msvc-dev-cmd@v1 + - uses: lukka/run-vcpkg@v11 + - name: Compile tests (JSON) + if: matrix.format == 'JSON' + run: | + cmake -S . -B build -DREFLECTCPP_BUILD_SHARED=ON -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release -j4 + - name: Compile tests (Other formats) + if: matrix.format != 'JSON' + run: | + cmake -S . -B build -DREFLECTCPP_BUILD_SHARED=ON -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release -j4 + - name: Run tests + run: | + ctest --test-dir build --output-on-failure + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index e2a4c744..2012b679 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,6 +179,19 @@ else() ) endif() +if(REFLECTCPP_BUILD_SHARED AND REFLECTCPP_USE_BUNDLED_DEPENDENCIES AND _REFLECTCPP_NEEDS_JSON_IMPL) + target_compile_definitions(reflectcpp + PRIVATE + YYJSON_EXPORTS + INTERFACE + YYJSON_IMPORTS + ) +endif() + +if(REFLECTCPP_BUILD_SHARED) + target_compile_definitions(reflectcpp PUBLIC RFL_BUILD_SHARED) +endif() + if(REFLECTCPP_USE_STD_EXPECTED) target_compile_definitions(reflectcpp PUBLIC REFLECTCPP_USE_STD_EXPECTED) endif() @@ -232,7 +245,20 @@ if (REFLECTCPP_AVRO) if (REFLECTCPP_USE_VCPKG) target_include_directories(reflectcpp SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") if (MSVC) - target_link_libraries(reflectcpp PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/avro${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(_AVRO_STATIC_LIB "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/avro${CMAKE_STATIC_LIBRARY_SUFFIX}") + if(REFLECTCPP_BUILD_SHARED) + message(STATUS "With whole archive ${_AVRO_STATIC_LIB}") + target_link_libraries(reflectcpp + PUBLIC + $ + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/snappy${CMAKE_STATIC_LIBRARY_SUFFIX}" + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/lzma${CMAKE_STATIC_LIBRARY_SUFFIX}" + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/jansson${CMAKE_STATIC_LIBRARY_SUFFIX}" + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/zlib${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + else() + target_link_libraries(reflectcpp PUBLIC "${_AVRO_STATIC_LIB}") + endif() else () target_link_libraries(reflectcpp PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libavro${CMAKE_STATIC_LIBRARY_SUFFIX}") endif () @@ -370,9 +396,11 @@ target_sources(reflectcpp PRIVATE ${REFLECT_CPP_SOURCES}) target_precompile_headers(reflectcpp PRIVATE [["rfl.hpp"]] ) if (REFLECTCPP_BUILD_TESTS) + add_library(reflectcpp_tests_crt INTERFACE) + target_link_libraries(reflectcpp_tests_crt INTERFACE reflectcpp GTest::gtest_main) + enable_testing() find_package(GTest CONFIG REQUIRED) - set(REFLECT_CPP_GTEST_LIB reflectcpp GTest::gtest_main) add_subdirectory(tests) endif () diff --git a/include/rfl/Generic.hpp b/include/rfl/Generic.hpp index 77bbbcba..eb4e90c7 100644 --- a/include/rfl/Generic.hpp +++ b/include/rfl/Generic.hpp @@ -11,10 +11,11 @@ #include "Object.hpp" #include "Result.hpp" #include "Variant.hpp" +#include "common.hpp" namespace rfl { -class Generic { +class RFL_API Generic { public: constexpr static std::nullopt_t Null = std::nullopt; diff --git a/include/rfl/avro/SchemaImpl.hpp b/include/rfl/avro/SchemaImpl.hpp index 32293d55..85e1492f 100644 --- a/include/rfl/avro/SchemaImpl.hpp +++ b/include/rfl/avro/SchemaImpl.hpp @@ -7,10 +7,11 @@ //#include "../Box.hpp" //#include "../Result.hpp" +#include "../common.hpp" namespace rfl::avro { -class SchemaImpl { +class RFL_API SchemaImpl { public: SchemaImpl(const std::string& _json_str); diff --git a/include/rfl/avro/Writer.hpp b/include/rfl/avro/Writer.hpp index 7ffed7f6..2ce8b7bf 100644 --- a/include/rfl/avro/Writer.hpp +++ b/include/rfl/avro/Writer.hpp @@ -15,10 +15,11 @@ #include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/is_literal.hpp" +#include "../common.hpp" namespace rfl::avro { -class Writer { +class RFL_API Writer { public: struct AVROOutputArray { avro_value_t val_; diff --git a/include/rfl/avro/schema/Type.hpp b/include/rfl/avro/schema/Type.hpp index 512421ab..ee76bea3 100644 --- a/include/rfl/avro/schema/Type.hpp +++ b/include/rfl/avro/schema/Type.hpp @@ -10,10 +10,11 @@ #include "../../Ref.hpp" #include "../../Rename.hpp" #include "../../Variant.hpp" +#include "../../common.hpp" namespace rfl::avro::schema { -struct Type { +struct RFL_API Type { struct Null { Literal<"null"> type{}; }; diff --git a/include/rfl/avro/to_schema.hpp b/include/rfl/avro/to_schema.hpp index fe9b82a2..ec3e56d0 100644 --- a/include/rfl/avro/to_schema.hpp +++ b/include/rfl/avro/to_schema.hpp @@ -14,10 +14,11 @@ #include "Schema.hpp" #include "Writer.hpp" //#include "schema/Type.hpp" +#include "../common.hpp" namespace rfl::avro { -std::string to_json_representation( +RFL_API std::string to_json_representation( const parsing::schema::Definition& internal_schema); /// Returns the Avro schema for a class. diff --git a/include/rfl/bson/Writer.hpp b/include/rfl/bson/Writer.hpp index 326857ff..5267b6be 100644 --- a/include/rfl/bson/Writer.hpp +++ b/include/rfl/bson/Writer.hpp @@ -17,12 +17,13 @@ #include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/ptr_cast.hpp" +#include "../common.hpp" namespace rfl { namespace bson { /// Please refer to https://mongoc.org/libbson/current/api.html -class Writer { +class RFL_API Writer { struct BSONType { bson_t val_; }; diff --git a/include/rfl/capnproto/Reader.hpp b/include/rfl/capnproto/Reader.hpp index 8613a8ce..d041b5c5 100644 --- a/include/rfl/capnproto/Reader.hpp +++ b/include/rfl/capnproto/Reader.hpp @@ -13,10 +13,11 @@ #include "../always_false.hpp" #include "../internal/is_literal.hpp" #include "../internal/ptr_cast.hpp" +#include "../common.hpp" namespace rfl::capnproto { -class Reader { +class RFL_API Reader { public: struct CapNProtoInputArray { capnp::DynamicList::Reader val_; diff --git a/include/rfl/capnproto/SchemaImpl.hpp b/include/rfl/capnproto/SchemaImpl.hpp index 74716b3d..ff783bc9 100644 --- a/include/rfl/capnproto/SchemaImpl.hpp +++ b/include/rfl/capnproto/SchemaImpl.hpp @@ -7,10 +7,11 @@ //#include "../Box.hpp" //#include "../Result.hpp" +#include "../common.hpp" namespace rfl::capnproto { -class SchemaImpl { +class RFL_API SchemaImpl { public: SchemaImpl(const std::string& _str); diff --git a/include/rfl/capnproto/Writer.hpp b/include/rfl/capnproto/Writer.hpp index 701d2d29..a9a46d05 100644 --- a/include/rfl/capnproto/Writer.hpp +++ b/include/rfl/capnproto/Writer.hpp @@ -18,10 +18,11 @@ #include "../always_false.hpp" #include "../internal/is_literal.hpp" //#include "../internal/ptr_cast.hpp" +#include "../common.hpp" namespace rfl::capnproto { -class Writer { +class RFL_API Writer { public: struct CapnProtoOutputArray { capnp::DynamicList::Builder val_; diff --git a/include/rfl/capnproto/schema/Type.hpp b/include/rfl/capnproto/schema/Type.hpp index 1bbc0f7d..bfe06247 100644 --- a/include/rfl/capnproto/schema/Type.hpp +++ b/include/rfl/capnproto/schema/Type.hpp @@ -9,10 +9,11 @@ #include "../../Ref.hpp" //#include "../../Rename.hpp" #include "../../Variant.hpp" +#include "../../common.hpp" namespace rfl::capnproto::schema { -struct Type { +struct RFL_API Type { struct Void {}; struct Bool {}; diff --git a/include/rfl/capnproto/to_schema.hpp b/include/rfl/capnproto/to_schema.hpp index f4dd3ae1..8fc31f80 100644 --- a/include/rfl/capnproto/to_schema.hpp +++ b/include/rfl/capnproto/to_schema.hpp @@ -16,10 +16,11 @@ #include "Writer.hpp" #include "Reader.hpp" //#include "schema/Type.hpp" +#include "../common.hpp" namespace rfl::capnproto { -std::string to_string_representation( +RFL_API std::string to_string_representation( const parsing::schema::Definition& internal_schema); /// This ensures that the schema is only generated once. diff --git a/include/rfl/cbor/Writer.hpp b/include/rfl/cbor/Writer.hpp index 02b1c75d..4922e975 100644 --- a/include/rfl/cbor/Writer.hpp +++ b/include/rfl/cbor/Writer.hpp @@ -12,10 +12,11 @@ //#include "../Result.hpp" #include "../Vectorstring.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl::cbor { -class Writer { +class RFL_API Writer { using Encoder = jsoncons::cbor::cbor_bytes_encoder; public: diff --git a/include/rfl/common.hpp b/include/rfl/common.hpp new file mode 100644 index 00000000..d089e3a6 --- /dev/null +++ b/include/rfl/common.hpp @@ -0,0 +1,19 @@ +#ifndef RFL_COMMON_HPP_ +#define RFL_COMMON_HPP_ + + +#ifdef RFL_BUILD_SHARED + #ifdef _WIN32 + #ifdef reflectcpp_EXPORTS + #define RFL_API __declspec(dllexport) + #else + #define RFL_API __declspec(dllimport) + #endif + #else + #define RFL_API __attribute__((visibility("default"))) + #endif +#else + #define RFL_API +#endif + +#endif \ No newline at end of file diff --git a/include/rfl/flexbuf/Writer.hpp b/include/rfl/flexbuf/Writer.hpp index 2d254f7e..df5c82ae 100644 --- a/include/rfl/flexbuf/Writer.hpp +++ b/include/rfl/flexbuf/Writer.hpp @@ -13,11 +13,12 @@ //#include "../Result.hpp" #include "../Vectorstring.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl { namespace flexbuf { -struct Writer { +struct RFL_API Writer { struct OutputArray { size_t start_; }; diff --git a/include/rfl/generic/Writer.hpp b/include/rfl/generic/Writer.hpp index 4d8c51ca..d9e8cd81 100644 --- a/include/rfl/generic/Writer.hpp +++ b/include/rfl/generic/Writer.hpp @@ -9,10 +9,11 @@ #include "../Generic.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl::generic { -struct Writer { +struct RFL_API Writer { struct OutputArray { Generic::Array* val_; }; diff --git a/include/rfl/internal/strings/strings.hpp b/include/rfl/internal/strings/strings.hpp index 6db4118e..35ec5d06 100644 --- a/include/rfl/internal/strings/strings.hpp +++ b/include/rfl/internal/strings/strings.hpp @@ -4,25 +4,27 @@ #include #include +#include "../../common.hpp" + namespace rfl::internal::strings { /// Joins a series of strings. -std::string join(const std::string& _delimiter, +RFL_API std::string join(const std::string& _delimiter, const std::vector& _strings); /// Replace all occurences of _from with _to. -std::string replace_all(const std::string& _str, const std::string& _from, +RFL_API std::string replace_all(const std::string& _str, const std::string& _from, const std::string& _to); /// Splits _str along _delimiter. -std::vector split(const std::string& _str, +RFL_API std::vector split(const std::string& _str, const std::string& _delimiter); /// Transforms the string to camel case. -std::string to_camel_case(const std::string& _str); +RFL_API std::string to_camel_case(const std::string& _str); /// Transforms the string to pascal case. -std::string to_pascal_case(const std::string& _str); +RFL_API std::string to_pascal_case(const std::string& _str); } // namespace rfl::internal::strings diff --git a/include/rfl/json/Writer.hpp b/include/rfl/json/Writer.hpp index c1521f87..4a938771 100644 --- a/include/rfl/json/Writer.hpp +++ b/include/rfl/json/Writer.hpp @@ -13,11 +13,12 @@ //#include "../Result.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl { namespace json { -class Writer { +class RFL_API Writer { public: struct YYJSONOutputArray { YYJSONOutputArray(yyjson_mut_val* _val) : val_(_val) {} diff --git a/include/rfl/json/to_schema.hpp b/include/rfl/json/to_schema.hpp index 9a0c0d03..6630e573 100644 --- a/include/rfl/json/to_schema.hpp +++ b/include/rfl/json/to_schema.hpp @@ -20,6 +20,7 @@ #include "schema/JSONSchema.hpp" // #include "schema/Type.hpp" // #include "write.hpp" +#include "../common.hpp" namespace rfl::json { @@ -31,7 +32,7 @@ struct TypeHelper> { using JSONSchemaType = rfl::Variant...>; }; -std::string to_schema_internal_schema( +RFL_API std::string to_schema_internal_schema( const parsing::schema::Definition& internal_schema, const yyjson_write_flag, const bool _no_required, const std::string& comment = ""); diff --git a/include/rfl/msgpack/Writer.hpp b/include/rfl/msgpack/Writer.hpp index 50844b74..2e58828f 100644 --- a/include/rfl/msgpack/Writer.hpp +++ b/include/rfl/msgpack/Writer.hpp @@ -13,10 +13,11 @@ //#include "../Result.hpp" #include "../Vectorstring.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl::msgpack { -class Writer { +class RFL_API Writer { public: struct MsgpackOutputArray {}; diff --git a/include/rfl/parsing/schema/Type.hpp b/include/rfl/parsing/schema/Type.hpp index 0515a9d9..0ff8e055 100644 --- a/include/rfl/parsing/schema/Type.hpp +++ b/include/rfl/parsing/schema/Type.hpp @@ -10,10 +10,11 @@ #include "../../Ref.hpp" #include "../../Variant.hpp" #include "ValidationType.hpp" +#include "../../common.hpp" namespace rfl::parsing::schema { -struct Type { +struct RFL_API Type { struct Boolean {}; struct Bytestring {}; diff --git a/include/rfl/parsing/schemaful/tuple_to_object.hpp b/include/rfl/parsing/schemaful/tuple_to_object.hpp index a8f8a2dc..38515a48 100644 --- a/include/rfl/parsing/schemaful/tuple_to_object.hpp +++ b/include/rfl/parsing/schemaful/tuple_to_object.hpp @@ -2,12 +2,13 @@ #define RFL_PARSING_SCHEMAFUL_TUPLETOOBJECT_HPP_ #include "../schema/Type.hpp" +#include "../../common.hpp" namespace rfl::parsing::schemaful { /// Schemaful formats often don't have an explicit tuple representation. /// This is the required workaround. -schema::Type::Object tuple_to_object(const schema::Type::Tuple& _tup); +RFL_API schema::Type::Object tuple_to_object(const schema::Type::Tuple& _tup); } // namespace rfl::parsing::schemaful diff --git a/include/rfl/toml/Writer.hpp b/include/rfl/toml/Writer.hpp index 09bc9bc3..afddc3fb 100644 --- a/include/rfl/toml/Writer.hpp +++ b/include/rfl/toml/Writer.hpp @@ -11,10 +11,11 @@ #include "../Ref.hpp" #include "../Result.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl::toml { -class Writer { +class RFL_API Writer { public: struct TOMLArray { ::toml::array* val_; diff --git a/include/rfl/ubjson/Writer.hpp b/include/rfl/ubjson/Writer.hpp index 752226c7..a7a09a6e 100644 --- a/include/rfl/ubjson/Writer.hpp +++ b/include/rfl/ubjson/Writer.hpp @@ -16,10 +16,11 @@ #include "../Result.hpp" #include "../Vectorstring.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl::ubjson { -class Writer { +class RFL_API Writer { using Encoder = jsoncons::ubjson::ubjson_bytes_encoder; public: diff --git a/include/rfl/xml/Writer.hpp b/include/rfl/xml/Writer.hpp index 54631118..18e0ab0a 100644 --- a/include/rfl/xml/Writer.hpp +++ b/include/rfl/xml/Writer.hpp @@ -8,11 +8,12 @@ #include "../Ref.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl { namespace xml { -struct Writer { +struct RFL_API Writer { struct XMLOutputArray { XMLOutputArray(const std::string_view& _name, const Ref& _node) diff --git a/include/rfl/yaml/Writer.hpp b/include/rfl/yaml/Writer.hpp index ae9d6ba4..2925e497 100644 --- a/include/rfl/yaml/Writer.hpp +++ b/include/rfl/yaml/Writer.hpp @@ -9,11 +9,12 @@ #include "../Ref.hpp" #include "../always_false.hpp" +#include "../common.hpp" namespace rfl { namespace yaml { -class Writer { +class RFL_API Writer { public: struct YAMLArray {}; diff --git a/tests/avro/CMakeLists.txt b/tests/avro/CMakeLists.txt index cf7972e9..bca21630 100644 --- a/tests/avro/CMakeLists.txt +++ b/tests/avro/CMakeLists.txt @@ -9,10 +9,11 @@ add_executable( target_precompile_headers(reflect-cpp-avro-tests PRIVATE [["rfl.hpp"]] ) -target_link_libraries( - reflect-cpp-avro-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-avro-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-avro-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/bson/CMakeLists.txt b/tests/bson/CMakeLists.txt index 6129f76d..ca16dd2c 100644 --- a/tests/bson/CMakeLists.txt +++ b/tests/bson/CMakeLists.txt @@ -10,10 +10,11 @@ target_precompile_headers(reflect-cpp-bson-tests PRIVATE [["rfl.hpp"]] $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/capnproto/CMakeLists.txt b/tests/capnproto/CMakeLists.txt index 4a6fb365..48997651 100644 --- a/tests/capnproto/CMakeLists.txt +++ b/tests/capnproto/CMakeLists.txt @@ -9,10 +9,11 @@ add_executable( target_precompile_headers(reflect-cpp-capnproto-tests PRIVATE [["rfl.hpp"]] ) -target_link_libraries( - reflect-cpp-capnproto-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-capnproto-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-capnproto-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/cbor/CMakeLists.txt b/tests/cbor/CMakeLists.txt index b55da773..174eed14 100644 --- a/tests/cbor/CMakeLists.txt +++ b/tests/cbor/CMakeLists.txt @@ -8,10 +8,11 @@ add_executable( ) target_precompile_headers(reflect-cpp-cbor-tests PRIVATE [["rfl.hpp"]] ) -target_link_libraries( - reflect-cpp-cbor-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-cbor-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-cbor-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/csv/CMakeLists.txt b/tests/csv/CMakeLists.txt index a435a433..085e39b4 100644 --- a/tests/csv/CMakeLists.txt +++ b/tests/csv/CMakeLists.txt @@ -10,10 +10,11 @@ target_precompile_headers(reflect-cpp-csv-tests PRIVATE [["rfl.hpp"]] target_include_directories(reflect-cpp-csv-tests SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") -target_link_libraries( - reflect-cpp-csv-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-csv-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-csv-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/flexbuffers/CMakeLists.txt b/tests/flexbuffers/CMakeLists.txt index 32ebe45e..63204e56 100644 --- a/tests/flexbuffers/CMakeLists.txt +++ b/tests/flexbuffers/CMakeLists.txt @@ -10,10 +10,11 @@ target_precompile_headers(reflect-cpp-flexbuffers-tests PRIVATE [["rfl.hpp"]] $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/generic/CMakeLists.txt b/tests/generic/CMakeLists.txt index 3ac9ae31..a6b7efd2 100644 --- a/tests/generic/CMakeLists.txt +++ b/tests/generic/CMakeLists.txt @@ -9,10 +9,11 @@ add_executable( target_include_directories(reflect-cpp-generic-tests SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") -target_link_libraries( - reflect-cpp-generic-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-generic-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-generic-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/json/CMakeLists.txt b/tests/json/CMakeLists.txt index 9889ef01..1d11e263 100644 --- a/tests/json/CMakeLists.txt +++ b/tests/json/CMakeLists.txt @@ -10,10 +10,11 @@ target_precompile_headers(reflect-cpp-json-tests PRIVATE [["rfl.hpp"]] $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/json_c_arrays_and_inheritance/CMakeLists.txt b/tests/json_c_arrays_and_inheritance/CMakeLists.txt index 280f8abc..a7f7f704 100644 --- a/tests/json_c_arrays_and_inheritance/CMakeLists.txt +++ b/tests/json_c_arrays_and_inheritance/CMakeLists.txt @@ -13,10 +13,11 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DREFLECT_CPP_C_ARRAYS_OR_INHERITANCE") target_include_directories(reflect-cpp-json-c-arrays-and-inheritance-tests SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") -target_link_libraries( - reflect-cpp-json-c-arrays-and-inheritance-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-json-c-arrays-and-inheritance-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-json-c-arrays-and-inheritance-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/msgpack/CMakeLists.txt b/tests/msgpack/CMakeLists.txt index 9793cc83..3c093dac 100644 --- a/tests/msgpack/CMakeLists.txt +++ b/tests/msgpack/CMakeLists.txt @@ -10,10 +10,11 @@ target_precompile_headers(reflect-cpp-msgpack-tests PRIVATE [["rfl.hpp"]] $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/parquet/CMakeLists.txt b/tests/parquet/CMakeLists.txt index c42b7a5b..12caaa93 100644 --- a/tests/parquet/CMakeLists.txt +++ b/tests/parquet/CMakeLists.txt @@ -10,10 +10,11 @@ target_precompile_headers(reflect-cpp-parquet-tests PRIVATE [["rfl.hpp"]] $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/toml/CMakeLists.txt b/tests/toml/CMakeLists.txt index 5e7beb2c..994a60ca 100644 --- a/tests/toml/CMakeLists.txt +++ b/tests/toml/CMakeLists.txt @@ -8,10 +8,11 @@ add_executable( ) target_precompile_headers(reflect-cpp-toml-tests PRIVATE [["rfl.hpp"]] ) -target_link_libraries( - reflect-cpp-toml-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-toml-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-toml-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/ubjson/CMakeLists.txt b/tests/ubjson/CMakeLists.txt index e375fcd0..ed5ffcac 100644 --- a/tests/ubjson/CMakeLists.txt +++ b/tests/ubjson/CMakeLists.txt @@ -8,10 +8,11 @@ add_executable( ) target_precompile_headers(reflect-cpp-ubjson-tests PRIVATE [["rfl.hpp"]] ) -target_link_libraries( - reflect-cpp-ubjson-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-ubjson-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-ubjson-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/xml/CMakeLists.txt b/tests/xml/CMakeLists.txt index d2669ebe..522c0715 100644 --- a/tests/xml/CMakeLists.txt +++ b/tests/xml/CMakeLists.txt @@ -10,10 +10,11 @@ target_precompile_headers(reflect-cpp-xml-tests PRIVATE [["rfl.hpp"]] target_include_directories(reflect-cpp-xml-tests SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") -target_link_libraries( - reflect-cpp-xml-tests - PRIVATE - "${REFLECT_CPP_GTEST_LIB}" +target_link_libraries(reflect-cpp-xml-tests PRIVATE reflectcpp_tests_crt) + +add_custom_command(TARGET reflect-cpp-xml-tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy -t $ $ + COMMAND_EXPAND_LISTS ) find_package(GTest) diff --git a/tests/yaml/CMakeLists.txt b/tests/yaml/CMakeLists.txt index 899eef04..3f32abd6 100644 --- a/tests/yaml/CMakeLists.txt +++ b/tests/yaml/CMakeLists.txt @@ -10,10 +10,11 @@ target_precompile_headers(reflect-cpp-yaml-tests PRIVATE [["rfl.hpp"]] $ + COMMAND_EXPAND_LISTS ) find_package(GTest)