diff --git a/.forgejo/workflows/compile.yaml b/.forgejo/workflows/compile.yaml index f6b652e..8676b18 100644 --- a/.forgejo/workflows/compile.yaml +++ b/.forgejo/workflows/compile.yaml @@ -9,7 +9,7 @@ jobs: - name: Download and cache system dependencies uses: https://complecwaft.com/catmeow/cache-apt-pkgs-action@latest with: - packages: zstd cmake build-essential python3 python3-pip python3-venv wget gcc-mingw-w64 g++-mingw-w64 ninja-build binutils-mingw-w64 + packages: zstd cmake build-essential python3 python3-pip python3-venv wget clang ninja-build version: 1.0 get-source-code: runs-on: ubuntu-latest @@ -137,7 +137,7 @@ jobs: - name: Download and cache system dependencies uses: https://complecwaft.com/catmeow/cache-apt-pkgs-action@latest with: - packages: zstd cmake build-essential gcc-mingw-w64 g++-mingw-w64 ninja-build binutils-mingw-w64 + packages: zstd cmake build-essential ninja-build clang-16 git clang-tools-16 version: 1.0 - name: Download repository code uses: actions/download-artifact@v3 @@ -153,8 +153,12 @@ jobs: path: subprojects/build-protobuf - name: Build protoc run: ./build-protoc.sh + - name: Download and build xwin + run: wget https://github.com/Jake-Shadle/xwin/releases/download/0.6.6-rc.2/xwin-0.6.6-rc.2-x86_64-unknown-linux-musl.tar.gz -O xwin.tar.gz && tar -xf xwin.tar.gz && mv xwin*/ xwin && cd xwin && ./xwin --cache-dir /tmp/xwin-cache --accept-license splat --output /tmp/winroot && cd .. && cp clang-cl.sh /usr/local/bin/clang-cl.sh && chmod +x /usr/local/bin/clang-cl.sh + - name: Specify custom clang-cl + run: sed -i 's@clang-cl@/usr/local/bin/clang-cl.sh@g' clang-cl.cmake - name: Build with CMake - run: mkdir -p build-windows && cd build-windows && cmake .. -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-gcc -G Ninja -DDISABLE_GTK_UI=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_LIBFMT=ON -DUSE_PORTALS=OFF -DENABLE_DBUS=OFF -DBUILD_STATIC=ON -DDOWNLOAD_AUDIO_CODECS_DEPENDENCY=ON -DSDL_MIXER_X_SHARED=OFF -DSDL_MIXER_X_STATIC=ON -DUSE_OGG_VORBIS_STB=ON -DUSE_OPUS=OFF -DUSE_MODPLUG=OFF -DUSE_GME=OFF -DUSE_WAVPACK=OFF -DUSE_XMP=OFF -DUSE_MIDI_EDMIDI=OFF -DUSE_SYSTEM_SDL2=ON -DBUILD_PROTOC=OFF -DBUILD_SDL=ON -DBUILD_SDL_IMAGE=ON -DBUILD_JSONCPP=ON -DBUILD_SOUNDTOUCH=ON -DBUILD_PROTOBUF=ON -DDISABLE_IMGUI_UI=OFF -D BUILD_FMT=ON && ninja && cd .. + run: mkdir -p build-windows && cd build-windows && cmake .. -DCMAKE_TOOLCHAIN_FILE=clang-cl.cmake -G Ninja -DDISABLE_GTK_UI=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_LIBFMT=ON -DUSE_PORTALS=OFF -DENABLE_DBUS=OFF -DBUILD_STATIC=ON -DDOWNLOAD_AUDIO_CODECS_DEPENDENCY=ON -DSDL_MIXER_X_SHARED=OFF -DSDL_MIXER_X_STATIC=ON -DUSE_OGG_VORBIS_STB=ON -DUSE_OPUS=OFF -DUSE_MODPLUG=OFF -DUSE_GME=OFF -DUSE_WAVPACK=OFF -DUSE_XMP=OFF -DUSE_MIDI_EDMIDI=OFF -DUSE_SYSTEM_SDL2=ON -DBUILD_PROTOC=OFF -DBUILD_SDL=ON -DBUILD_SDL_IMAGE=ON -DBUILD_JSONCPP=ON -DBUILD_SOUNDTOUCH=ON -DBUILD_PROTOBUF=ON -DDISABLE_IMGUI_UI=OFF -D BUILD_FMT=ON && ninja && cd .. - name: Upload artifact uses: actions/upload-artifact@v3 with: diff --git a/clang-cl.cmake b/clang-cl.cmake new file mode 100644 index 0000000..4e17c12 --- /dev/null +++ b/clang-cl.cmake @@ -0,0 +1,13 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR amd64) + +set(CMAKE_C_COMPILER clang-cl) +set(CMAKE_CXX_COMPILER clang-cl) +set(CMAKE_AR llvm-lib) +set(CMAKE_LINKER lld-link) +set(CMAKE_MT llvm-mt) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/clang-cl.sh b/clang-cl.sh new file mode 100644 index 0000000..fb615cb --- /dev/null +++ b/clang-cl.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +exec /usr/bin/clang-cl-16 --target=x86_64-pc-windows-msvc -vctoolsdir /tmp/winroot/crt -winsdkdir /tmp/winroot/sdk -fuse-ld=lld "$@" diff --git a/sdl-android-project/app/build.gradle b/sdl-android-project/app/build.gradle index 5c09d9f..2ff36c8 100644 --- a/sdl-android-project/app/build.gradle +++ b/sdl-android-project/app/build.gradle @@ -27,7 +27,7 @@ android { def revParseStdout = new ByteArrayOutputStream(); def versionNameData = "" exec { - commandLine "git", "rev-parse", "--abbref-rev", "HEAD" + commandLine "git", "rev-parse", "--abbrev-rev", "HEAD" standardOutput revParseStdout } versionNameData = revParseStdout.toString() + "-"