Skip to content

Commit 99e4c61

Browse files
presets for different operating systems
1 parent 5b0a045 commit 99e4c61

5 files changed

Lines changed: 115 additions & 26 deletions

File tree

.github/workflows/Engine-CI.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ jobs:
2424
uses: ./.github/workflows/macOS-build.yml
2525
with:
2626
targetFramework: net8.0
27+
28+
linux:
29+
needs: clang-format
30+
uses: ./.github/workflows/linux-build.yml
31+
with:
32+
targetFramework: net8.0

.github/workflows/job-cmakebuild-linux.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
name: ZEngine Cmake Linux Workflow
22

33
on:
4-
push:
5-
branches: [ header-reorganization ]
4+
workflow_call:
5+
inputs:
6+
targetFramework:
7+
type: string
8+
required: true
9+
configuration:
10+
type: string
11+
default: 'Debug'
12+
architecture:
13+
type: string
14+
default: 'x64'
615

716
jobs:
817
Linux-Build:
9-
name: cmake-build-linux-debug
18+
name: cmake-build-linux-$${{ inputs.configuration }}
1019
runs-on: ubuntu-24.04
1120

1221
steps:
@@ -20,9 +29,9 @@ jobs:
2029
run: sudo apt-get update && sudo apt-get install -y git libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake gcc g++ ninja-build libassimp-dev libfmt-dev libimgui-dev libstb-dev libglfw3-dev libspdlog-dev libglm-dev libyaml-cpp-dev libspirv-cross-c-shared-dev spirv-cross spirv-tools glslang-dev glslang-tools nlohmann-json3-dev dotnet-runtime-8.0 libgtest-dev powershell
2130

2231
- name: CMake Build
23-
run: .\Scripts\BuildEngine.ps1 -Configurations 'Debug' -RunClangFormat 0
32+
run: .\Scripts\BuildEngine.ps1 -Configurations ${{ inputs.configuration }} -RunClangFormat 0
2433
shell: pwsh
2534

2635
- name: Run Tests
27-
run: .\Scripts\RunTests.ps1 -Configurations 'Debug'
36+
run: .\Scripts\RunTests.ps1 -Configurations ${{ inputs.configuration }}
2837
shell: pwsh

.github/workflows/linux-build.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
name: ZEngine Linux Build
44

55
on:
6-
push:
7-
branches: [ master ]
8-
pull_request:
9-
branches: [ master ]
6+
workflow_call:
7+
inputs:
8+
targetFramework:
9+
type: string
10+
required: true
1011

1112
jobs:
1213
Linux-Build:
@@ -15,9 +16,9 @@ jobs:
1516
matrix:
1617
buildConfiguration: [Debug, Release]
1718

18-
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v2
19+
uses: ./.github/workflows/job-cmakebuild-linux.yml
20+
with:
21+
configuration: ${{matrix.buildConfiguration}}
2122

2223
# - name: Checkout submodules
2324
# run: git submodule update --init --recursive

CMakePresets.json

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
},
88
"configurePresets":[
99
{
10-
"name": "Debug",
11-
"displayName": "Default Config Ninja Debug",
12-
"generator": "Ninja",
10+
"name": "Debug_Windows",
11+
"displayName": "Windows Visual Studio Debug",
12+
"generator": "Visual Studio 2022",
1313
"binaryDir": "${sourceDir}/../builds/RendererEngine",
1414
"cacheVariables": {
1515
"CMAKE_BUILD_TYPE": "Debug",
@@ -59,22 +59,73 @@
5959
}
6060
},
6161
{
62-
"name": "Release",
63-
"inherits": "Debug",
64-
"displayName": "Default Config Ninja Release",
62+
"name": "Release_Windows",
63+
"displayName": "Windows Visual Studio Release",
64+
"inherits": "Debug_Windows",
6565
"cacheVariables": {
66-
"CMAKE_BUILD_TYPE": "Debug"
66+
"CMAKE_BUILD_TYPE": "Release"
6767
}
68-
}
68+
},
69+
70+
# Mac Os
71+
{
72+
"name": "Debug_MacOS",
73+
"inherits": "Debug_Windows",
74+
"displayName": "MacOS XCode Debug",
75+
"generator": "Xcode",
76+
},
77+
{
78+
"name": "Release_MacOS",
79+
"inherits": "Release_Windows",
80+
"displayName": "MacOS XCode Release",
81+
"generator": "Xcode"
82+
},
83+
84+
# Linux
85+
{
86+
"name": "Debug_Linux",
87+
"inherits": "Debug_Windows",
88+
"displayName": "Linux Ninja Debug",
89+
"generator": "Xcode",
90+
},
91+
{
92+
"name": "Release_Linux",
93+
"inherits": "Release_Windows",
94+
"displayName": "Linux Ninja Release",
95+
"generator": "Xcode"
96+
},
97+
98+
6999
],
70100
"buildPresets": [
101+
# Windows Builds
102+
{
103+
"name": "Windows_Debug_Build",
104+
"configurePreset": "Windows_Debug"
105+
},
106+
{
107+
"name": "Windows_Release_Build",
108+
"configurePreset": "Windows_Release"
109+
},
110+
111+
# MacOS Builds
112+
{
113+
"name": "MacOS_Debug_Build",
114+
"configurePreset": "MacOS_Debug"
115+
},
116+
{
117+
"name": "MacOS_Release_Build",
118+
"configurePreset": "MacOS_Release"
119+
},
120+
121+
# Linux Builds
71122
{
72-
"name": "Debug",
73-
"configurePreset": "Debug"
123+
"name": "Linux_Debug_Build",
124+
"configurePreset": "Linux_Debug"
74125
},
75126
{
76-
"name": "Release",
77-
"configurePreset": "Release"
127+
"name": "Linux_Release_Build",
128+
"configurePreset": "Linux_Release"
78129
}
79130
]
80131
}

Scripts/BuildEngine.ps1

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,28 @@ if ($IsWindows) {
8484

8585
function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
8686

87-
$cMakeArguments = "--preset $Configuration"
87+
# Define CMake Preset argument
88+
switch ($systemName) {
89+
"Windows" {
90+
switch ($VsVersion) {
91+
2022 {
92+
$cMakePreset = "Windows_$configuration"
93+
}
94+
Default {
95+
throw 'This version of Visual Studio is not supported'
96+
}
97+
}
98+
}
99+
"Linux" {
100+
# Set Linux build compiler
101+
$cMakePreset = "Linux_$configuration"
102+
}
103+
"Darwin" {
104+
$cMakePreset = "MacOS_$configuration"
105+
}
106+
}
107+
108+
$cMakeArguments = "--preset $cmakePreset"
88109

89110
# CMake Generation process
90111
Write-Host $cMakeArguments
@@ -96,7 +117,8 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
96117
# CMake Build Process
97118
#
98119
if ($runBuild) {
99-
$buildArguments = "--build --preset $Configuration"
120+
121+
$buildArguments = "--build --preset $cmakePreset_Build"
100122

101123
$buildProcess = Start-Process $cMakeProgram -ArgumentList $buildArguments -NoNewWindow -PassThru
102124

0 commit comments

Comments
 (0)