generated from asmaloney/GDExtensionTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (121 loc) · 4.54 KB
/
main.yml
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Main
on:
push:
paths-ignore:
- '.gitignore'
- '*.md'
jobs:
lint:
name: 🧹 Lint / 📜 C++
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: '15'
exclude-regex: 'extern'
build:
strategy:
fail-fast: false
matrix:
build_type: ['Debug', 'Release']
config:
- { name: '🍏 macOS Clang', os: macos-latest }
- { name: '🐧 Linux GCC', os: ubuntu-20.04 }
- { name: '🪟 Windows MSVC', os: windows-latest }
name: 🛠 Build / ${{ matrix.config.name }} (${{ matrix.build_type }})
runs-on: ${{ matrix.config.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Dependencies (macOS)
if: matrix.config.os == 'macos-latest'
run: |
brew install ccache ninja
ruby - e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2 > /dev/null
brew reinstall --build-from-source cmake
ln -s /usr/local/Cellar/cmake/3.27.1 /usr/local/Cellar/cmake/3.26.4
brew install create-dmg
ruby - e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2 > /dev/null
brew install --build-from-source cmake
git clone https://github.com/opencv/opencv.git --branch 4.0.0 --depth 1
cmake -S opencv -B opencv/build -D ENABLE_PRECOMPILED_HEADERS=OFF -D WITH_MSMF=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D BUILD_WITH_DEBUG_INFO=OFF -D BUILD_DOCS=OFF -D WITH_JPEG=OFF -D WITH_FFMPEG=OFF -D CMAKE_BUILD_TYPE=RELEASE
cd ./opencv/build
make
sudo make install
- name: Install Dependencies (Linux)
if: matrix.config.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y ccache ninja-build
- name: Install Dependencies (Windows)
if: matrix.config.os == 'windows-latest'
run: |
choco upgrade ccache ninja
- name: Setup MSVC (Windows)
if: matrix.config.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: ccache
uses: hendrikmuhs/[email protected]
with:
max-size: '10G'
key: ${{ matrix.config.os }}-${{ matrix.build_type }}
- name: Setup OpenCV
if: matrix.config.os == 'ubuntu-20.04'
uses: Dovyski/[email protected]
with:
opencv-version: '4.2.0'
- name: Cache opencv
if: matrix.config.os == 'windows-latest'
uses: actions/cache@v4
env:
cache-name: cache-opencv
with:
path: |
C:/opencv4.0.0
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- name: build opencv
if: matrix.config.os == 'windows-latest'
run: |
$c="C:\opencv4.0.0"
if(-not (Test-Path $c))
{
git clone https://github.com/opencv/opencv.git --branch 4.0.0 --depth 1
cmake -G "MinGW Makefiles" -S opencv -B opencv/build -D CMAKE_INSTALL_PREFIX=C:/opencv4.0.0 -D ENABLE_PRECOMPILED_HEADERS=OFF -D WITH_MSMF=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D BUILD_WITH_DEBUG_INFO=OFF -D BUILD_DOCS=OFF -D CMAKE_BUILD_TYPE=RELEASE
cd ./opencv/build
mingw32-make
mingw32-make install
}
- name: Configure
run: >
mkdir GDExtension-build
cmake
-B GDExtension-build
-G "Ninja"
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
--install-prefix ${{ github.workspace }}/install-${{ matrix.build_type }}
.
- name: Build
run: cmake --build GDExtension-build
- name: Install
run: cmake --install GDExtension-build
- name: Upload artifact (Debug)
if: matrix.build_type == 'Debug'
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-Debug
path: |
${{ github.workspace }}/Demo/bin/*
- name: Upload artifact (Release)
if: matrix.build_type == 'Release'
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-Release
path: |
${{ github.workspace }}/Demo/bin/*