meson: Migrate host os checks to use 'host_os' var

This commit is contained in:
Matt Borgerson 2025-01-06 04:08:54 -07:00
parent 77ea1b2bf5
commit 76fce2b066
6 changed files with 27 additions and 15 deletions

View File

@ -800,7 +800,7 @@ endif
libm = cc.find_library('m', required: false)
if targetos == 'windows'
if host_os == 'windows'
threads = declare_dependency()
meson.override_dependency('threads', threads)
else
@ -1935,7 +1935,7 @@ have_gtk_clipboard = get_option('gtk_clipboard').enabled()
# xemu: GTK is required in Linux builds for file selection interfaces. In the
# future, this may be relaxed in the future with alternative options.
require_gtk = targetos == 'linux'
require_gtk = host_os == 'linux'
if require_gtk or get_option('gtk') \
.disable_auto_if(not have_system) \

View File

@ -43,9 +43,13 @@ xemu_cocoa = dependency('appleframeworks', modules: 'Cocoa')
xemu_ss.add(xemu_cocoa)
endif
xemu_ss.add(when: 'CONFIG_LINUX', if_true: [gtk, files('xemu-os-utils-linux.c')])
xemu_ss.add(when: 'CONFIG_WIN32', if_true: files('xemu-os-utils-windows.c'))
xemu_ss.add(when: 'CONFIG_DARWIN', if_true: files('xemu-os-utils-macos.m'))
if host_os == 'linux'
xemu_ss.add([gtk, files('xemu-os-utils-linux.c')])
elif host_os == 'windows'
xemu_ss.add(files('xemu-os-utils-windows.c'))
elif host_os == 'darwin'
xemu_ss.add(files('xemu-os-utils-macos.m'))
endif
xemu_ss.add(imgui, implot, stb_image, noc, sdl, opengl, openssl, fa, fpng, json, httplib, fatx)
system_ss.add_all(xemu_ss)

View File

@ -34,10 +34,14 @@ implot = declare_dependency(link_with: libimplot,
include_directories: 'implot')
noc_ss = ss.source_set()
noc_ss.add(when: 'CONFIG_LINUX', if_true: [gtk, files('noc_file_dialog/noc_file_dialog_gtk.c')])
noc_ss.add(when: 'CONFIG_WIN32', if_true: files('noc_file_dialog/noc_file_dialog_win32.cc'))
noc_ss.add(when: 'CONFIG_DARWIN', if_true: files('noc_file_dialog/noc_file_dialog_macos.m'))
noc_ss = noc_ss.apply(config_all, strict: false)
if host_os == 'linux'
noc_ss.add([gtk, files('noc_file_dialog/noc_file_dialog_gtk.c')])
elif host_os == 'windows'
noc_ss.add(files('noc_file_dialog/noc_file_dialog_win32.cc'))
elif host_os == 'darwin'
noc_ss.add(files('noc_file_dialog/noc_file_dialog_macos.m'))
endif
noc_ss = noc_ss.apply(config_target, strict: false)
noclib = static_library('noc',
sources: noc_ss.sources(),
dependencies: noc_ss.dependencies(),
@ -64,7 +68,7 @@ json = declare_dependency(include_directories: 'json')
httplib_proj = subproject('cpp-httplib', default_options: ['cpp-httplib_openssl=enabled'])
httplib_deps = [httplib_proj.get_variable('cpp_httplib_dep')]
if targetos == 'windows'
if host_os == 'windows'
httplib_deps += [crypt32]
endif
httplib = declare_dependency(dependencies: httplib_deps)

View File

@ -22,4 +22,6 @@ xemu_ss.add(files(
'widgets.cc',
))
xemu_ss.add(when: 'CONFIG_WIN32', if_true: files('update.cc'))
if host_os == 'windows'
xemu_ss.add(files('update.cc'))
endif

View File

@ -64,7 +64,9 @@ util_ss.add(files('int128.c'))
util_ss.add(files('memalign.c'))
util_ss.add(files('interval-tree.c'))
util_ss.add(files('lockcnt.c'))
util_ss.add(when: 'CONFIG_WIN32', if_true: files('miniz/miniz.c'))
if host_os == 'windows'
util_ss.add(files('miniz/miniz.c'))
endif
util_ss.add(files('fast-hash.c'))
util_ss.add(files('mstring.c'))

View File

@ -1,3 +1,3 @@
softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files(
'loader.c',
))
if host_os == 'windows'
system_ss.add('loader.c')
endif