Skip to content

Commit 5ec8d67

Browse files
committed
ci: build workflow
1 parent 6ae1b67 commit 5ec8d67

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

.github/workflows/build.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: build
2+
on: [push, pull_request, workflow_dispatch]
3+
4+
jobs:
5+
windows:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout exgine
9+
uses: actions/checkout@v4
10+
with:
11+
path: exgine
12+
submodules: 'recursive'
13+
- name: Install Dependencies
14+
run: |
15+
sudo apt update
16+
sudo apt install -y build-essential cmake
17+
sudo apt install libwayland-dev libxkbcommon-dev xorg-dev
18+
sudo apt install -y mingw-w64 mingw-w64-tools ninja-build libpthread-stubs0-dev
19+
- name: Configure
20+
run: cmake -Bbuild -Hexgine -DCMAKE_TOOLCHAIN_FILE=windows.cmake -DCMAKE_INSTALL_PREFIX=$PWD/install
21+
- name: Build
22+
run: cmake --build build --config Release -j2
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: exgine_windows-x64
26+
path: |
27+
build/starter.exe
28+
linux:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout exgine
32+
uses: actions/checkout@v4
33+
with:
34+
path: exgine
35+
submodules: 'recursive'
36+
- name: Install Dependencies
37+
run: |
38+
sudo apt update
39+
sudo apt install -y build-essential cmake
40+
sudo apt install libwayland-dev libxkbcommon-dev xorg-dev
41+
- name: Configure
42+
run: cmake -Bbuild -Hexgine -DCMAKE_INSTALL_PREFIX=$PWD/install
43+
- name: Build
44+
run: cmake --build build --config Release -j2
45+
- uses: actions/upload-artifact@v4
46+
with:
47+
name: exgine_linux-x64
48+
path: |
49+
build/starter

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
1313
# Project declaration
1414
project(ExgineRoot)
1515

16-
if (WIN32)
16+
# we need to check if we're actually on windows, not just cross-compiling
17+
if (WIN32 AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
18+
message(STATUS "Not on Windows, not enabling unicode support")
19+
elseif (WIN32)
1720
message(STATUS "Manually enabling unicode support")
1821
add_compile_options(/utf-8)
1922
endif()

windows.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Specify the target system
2+
SET(CMAKE_SYSTEM_NAME Windows)
3+
SET(CMAKE_SYSTEM_VERSION 1)
4+
SET(CMAKE_SYSTEM_PROCESSOR x86_64)
5+
6+
# Specify the cross-compiling toolchain
7+
SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc)
8+
SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++)
9+
10+
# Specify the Windows target sysroot (optional, but recommended)
11+
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
12+
13+
# Adjust search paths so that CMake finds the right libraries and headers for cross-compiling
14+
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
15+
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
16+
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
17+
18+
# Specify the Windows output binary type
19+
SET(CMAKE_CXX_STANDARD 20)

0 commit comments

Comments
 (0)