Skip to content

Commit

Permalink
ci: Fixing Windows Clang build using meson native file
Browse files Browse the repository at this point in the history
Set up a meson native file to use when compiling with Clang to fix the resource compiler issue since that seems to be not detected correctly automatically.

Signed-off-by: Tyler Erickson <[email protected]>
  • Loading branch information
vonericsen committed Apr 30, 2024
1 parent ff5205e commit d93da26
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
os: windows-latest,
cc: "clang.exe",
cxx: "clang++.exe",
meson_opts: "--native-file=./meson_crosscompile/Windows-Clang.txt",
release_name: "win-x86_64-clang",
release_extension: ".zip",
archive_command: "7z a -tzip -mmt"
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ add_project_link_arguments(c.get_supported_link_arguments(linker_flags), languag
small_code_cc_flags = []
small_code_link_flags = []

if (c.get_id() == 'gcc' or c.get_id() == 'clang')
if (c.get_id() == 'gcc' or c.get_id() == 'clang') and target_machine.system() != 'windows'

small_code_cc_flags = [
'-ffunction-sections',
Expand Down
32 changes: 32 additions & 0 deletions meson_crosscompile/Windows-Clang.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#See https://mesonbuild.com/Cross-compilation.html
#and https://mesonbuild.com/Machine-files.html
#and https://mesonbuild.com/Reference-tables.html#cpu-families
#example usage of this file:
# meson setup --buildtype=release --native-file=./meson_crosscompile/Windows-Clang.txt nativebuild_win_clang
# ninja -C nativebuild_win_clang

#NOTE: This is for the LLVM.exe installer from github.

[binaries]
c = 'clang.exe'
cpp = 'clang++.exe'
ar = 'llvm-ar.exe'
c_ld = 'lld-link.exe'
cpp_ld = 'lld-link.exe'
strip = 'llvm-strip.exe'
windres = 'llvm-rc.exe'
llvm-config = 'llvm-config.exe'

[properties]
has_function_printf = true

[host_machine]
system = 'windows'
subsystem = 'windows'
kernel = 'nt'
endian = 'little'
cpu_family = 'x86_64'
cpu = ''

[built-in options]
default_library='static'

0 comments on commit d93da26

Please sign in to comment.