From ba77aa658869121030410769388260e18111d3c9 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 4 Aug 2024 11:35:00 +0000 Subject: [PATCH] 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 --- meson.build | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index acf64a3..39bbab6 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('Cube', ['c', 'objcpp'], - meson_version: '1.5.0') + meson_version: '>=1.5.0') add_global_arguments( [ @@ -12,10 +12,18 @@ objfw_dep = dependency('objfw') sdl12_dep = dependency('sdl12_compat') sdlimage_dep = dependency('SDL_image') sdlmixer_dep = dependency('SDL_mixer') -gl_dep = dependency('gl') -glu_dep = dependency('glu') 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 = static_library('enet', @@ -73,13 +81,13 @@ executable('client', sdl12_dep, sdlimage_dep, sdlmixer_dep, - gl_dep, - glu_dep, zlib_dep, - x11_dep, + extra_deps ], include_directories: [enet_includes], - link_with: [enet]) + link_args: link_args, + link_with: [enet], + win_subsystem: 'windows') executable('server', [ @@ -94,4 +102,5 @@ executable('server', sdl12_dep ], include_directories: [enet_includes], - link_with: [enet]) + link_with: [enet], + win_subsystem: 'console')