@@ -779,3 +779,137 @@ jobs:
779779 echo "Unittest CSXCAD Python module execution in venv..."
780780 cd $GITHUB_WORKSPACE/CSXCAD/python/tests
781781 python3 -m unittest
782+
783+ Windows :
784+ runs-on : windows-latest
785+ needs : Dependencies
786+
787+ strategy :
788+ # Use "false" means a single failed build won't terminate other combinations
789+ # in the matrix. This wastes CPU time, but is an important debugging tool to
790+ # prevent a single broken platform from stopping the whole matrix.
791+ fail-fast : false
792+
793+ matrix :
794+ toolchain :
795+ # name: toonchain name (only a name for humans to read).
796+ # CC, CXX: C/C++ compiler, environment variables
797+ - name : " MSVC"
798+ CC : " cl"
799+ CXX : " cl"
800+
801+ - name : " clang-cl"
802+ CC : " clang-cl"
803+ CXX : " clang-cl"
804+
805+ env :
806+ VS_ROOT_DIR : " C:/Program Files/Microsoft Visual Studio/2022/Enterprise/"
807+ CC : " ${{ matrix.toolchain.CC }}"
808+ CXX : " ${{ matrix.toolchain.CXX }}"
809+ CFLAGS : " /D_WIN32_WINNT=0x0601"
810+ CXXFLAGS : " /D_WIN32_WINNT=0x0601"
811+
812+ VCPKG_CACHE_PATH : " ${{ github.workspace }}/vcpkg-cache/"
813+ VCPKG_BINARY_CACHE_PATH : " ${{ github.workspace }}/vcpkg-cache/binary"
814+ VCPKG_BINARY_SOURCES : " clear;files,${{ github.workspace }}/vcpkg-cache/binary,readwrite"
815+ VCPKG_ASSET_CACHE_PATH : " ${{ github.workspace }}/vcpkg-cache/asset"
816+ X_VCPKG_ASSET_SOURCES : " x-azurl,file://${{ github.workspace }}/vcpkg-cache/asset,readwrite"
817+
818+ # allow this job to create and modify vcpkg packages for binary cache
819+ permissions :
820+ packages : write
821+
822+ name : " Windows (${{ matrix.toolchain.name }}, latest)"
823+
824+ steps :
825+ - name : Show checkout sources
826+ run : |
827+ echo "$env:FPARSER_CHECKOUT_TITLE"
828+ env :
829+ # convert template variables to shell variables to avoid arbitrary code injection
830+ FPARSER_CHECKOUT_TITLE : ${{ needs.Dependencies.outputs.fparser_checkout_title }}
831+
832+ # When checking out repos, I recommend running actions/checkout
833+ # as soon as possible before anything else, and in the reverse
834+ # order, from the project repo to its dependencies. This reduces
835+ # race conditions due to force pushes (they are harmless but
836+ # annoying).
837+ - name : Checkout CSXCAD.git
838+ uses : actions/checkout@v4
839+ with :
840+ path : CSXCAD
841+ # checkout must be deep, not shallow.
842+ # We need tags for "git describe", otherwise build fails.
843+ fetch-depth : 0
844+
845+ - name : ${{ needs.Dependencies.outputs.fparser_checkout_title }}
846+ uses : actions/checkout@v4
847+ with :
848+ repository : " ${{ needs.Dependencies.outputs.fparser_repo }}"
849+ ref : " ${{ needs.Dependencies.outputs.fparser_branch }}"
850+ path : fparser
851+ # checkout must be deep, not shallow.
852+ # We need tags for "git describe", otherwise build fails.
853+ fetch-depth : 0
854+
855+ # It doesn't really work, because MSVC itself doesn't support long path.
856+ # But for future-proofing (it does work for clang).
857+ - name : Enable long paths
858+ run : |
859+ New-ItemProperty -Path "HKLM:/SYSTEM/CurrentControlSet/Control/FileSystem" `
860+ -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
861+
862+ - name : Create vcpkg cache directories
863+ run : |
864+ mkdir -p "$env:VCPKG_CACHE_PATH"
865+ mkdir -p "$env:VCPKG_BINARY_CACHE_PATH"
866+ mkdir -p "$env:VCPKG_ASSET_CACHE_PATH"
867+
868+ - name : Restore vcpkg cache
869+ uses : actions/cache/restore@v5
870+ with :
871+ path : ${{ env.VCPKG_CACHE_PATH }}
872+ # almost always nonexistent
873+ key : " Windows - ${{ matrix.toolchain.name }} - ${{ github.sha }}"
874+ # use GitHub's fallback feature to pick the latest cache with this prefix
875+ restore-keys : |
876+ Windows - ${{ matrix.toolchain.name }}
877+
878+ - name : Build and install fparser
879+ run : |
880+ & "$env:VS_ROOT_DIR/Common7/Tools/Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64
881+
882+ cd "$env:GITHUB_WORKSPACE/fparser"
883+ mkdir build && cd build
884+ cmake ../ -GNinja -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON `
885+ -DCMAKE_BUILD_TYPE=Release `
886+ -DCMAKE_INSTALL_PREFIX="$HOME/opt"
887+
888+ cmake --build ./ --parallel
889+ cmake --install ./ --parallel 8
890+
891+ - name : Build and install CSXCAD
892+ run : |
893+ & "$env:VS_ROOT_DIR/Common7/Tools/Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64
894+
895+ cd "$env:GITHUB_WORKSPACE/CSXCAD"
896+ mkdir build && cd build
897+ cmake ../ -GNinja `
898+ -DCMAKE_BUILD_TYPE=Release `
899+ -DCMAKE_INSTALL_PREFIX="$HOME/opt" `
900+ -DFPARSER_ROOT_DIR="$HOME/opt" `
901+ -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" `
902+ -DVCPKG_HOST_TRIPLET="x64-windows-release" `
903+ -DVCPKG_TARGET_TRIPLET="x64-windows-release"
904+
905+ cmake --build ./ --parallel
906+ cmake --install ./ --parallel 8
907+
908+ - name : Save vcpkg cache
909+ if : always() # save even after a build failure.
910+ uses : actions/cache/save@v5
911+ with :
912+ path : ${{ env.VCPKG_CACHE_PATH }}
913+ # GitHub cache is immutable and can't be overwritten
914+ # save a new cache key every time
915+ key : Windows - ${{ matrix.toolchain.name }} - ${{ github.sha }}
0 commit comments