meson.build: Improve Windows compatibility

Meson still needs a patch to pick the correct compiler on Windows and enet
still does not link on Windows.

FossilOrigin-Name: 51594e74fba5032135c87146cf3363c2c03f1357bb1410119e35afd316417641
This commit is contained in:
Jonathan Schleifer 2024-08-04 11:35:00 +00:00
parent faf0a4096e
commit ba77aa6588

View file

@ -1,5 +1,5 @@
project('Cube', ['c', 'objcpp'], project('Cube', ['c', 'objcpp'],
meson_version: '1.5.0') meson_version: '>=1.5.0')
add_global_arguments( add_global_arguments(
[ [
@ -12,10 +12,18 @@ objfw_dep = dependency('objfw')
sdl12_dep = dependency('sdl12_compat') sdl12_dep = dependency('sdl12_compat')
sdlimage_dep = dependency('SDL_image') sdlimage_dep = dependency('SDL_image')
sdlmixer_dep = dependency('SDL_mixer') sdlmixer_dep = dependency('SDL_mixer')
gl_dep = dependency('gl')
glu_dep = dependency('glu')
zlib_dep = dependency('zlib') zlib_dep = dependency('zlib')
x11_dep = dependency('x11', required: false)
link_args = []
extra_deps = []
if host_machine.system() == 'windows'
link_args += ['-lopengl32', '-lglu32']
else
extra_deps += dependency('gl')
extra_deps += dependency('glu')
extra_deps += dependency('x11')
endif
enet_includes = include_directories('enet/include') enet_includes = include_directories('enet/include')
enet = static_library('enet', enet = static_library('enet',
@ -73,13 +81,13 @@ executable('client',
sdl12_dep, sdl12_dep,
sdlimage_dep, sdlimage_dep,
sdlmixer_dep, sdlmixer_dep,
gl_dep,
glu_dep,
zlib_dep, zlib_dep,
x11_dep, extra_deps
], ],
include_directories: [enet_includes], include_directories: [enet_includes],
link_with: [enet]) link_args: link_args,
link_with: [enet],
win_subsystem: 'windows')
executable('server', executable('server',
[ [
@ -94,4 +102,5 @@ executable('server',
sdl12_dep sdl12_dep
], ],
include_directories: [enet_includes], include_directories: [enet_includes],
link_with: [enet]) link_with: [enet],
win_subsystem: 'console')