Windows / MSYS2 CLANG64

The windows job in build.yml builds this way. Clang, LLVM's tools and the FFmpeg and OpenSSL build tools come from MSYS2, not from bootstrap.ps1. Keep env.ps1 out of this shell: llvm-mingw's C++ runtime must not mix with MSYS2's.

  1. Install MSYS2 from msys2.org and open the MSYS2 CLANG64 shell. Run every step below in it.

  2. Update MSYS2, then install CI's packages. If the update closes the shell, reopen it and run pacman -Syu again.

    pacman -Syu
    pacman -S --needed git make patch perl patchutils \
      mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-llvm mingw-w64-clang-x86_64-lld \
      mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-nasm \
      mingw-w64-clang-x86_64-meson mingw-w64-clang-x86_64-pkgconf mingw-w64-clang-x86_64-python \
      mingw-w64-clang-x86_64-glslang

    Python builds the menu's languages and runs SPIRV-Tools' build, which optimizes and validates the shaders. CI also installs ccache, which is optional here, as sccache is. On Windows on Arm, open the MSYS2 CLANGARM64 shell instead and install the same packages with mingw-w64-clang-aarch64- in place of mingw-w64-clang-x86_64-, as the job's AArch64 leg does; the steps below are the same there, and its DLLs are in /clangarm64/bin.

  3. Clone to a path without spaces:

    git clone --depth=1 https://github.com/scarletnx/ScarletNX.git
    cd ScarletNX
  4. Configure and build. These are CI's options without its ccache, LTO, VP9 vectors and -DSNX_DEPLOY=OFF ones. They give CMake the MSYS2 tools as Windows paths and build the pinned SDL3.

    cmake --preset default \
      -DSNX_FFMPEG_SH="$(cygpath -m /usr/bin/sh.exe)" \
      -DSNX_FFMPEG_MAKE="$(cygpath -m /usr/bin/make.exe)" \
      -DPERL_EXECUTABLE="$(cygpath -m /usr/bin/perl.exe)" \
      -DSNX_OPENSSL_MAKE="$(cygpath -m /usr/bin/make.exe)" \
      -DCMAKE_DISABLE_FIND_PACKAGE_SDL3=ON -DBUILD_TESTING=ON
    cmake --build --preset default
  5. The executables land in build/default. CI checks them with:

    build/default/scarletnx.exe --help
    ctest --test-dir build/default --output-on-failure
  6. Run build/default/scarletnx.exe from the CLANG64 shell, which has the DLLs it imports on PATH (Usage). For a copy that runs without MSYS2, cmake --install build/default --prefix stage puts scarletnx.exe in stage/bin. Then copy the DLLs it imports from /clang64/bin, as CI's "Bundle runtime DLLs and licenses" step does (scripts/ci/windows.sh bundle).


Made from docs/dev/build.md at 69237645142c. GPL-3.0-or-later.