Преглед изворни кода

cmake presets support for Windows tests

Andre Weissflog пре 2 година
родитељ
комит
8a94ab86fc
3 измењених фајлова са 56 додато и 45 уклоњено
  1. 15 15
      .github/workflows/main.yml
  2. 34 0
      tests/CMakePresets.json
  3. 7 30
      tests/test_win.cmd

+ 15 - 15
.github/workflows/main.yml

@@ -3,19 +3,19 @@ name: "Build & Test"
 on: [push, pull_request]
 
 jobs:
-    #windows:
-    #    runs-on: windows-latest
-    #    steps:
-    #    - uses: actions/checkout@v2
-    #    - name: test_win
-    #      run: |
-    #        cd tests
-    #        test_win.cmd
-    #      shell: cmd
+    windows:
+        runs-on: windows-latest
+        steps:
+        - uses: actions/checkout@v3
+        - name: test_win
+          run: |
+            cd tests
+            test_win.cmd
+          shell: cmd
     mac:
         runs-on: macos-latest
         steps:
-        - uses: actions/checkout@v2
+        - uses: actions/checkout@v3
         - uses: seanmiddleditch/gha-setup-ninja@master
         - name: test_macos
           run: |
@@ -24,7 +24,7 @@ jobs:
     ios:
         runs-on: macos-latest
         steps:
-        - uses: actions/checkout@v2
+        - uses: actions/checkout@v3
         - name: test_ios
           run: |
             cd tests
@@ -32,7 +32,7 @@ jobs:
     linux:
         runs-on: ubuntu-latest
         steps:
-        - uses: actions/checkout@v2
+        - uses: actions/checkout@v3
         - uses: seanmiddleditch/gha-setup-ninja@master
         - name: prepare
           run: |
@@ -45,7 +45,7 @@ jobs:
     emscripten:
         runs-on: ubuntu-latest
         steps:
-        - uses: actions/checkout@v2
+        - uses: actions/checkout@v3
         - uses: seanmiddleditch/gha-setup-ninja@master
         - name: test_emscripten
           run: |
@@ -54,7 +54,7 @@ jobs:
     android:
         runs-on: ubuntu-latest
         steps:
-        - uses: actions/checkout@v2
+        - uses: actions/checkout@v3
         - uses: seanmiddleditch/gha-setup-ninja@master
         - uses: actions/setup-java@v1
           with:
@@ -66,7 +66,7 @@ jobs:
     #uwp:
     #    runs-on: windows-latest
     #    steps:
-    #    - uses: actions/checkout@v2
+    #    - uses: actions/checkout@v3
     #    - name: test_uwp
     #      run: |
     #        cd tests

+ 34 - 0
tests/CMakePresets.json

@@ -263,6 +263,20 @@
                 "ANDROID_PLATFORM": "android-28",
                 "CMAKE_BUILD_TYPE": "Release"
             }
+        },
+        {
+            "name": "win_gl",
+            "binaryDir": "build/win_gl",
+            "cacheVariables": {
+                "SOKOL_BACKEND": "SOKOL_GLCORE33"
+            }
+        },
+        {
+            "name": "win_d3d11",
+            "binaryDir": "build/win_d3d11",
+            "cacheVariables": {
+                "SOKOL_BACKEND": "SOKOL_D3D11"
+            }
         }
     ],
     "buildPresets": [
@@ -393,6 +407,26 @@
         {
             "name": "android_release",
             "configurePreset": "android_release"
+        },
+        {
+            "name": "win_gl_debug",
+            "configurePreset": "win_gl",
+            "configuration": "Debug"
+        },
+        {
+            "name": "win_gl_release",
+            "configurePreset": "win_gl",
+            "configuration": "Release"
+        },
+        {
+            "name": "win_d3d11_debug",
+            "configurePreset": "win_d3d11",
+            "configuration": "Debug"
+        },
+        {
+            "name": "win_d3d11_release",
+            "configurePreset": "win_d3d11",
+            "configuration": "Release"
         }
     ]
 }

+ 7 - 30
tests/test_win.cmd

@@ -1,34 +1,11 @@
-if not exist ext/fips-cimgui/ (
-    git clone --depth 1 --recursive https://github.com/fips-libs/fips-cimgui ext/fips-cimgui
-)
-if not exist ext/spine-runtimes/ (
-    git clone --depth 1 --recursive https://github.com/EsotericSoftware/spine-runtimes/ ext/spine-runtimes
-)
+cmake --preset win_gl || exit /b 10
+cmake --build --preset win_gl_debug || exit /b 10
+cmake --build --preset win_gl_release || exit /b 10
 
-md build\win_gl_debug
-cd build\win_gl_debug
-cmake -DSOKOL_BACKEND=SOKOL_GLCORE33 ../.. || exit /b 10
-cmake --build . || exit /b 10
-cd ..\..
+cmake --preset win_d3d11 || exit /b 10
+cmake --build --preset win_d3d11_debug || exit /b 10
+cmake --build --preset win_d3d11_release || exit /b 10
 
-md build\win_gl_release
-cd build\win_gl_release
-cmake -DSOKOL_BACKEND=SOKOL_GLCORE33 ../.. || exit /b 10
-cmake --build . --config Release || exit /b 10
-cd ..\..
-
-md build\win_d3d11_debug
-cd build\win_d3d11_debug
-cmake -DSOKOL_BACKEND=SOKOL_D3D11 ../.. || exit /b 10
-cmake --build . || exit /b 10
-cd ..\..
-
-md build\win_d3d11_debug
-cd build\win_d3d11_debug
-cmake -DSOKOL_BACKEND=SOKOL_D3D11 ../.. || exit /b 10
-cmake --build . --config Release || exit /b 10
-cd ..\..
-
-cd build\win_d3d11_debug\Debug
+cd build\win_d3d11\Debug
 sokol-test.exe || exit /b 10
 cd ..\..\..