Skip to content

Commit

Permalink
feat: compiling using msys2 and mingw
Browse files Browse the repository at this point in the history
Yes, it's not as pretty as msvc, but it's open source tooling :/. I
think this satisfies the immediate need, and if there are further
changes I think they might be patchable.
  • Loading branch information
Kreijstal committed Jan 9, 2025
1 parent 2702a55 commit e0ec4c5
Show file tree
Hide file tree
Showing 4 changed files with 448 additions and 39 deletions.
52 changes: 45 additions & 7 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,58 @@ if host_machine.system() == 'windows'
# pistachelog.dll
# mc.exe and rc.exe being utilities provided by Windows

mc_prog = find_program('mc.exe')
if compiler.get_id() == 'gcc'
rc_prog = find_program('windres.exe')
else
rc_prog = find_program('rc.exe')
endif

gen_src_log_rc_ct = custom_target(
'gen-log-rc',
input: ['winlog'/'pist_winlog.man'],
output: ['pist_winlog.rc', 'pist_winlog.h'],
command: [mc_prog, '-um', '-h', '@OUTDIR@', '-r', '@OUTDIR@', '@INPUT@']
)
mc_prog = find_program('mc', required: false)
if mc_prog.found()
# Use 'mc' if available
gen_src_log_rc_ct = custom_target(
'gen-log-rc',
input: ['winlog'/'pist_winlog.man'],
output: ['pist_winlog.rc', 'pist_winlog.h'],
command: [mc_prog, '-um', '-h', '@OUTDIR@', '-r', '@OUTDIR@', '@INPUT@']
)
else
mc_prog = find_program('windmc.exe')
check_man_vs_mc = custom_target(
'check-man-vs-mc',
output: 'check-man-vs-mc.txt',
command: [
'bash', '-c',
'''
if [ "@INPUT0@" -nt "@INPUT1@" ]; then
echo "Error: pist_winlog.man is newer than pist_winlog.mc. Please update pist_winlog.mc."
exit 1
else
echo "pist_winlog.man is not newer than pist_winlog.mc. Proceeding..."
touch @OUTPUT@
fi
''',
'@INPUT0@', '@INPUT1@'
],
input: ['winlog/pist_winlog.man', 'winlog/pist_winlog.mc'],
build_by_default: true
)

gen_src_log_rc_ct = custom_target(
'gen-log-rc',
input: ['winlog'/'pist_winlog.mc'],
output: ['pist_winlog.rc', 'pist_winlog.h'],
command: [
mc_prog,
'-h', '@OUTDIR@', # Output directory for headers
'-r', '@OUTDIR@', # Output directory for RC files
'@INPUT@' # Input file (pist_winlog.mc)
],
depends: [check_man_vs_mc] # Ensure the test runs first
)
endif


if compiler.get_id() == 'gcc'
gen_src_log_res_ct = custom_target('gen-log-res',
input: [gen_src_log_rc_ct[0]], # pist_winlog.rc
Expand Down
Loading

0 comments on commit e0ec4c5

Please sign in to comment.