try to fix windows ci

This commit is contained in:
zerol
2023-12-16 18:56:30 +08:00
parent 359a21d905
commit e77a5a66da
4 changed files with 27 additions and 21 deletions
+3 -3
View File
@@ -44,7 +44,7 @@ jobs:
./build/tests/json/reflect-cpp-json-tests
windows-msvc:
runs-on: windows-latest
runs-on: windows-2019 # not using windows-latest because its MSVC has a bug which prevents it from building reflect-cpp
steps:
- uses: actions/checkout@v3
with:
@@ -53,11 +53,11 @@ jobs:
uses: lukka/run-vcpkg@v11
- uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: '2022'
toolset: 14
- name: Run test
run: |
cl
cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=ON -DREFLECTCPP_FLATBUFFERS=ON
cmake --build build --config Release
cmake --build build -j 4
.\build\tests\flatbuffers\Release\reflect-cpp-flatbuffers-tests.exe
.\build\tests\json\Release\reflect-cpp-json-tests.exe
+12 -3
View File
@@ -4,9 +4,21 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/
project(reflectcpp)
option(REFLECTCPP_ENABLE_ALL "Enable all features" OFF)
option(REFLECTCPP_JSON "Enable JSON support" OFF)
option(REFLECTCPP_FLATBUFFERS "Enable FlatBuffers support" OFF)
option(REFLECTCPP_BUILD_TESTS "Build tests" OFF)
if (REFLECTCPP_BUILD_TESTS)
set(REFLECTCPP_ENABLE_ALL ON)
endif ()
if (REFLECTCPP_ENABLE_ALL)
set(REFLECTCPP_JSON ON)
set(REFLECTCPP_FLATBUFFERS ON)
endif ()
add_library(reflectcpp INTERFACE)
target_include_directories(reflectcpp INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -24,9 +36,6 @@ endif ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O2")
option(REFLECTCPP_BUILD_TESTS "Build tests" OFF)
if (REFLECTCPP_BUILD_TESTS)
add_subdirectory(tests)
endif ()
+10 -8
View File
@@ -373,12 +373,15 @@ git submodule update --init
./vcpkg/bootstrap-vcpkg.bat # Windows
```
Build:
Use in your project:
```bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DREFLECTCPP_JSON=ON -DREFLECTCPP_FLATBUFFERS=ON
cmake --build build -j 4 # Linux
cmake --build build --config Release # Windows
```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
```
## Compiling the tests
@@ -386,9 +389,8 @@ cmake --build build --config Release # Windows
To compile the tests, do the following:
```
cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=ON -DREFLECTCPP_FLATBUFFERS=ON
cmake --build build -j 4 # Linux
cmake --build build --config Release # Windows
cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON
cmake --build build -j 4
```
+2 -7
View File
@@ -7,10 +7,5 @@ else()
endif()
if (REFLECTCPP_JSON)
add_subdirectory(json)
endif ()
if (REFLECTCPP_FLATBUFFERS)
add_subdirectory(flatbuffers)
endif ()
add_subdirectory(json)
add_subdirectory(flatbuffers)