diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4e68021 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: build +on: [push, pull_request, workflow_dispatch] + +jobs: + windows: + runs-on: ubuntu-latest + steps: + - name: Checkout exgine + uses: actions/checkout@v4 + with: + path: exgine + submodules: 'recursive' + - name: Install Dependencies + run: | + sudo apt update + sudo apt install -y build-essential cmake + sudo apt install libwayland-dev libxkbcommon-dev xorg-dev + sudo apt install -y mingw-w64 mingw-w64-tools ninja-build libpthread-stubs0-dev + - name: Build + run: (cd exgine && bash windows.sh) + - uses: actions/upload-artifact@v4 + with: + name: exgine_windows-x64 + path: | + build/starter.exe + linux: + runs-on: ubuntu-latest + steps: + - name: Checkout exgine + uses: actions/checkout@v4 + with: + path: exgine + submodules: 'recursive' + - name: Install Dependencies + run: | + sudo apt update + sudo apt install -y build-essential cmake + sudo apt install libwayland-dev libxkbcommon-dev xorg-dev + - name: Configure + run: cmake -Bbuild -Hexgine -DCMAKE_INSTALL_PREFIX=$PWD/install + - name: Build + run: cmake --build build --config Release -j2 + - uses: actions/upload-artifact@v4 + with: + name: exgine_linux-x64 + path: | + build/starter diff --git a/CMakeLists.txt b/CMakeLists.txt index 98b8654..6e04803 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,10 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON) # Project declaration project(ExgineRoot) -if (WIN32) +# we need to check if we're actually on windows, not just cross-compiling +if (WIN32 AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + message(STATUS "Not on Windows, not enabling unicode support") +elseif (WIN32) message(STATUS "Manually enabling unicode support") add_compile_options(/utf-8) endif() diff --git a/windows.sh b/windows.sh new file mode 100644 index 0000000..1f58e63 --- /dev/null +++ b/windows.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SYSTEM_NAME=Windows \ + -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \ + -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \ + -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -static -std=c++20" \ + -DCMAKE_EXE_LINKER_FLAGS="-static" \ + -B build \ + -G Ninja + +cmake --build build --config Release