give up on Windows CI

This commit is contained in:
zerol
2023-12-17 10:41:35 +08:00
parent eb4da9ec9a
commit 4cb37f4d30
3 changed files with 36 additions and 29 deletions
+18 -19
View File
@@ -43,22 +43,21 @@ jobs:
./build/tests/flexbuffers/reflect-cpp-flexbuffers-tests
./build/tests/json/reflect-cpp-json-tests
windows-msvc:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
toolset: 14.38
- name: Run test
run: |
cl
cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_FLEXBUFFERS=ON -DCMAKE_C_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe" -T version=14.38.33130
cmake --build build -j 4
.\build\tests\flexbuffers\Release\reflect-cpp-flexbuffers-tests.exe
.\build\tests\json\Release\reflect-cpp-json-tests.exe
# The latest MSVC version on GitHub Actions has a bug, and it's difficult to switch to another version.
# Re-enable this when the bug is fixed.
# windows-msvc:
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true
# - uses: ilammy/msvc-dev-cmd@v1
# - uses: lukka/run-vcpkg@v11
# - name: Run test
# run: |
# cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_FLEXBUFFERS=ON
# cmake --build build -j 4
# .\build\tests\flexbuffers\Release\reflect-cpp-flexbuffers-tests.exe
# .\build\tests\json\Release\reflect-cpp-json-tests.exe
+10 -6
View File
@@ -1,14 +1,18 @@
cmake_minimum_required(VERSION 3.15)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
project(reflectcpp)
option(REFLECTCPP_BUILD_SHARED "Build shared library" OFF)
option(REFLECTCPP_FLEXBUFFERS "Enable flexbuffers support" OFF)
option(REFLECTCPP_BUILD_TESTS "Build tests" OFF)
# enable vcpkg if require features other than JSON
if (REFLECTCPP_FLEXBUFFERS)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
endif ()
project(reflectcpp)
if (REFLECTCPP_BUILD_SHARED)
add_library(reflectcpp SHARED src/yyjson.c)
else ()
@@ -16,13 +20,13 @@ else ()
endif ()
target_include_directories(reflectcpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
if (REFLECTCPP_FLEXBUFFERS)
find_package(flatbuffers CONFIG REQUIRED)
target_link_libraries(reflectcpp INTERFACE flatbuffers::flatbuffers)
endif ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O2")
target_compile_options(reflectcpp PRIVATE -Wall -O2)
if (REFLECTCPP_BUILD_TESTS)
add_subdirectory(tests)
+8 -4
View File
@@ -363,9 +363,14 @@ The following compilers are supported:
If you **do not** need JSON support or you want to link YYJSON yourself, then reflect-cpp is header-only. Simply copy the contents of the folder `include` into your source repository or add it to your include path.
### Option 2 Compilation using cmake
### Option 2: Include source files into your own build
Simply copy the contents of the folder include into your source repository or add it to your include path and also add src/yyjson.c to your source files for compilation.
Boostrap vcpkg:
If you need support for other serialization formats like flexbuffers, you should also include and link the respective libraries, as listed in the previous section.
### Option 3 Compilation using cmake
Vcpkg is used to manage dependencies. If you need features other than the out-of-the-box JSON support, you need to bootstrap vcpkg first:
```bash
git submodule update --init
@@ -378,7 +383,6 @@ Use in your project:
```cmake
add_subdirectory(reflect-cpp) # Add this project as a subdirectory
set(REFLECTCPP_JSON ON) # Optional
set(REFLECTCPP_FLATBUFFERS ON) # Optional
target_link_libraries(your_project PRIVATE reflectcpp) # Link against the library
@@ -389,7 +393,7 @@ target_link_libraries(your_project PRIVATE reflectcpp) # Link against the librar
To compile the tests, do the following:
```
cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON
cmake -S . -B build
cmake --build build -j 4
```