forked from obsidian-level-maker/Obsidian
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (91 loc) · 3.14 KB
/
Copy pathcmake-multi-platform.yml
File metadata and controls
102 lines (91 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# .github/workflows/cmake-multi-platform.yml
name: CMake build (Windows/Linux)
on:
push:
branches: [ "v21-dev" ]
pull_request:
branches: [ "v21-dev" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cpp_compiler: clang++
c_compiler: clang
- os: windows-latest
cpp_compiler: cl
c_compiler: cl
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies (FLTK/X11/fontconfig)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
make cmake binutils \
gcc g++ clang \
libfontconfig1-dev libxft-dev libx11-dev \
libfltk1.3-dev
- name: Set build directory
id: dirs
shell: bash
run: |
echo "build-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
shell: bash
run: >
cmake -S "${{ github.workspace }}"
-B "${{ steps.dirs.outputs.build-dir }}"
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
- name: Build
shell: bash
run: >
cmake --build "${{ steps.dirs.outputs.build-dir }}"
--config Release -j$(nproc)
- name: Locate built binary (Linux)
if: runner.os == 'Linux'
id: binlinux
shell: bash
run: |
if [ -f "${{ steps.dirs.outputs.build-dir }}/obsidian" ]; then
echo "path=${{ steps.dirs.outputs.build-dir }}/obsidian" >> "$GITHUB_OUTPUT"
else
found="$(find "${{ steps.dirs.outputs.build-dir }}" -maxdepth 4 -type f -name 'obsidian' | head -n 1)"
echo "path=$found" >> "$GITHUB_OUTPUT"
fi
- name: Locate built binary (Windows)
if: runner.os == 'Windows'
id: binwin
shell: pwsh
run: |
$candidates = @(
"${{ steps.dirs.outputs.build-dir }}\Release\obsidian.exe",
"${{ steps.dirs.outputs.build-dir }}\obsidian.exe"
)
$found = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $found) {
$found = Get-ChildItem -Path "${{ steps.dirs.outputs.build-dir }}" -Recurse -Filter "obsidian.exe" | Select-Object -First 1
if ($found) { $found = $found.FullName }
}
"path=$found" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Upload artifact (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: obsidian-linux
path: ${{ steps.binlinux.outputs.path }}
if-no-files-found: error
- name: Upload artifact (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: obsidian-windows
path: ${{ steps.binwin.outputs.path }}
if-no-files-found: error