Skip to content

Commit fdb9417

Browse files
Merge pull request #103 from DmitriySalnikov/mingw
On Windows, the compiler has been replaced with MinGW + LLVM instead of `MSVC` (as in Godot)
2 parents 8373493 + dacc6f0 commit fdb9417

File tree

19 files changed

+383
-90
lines changed

19 files changed

+383
-90
lines changed

.github/actions/compile_gdextension/action.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ runs:
4545
echo "sha=$(git rev-parse @:./godot-cpp)" >> $GITHUB_OUTPUT
4646
4747
- name: Checkout telemetry repo
48-
uses: actions/checkout@v4
48+
uses: actions/checkout@v6
4949
id: checkout_tele_repo
5050
if: ${{env.PRODUCTION_BUILD == 'true' && contains(fromJSON('["template_debug", "editor"]'), inputs.target) && contains(fromJSON('["linux", "macos", "windows"]'), inputs.platform)}}
5151
continue-on-error: true
@@ -57,7 +57,7 @@ runs:
5757
- name: Restore .scons_cache directory
5858
if: inputs.use_cache != 'false'
5959
id: restore_scons_cache
60-
uses: actions/cache/restore@v4
60+
uses: actions/cache/restore@v5
6161
with:
6262
path: ${{env.SCONS_CACHE}}
6363
key: ${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}
@@ -66,7 +66,7 @@ runs:
6666
${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}
6767
6868
- name: Set up Python 3.x
69-
uses: actions/setup-python@v5
69+
uses: actions/setup-python@v6
7070
with:
7171
python-version: "3.x"
7272
architecture: ${{ fromJSON('["x64", "arm64"]')[runner.arch == 'arm64'] }}
@@ -81,6 +81,11 @@ runs:
8181
python --version
8282
scons --version
8383
84+
- name: Setup MinGW
85+
if: inputs.platform == 'windows'
86+
id: setup_mingw
87+
uses: ./.github/actions/setup_mingw
88+
8489
- name: Linux dependencies
8590
shell: bash
8691
if: (runner.os == 'Linux') && (inputs.platform == 'linux')
@@ -93,33 +98,51 @@ runs:
9398
- name: Compilation
9499
shell: bash
95100
run: |
101+
run_scons() {
102+
echo "============================================="
103+
echo "Running scons with arguments:"
104+
echo "$@"
105+
echo "======================"
106+
echo ""
107+
108+
scons "$@"
109+
}
110+
96111
echo "::group::🛠️ GDExtesion Compilation 🛠️"
97-
scons apply_patches
112+
run_scons apply_patches
113+
114+
scons_mingw_args=""
115+
if [ "${{inputs.platform}}" == "windows" ];then
116+
scons_mingw_args='use_mingw=yes use_llvm=yes mingw_prefix="${{steps.setup_mingw.outputs.mingw_folder}}"'
117+
fi
98118
99119
telemetry_args=""
100120
if [[ "${{env.PRODUCTION_BUILD}}" == "true" && " editor " == *" ${{inputs.target}} "* && " linux macos windows " == *" ${{inputs.platform}} "* && "${{steps.checkout_tele_repo.conclusion}}" == "success" ]]; then
101121
telemetry_args="telemetry_enabled=yes"
102122
fi
103-
scons_params="platform=${{inputs.platform}} arch=${{inputs.arch}} optimize=speed target=${{inputs.target}} addon_output_dir=${{inputs.output_libs_path}} ${{inputs.additional}}"
123+
scons_params="platform=${{inputs.platform}} arch=${{inputs.arch}} optimize=speed target=${{inputs.target}} addon_output_dir=${{inputs.output_libs_path}} ${{inputs.additional}} $scons_mingw_args"
104124
105-
scons $scons_params $telemetry_args
125+
run_scons $scons_params $telemetry_args
106126
107127
if [ "${{inputs.target}}" == "template_release" ] && [ "${{inputs.build_forced_dd3d}}" == "true" ]; then
108128
echo "============================================="
109129
echo "🧊 build_forced_dd3d"
110-
echo "============================================="
111-
scons $scons_params force_enabled_dd3d=yes
130+
echo "======================"
131+
echo ""
132+
133+
run_scons $scons_params force_enabled_dd3d=yes
112134
fi
113135
114136
if [ "${{inputs.build_cpp_tests}}" == "true" ]; then
115137
echo "============================================="
116138
echo "🧪 build_cpp_tests"
117-
echo "============================================="
139+
echo "======================"
140+
echo ""
118141
119142
# Cleaning the generated folder to avoid cache issues.
120143
rm -rf godot-cpp/gen/
121144
122-
scons $scons_params cpp_api_tests=yes custom_godotcpp_suffix=.test_napi folder_to_include_classes=../tests_native_api/cpp cpp_api_auto_gen=no
145+
run_scons $scons_params cpp_api_tests=yes custom_godotcpp_suffix=.test_napi folder_to_include_classes=../tests_native_api/cpp cpp_api_auto_gen=no
123146
fi
124147
125148
echo "::endgroup::"
@@ -136,7 +159,8 @@ runs:
136159
strip -u "$file"
137160
done <<< "$found_files"
138161
else
139-
found_files=$(find -L ${{inputs.output_libs_path}} -type f -exec file {} + | grep "ELF" | cut -d: -f1)
162+
exe_format=$([ "${{inputs.platform}}" = "windows" ] && echo "PE32+" || echo "ELF")
163+
found_files=$(find -L ${{inputs.output_libs_path}} -type f -exec file {} + | grep "$exe_format" | cut -d: -f1)
140164
echo "Found files: $found_files"
141165
strip $found_files
142166
fi
@@ -148,15 +172,15 @@ runs:
148172
Remove-Item ${{inputs.output_libs_path}}/* -Recurse -Include *.exp,*.lib,*.pdb -Force
149173
150174
- name: Upload Artifact
151-
uses: actions/upload-artifact@v4
175+
uses: actions/upload-artifact@v7
152176
with:
153177
name: ${{inputs.artifact}}
154178
retention-days: 7
155179
path: ${{inputs.output_libs_path}}/*
156180

157181
- name: Save .scons_cache directory
158182
if: inputs.use_cache != 'false'
159-
uses: actions/cache/save@v4
183+
uses: actions/cache/save@v5
160184
with:
161185
path: ${{env.SCONS_CACHE}}
162186
key: ${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}

.github/actions/get_lib_version/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313
using: composite
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
1717
with:
1818
fetch-depth: 0
1919
path: get_version_temp_repositiory

.github/actions/setup_godot/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ runs:
5454
5555
- name: Restore cache directory
5656
id: restore_scons_cache
57-
uses: actions/cache/restore@v4
57+
uses: actions/cache/restore@v5
5858
with:
5959
path: ${{steps.store_folder.outputs.path}}
6060
key: godot-${{inputs.tag}}-${{inputs.file_suffix}}${{inputs.is_mono == 'true' && '-mono' || ''}}${{inputs.download_export_templates == 'true' && '-with_exports' || ''}}-installation
6161

6262
- name: Download Godot Engine
63-
uses: robinraju/release-downloader@v1.10
63+
uses: robinraju/release-downloader@v1
6464
if: ${{!steps.restore_scons_cache.outputs.cache-hit}}
6565
with:
6666
repository: ${{inputs.pre_release == 'true' && 'godotengine/godot-builds' || 'godotengine/godot'}}
@@ -70,7 +70,7 @@ runs:
7070
extract: true
7171

7272
- name: Download templates
73-
uses: robinraju/release-downloader@v1.10
73+
uses: robinraju/release-downloader@v1
7474
if: ${{!steps.restore_scons_cache.outputs.cache-hit && inputs.download_export_templates == 'true'}}
7575
with:
7676
repository: ${{inputs.pre_release == 'true' && 'godotengine/godot-builds' || 'godotengine/godot'}}
@@ -146,7 +146,7 @@ runs:
146146
147147
- name: Save cache directory
148148
if: ${{!steps.restore_scons_cache.outputs.cache-hit}}
149-
uses: actions/cache/save@v4
149+
uses: actions/cache/save@v5
150150
with:
151151
path: ${{steps.store_folder.outputs.path}}
152152
key: godot-${{inputs.tag}}-${{inputs.file_suffix}}${{inputs.is_mono == 'true' && '-mono' || ''}}${{inputs.download_export_templates == 'true' && '-with_exports' || ''}}-installation
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Download LLVM MinGW
2+
description: Download the precompiled LLVM MinGW from mstorsjo/llvm-mingw for Linux
3+
inputs:
4+
tag:
5+
description: Release tag in the repository (20260224, 20251216)
6+
default: "20260224"
7+
required: false
8+
outputs:
9+
mingw_folder:
10+
description: Path to the LLVM MinGW
11+
value: ${{steps.store_folder.outputs.path}}
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Store MinGW folder
16+
id: store_folder
17+
env:
18+
temp: ${{runner.temp}}
19+
shell: bash
20+
run: |
21+
echo "path=${{env.temp}}/llvm_mingw" >> $GITHUB_OUTPUT
22+
23+
- name: Restore cache directory
24+
id: restore_mingw_cache
25+
uses: actions/cache/restore@v5
26+
with:
27+
path: ${{steps.store_folder.outputs.path}}
28+
key: llvm_mingw-${{inputs.tag}}-installation
29+
30+
- name: Download LLVM MinGW
31+
uses: robinraju/release-downloader@v1
32+
if: ${{!steps.restore_mingw_cache.outputs.cache-hit}}
33+
with:
34+
repository: 'mstorsjo/llvm-mingw'
35+
tag: "${{inputs.tag}}"
36+
fileName: "llvm-mingw-${{inputs.tag}}-msvcrt-ubuntu-*"
37+
out-file-path: "temp_download_mingw"
38+
39+
- name: Finish preparation
40+
if: ${{!steps.restore_mingw_cache.outputs.cache-hit}}
41+
shell: bash
42+
run: |
43+
tar -xf temp_download_mingw/llvm-mingw-${{inputs.tag}}-msvcrt-ubuntu-* -C temp_download_mingw
44+
45+
echo "Move the mingw files to the root of the temporary folder"
46+
first_folder="$(find temp_download_mingw/ -mindepth 1 -maxdepth 1 -type d -name "llvm-mingw-${{inputs.tag}}-msvcrt-ubuntu-*" | head -1)"
47+
if [ ! "$first_folder" ]; then
48+
echo "The root folder of the mingw build was not found."
49+
exit 1
50+
fi
51+
echo "Found mingw folder: $first_folder"
52+
53+
mv -f "$first_folder"/* temp_download_mingw
54+
rm -rf "$first_folder"
55+
56+
echo "Remove archive"
57+
rm -rf temp_download_mingw/*.tar.xz
58+
59+
echo "Remove unused architectures"
60+
rm -rf temp_download_mingw/armv7-w64-mingw32
61+
rm -rf temp_download_mingw/i686-w64-mingw32
62+
rm -rf temp_download_mingw/aarch64-w64-mingw32
63+
rm -rf temp_download_mingw/arm64ec-w64-mingw32
64+
65+
echo "Move files to the installation folder"
66+
mv -f temp_download_mingw/ ${{steps.store_folder.outputs.path}}/
67+
68+
echo "Final folder structure:"
69+
find ${{steps.store_folder.outputs.path}} -mindepth 1 -maxdepth 1
70+
71+
- name: Save cache directory
72+
if: ${{!steps.restore_mingw_cache.outputs.cache-hit}}
73+
uses: actions/cache/save@v5
74+
with:
75+
path: ${{steps.store_folder.outputs.path}}
76+
key: llvm_mingw-${{inputs.tag}}-installation

.github/actions/setup_ndk/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
2525
- name: Restore NDK Cache
2626
id: ndk-cache
27-
uses: actions/cache/restore@v4
27+
uses: actions/cache/restore@v5
2828
with:
2929
path: ${{steps.get_android_home.outputs.ndk_path}}
3030
key: ndk-cache-${{inputs.ndk_version}}
@@ -36,7 +36,7 @@ runs:
3636

3737
- name: Save NDK Cache
3838
if: steps.ndk-cache.outputs.cache-hit != 'true'
39-
uses: actions/cache/save@v4
39+
uses: actions/cache/save@v5
4040
with:
4141
path: ${{steps.get_android_home.outputs.ndk_path}}
4242
key: ndk-cache-${{inputs.ndk_version}}

0 commit comments

Comments
 (0)