diff --git a/.github/workflows/linux-clang-14.yaml b/.github/workflows/linux-clang-14.yaml new file mode 100644 index 00000000..76b5c646 --- /dev/null +++ b/.github/workflows/linux-clang-14.yaml @@ -0,0 +1,60 @@ +name: linux-clang-14 + +on: [ pull_request ] + +jobs: + linux-clang-14: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Run vcpkg + uses: lukka/run-vcpkg@v11 + - uses: KyleMayes/install-llvm-action@v1 + with: + version: "14" + - name: link clang lib + run: | + sudo mkdir -p /usr/lib/llvm-14/lib + sudo ln -s clang /usr/lib/llvm-14/lib/clang + working-directory: ${{ env.LLVM_PATH }}/lib + - name: Compile + env: + CC: clang + CXX: clang++ + run: | + clang --version + cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release + cmake --build build -j 4 + - name: Run tests + run: | + ./build/tests/bson/reflect-cpp-bson-tests + ./build/tests/cbor/reflect-cpp-cbor-tests + ./build/tests/flexbuffers/reflect-cpp-flexbuffers-tests + ./build/tests/json/reflect-cpp-json-tests + ./build/tests/msgpack/reflect-cpp-msgpack-tests + ./build/tests/toml/reflect-cpp-toml-tests + ./build/tests/xml/reflect-cpp-xml-tests + ./build/tests/yaml/reflect-cpp-yaml-tests + - name: Run benchmarks + run: | + echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./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 + diff --git a/.github/workflows/linux-clang.yaml b/.github/workflows/linux-clang-16.yaml similarity index 97% rename from .github/workflows/linux-clang.yaml rename to .github/workflows/linux-clang-16.yaml index 9dc22c96..f8ef8464 100644 --- a/.github/workflows/linux-clang.yaml +++ b/.github/workflows/linux-clang-16.yaml @@ -1,9 +1,9 @@ -name: linux-clang +name: linux-clang-16 on: [ pull_request ] jobs: - linux-clang: + linux-clang-16: runs-on: ubuntu-latest steps: - name: Checkout @@ -29,7 +29,7 @@ jobs: clang --version cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release cmake --build build -j 4 - - name: Run tess + - name: Run tests run: | ./build/tests/bson/reflect-cpp-bson-tests ./build/tests/cbor/reflect-cpp-cbor-tests diff --git a/README.md b/README.md index e923be47..823da74b 100644 --- a/README.md +++ b/README.md @@ -516,7 +516,7 @@ if you choose to use a different format supported by reflect-cpp, such as msgpac The following compilers are supported: - GCC 11.4 or higher -- Clang 16.0 or higher +- Clang 14.0 or higher - MSVC 17.8 (19.38) or higher ### Option 1: Header-only diff --git a/include/rfl/internal/enums/get_enum_names.hpp b/include/rfl/internal/enums/get_enum_names.hpp index adc928e2..c8ae20bd 100644 --- a/include/rfl/internal/enums/get_enum_names.hpp +++ b/include/rfl/internal/enums/get_enum_names.hpp @@ -44,11 +44,13 @@ namespace enums { template consteval auto get_enum_name_str_view() { - // Unfortunately, we cannot avoid the use of a compiler-specific macro for - // Clang on Windows. For all other compilers, function_name works as intended. #if __cpp_lib_source_location >= 201907L const auto func_name = std::string_view{std::source_location::current().function_name()}; +#elif defined(_MSC_VER) + // Officially, we only support MSVC versions that are modern enough to contain + // , but inofficially, this might work. + const auto func_name = std::string_view{__FUNCSIG__}; #else const auto func_name = std::string_view{__PRETTY_FUNCTION__}; #endif diff --git a/include/rfl/internal/get_field_names.hpp b/include/rfl/internal/get_field_names.hpp index c5bd5243..cc90a9db 100644 --- a/include/rfl/internal/get_field_names.hpp +++ b/include/rfl/internal/get_field_names.hpp @@ -39,11 +39,13 @@ constexpr auto wrap(const T& arg) noexcept { template consteval auto get_field_name_str_view() { - // Unfortunately, we cannot avoid the use of a compiler-specific macro for - // Clang on Windows. For all other compilers, function_name works as intended. #if __cpp_lib_source_location >= 201907L const auto func_name = std::string_view{std::source_location::current().function_name()}; +#elif defined(_MSC_VER) + // Officially, we only support MSVC versions that are modern enough to contain + // , but inofficially, this might work. + const auto func_name = std::string_view{__FUNCSIG__}; #else const auto func_name = std::string_view{__PRETTY_FUNCTION__}; #endif diff --git a/include/rfl/internal/get_type_name.hpp b/include/rfl/internal/get_type_name.hpp index 7f9a073a..1be1e1cd 100644 --- a/include/rfl/internal/get_type_name.hpp +++ b/include/rfl/internal/get_type_name.hpp @@ -14,11 +14,13 @@ namespace internal { template consteval auto get_type_name_str_view() { - // Unfortunately, we cannot avoid the use of a compiler-specific macro for - // Clang on Windows. For all other compilers, function_name works as intended. #if __cpp_lib_source_location >= 201907L const auto func_name = std::string_view{std::source_location::current().function_name()}; +#elif defined(_MSC_VER) + // Officially, we only support MSVC versions that are modern enough to contain + // , but inofficially, this might work. + const auto func_name = std::string_view{__FUNCSIG__}; #else const auto func_name = std::string_view{__PRETTY_FUNCTION__}; #endif