Skip to content

Commit

Permalink
ci: build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMcAvoy committed Nov 27, 2024
1 parent 6ae1b67 commit 5ec8d67
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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: Configure
run: cmake -Bbuild -Hexgine -DCMAKE_TOOLCHAIN_FILE=windows.cmake -DCMAKE_INSTALL_PREFIX=$PWD/install
- name: Build
run: cmake --build build --config Release -j2
- 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
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 19 additions & 0 deletions windows.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Specify the target system
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR x86_64)

# Specify the cross-compiling toolchain
SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++)

# Specify the Windows target sysroot (optional, but recommended)
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)

# Adjust search paths so that CMake finds the right libraries and headers for cross-compiling
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# Specify the Windows output binary type
SET(CMAKE_CXX_STANDARD 20)

0 comments on commit 5ec8d67

Please sign in to comment.