Project

General

Profile

Feature #1881 » 0027-Meson-Use-host_machine.system-to-detect-emscripten-b.patch

main, S3_3 - Marko Lindqvist, 04/03/2026 01:08 PM

View differences:

meson.build
cross_inc_path = [cross_inc_str]
cross_lib_path = [meson.get_external_property('cross_lib_path', '')]
crosser = meson.get_external_property('crosser', false)
# emscripten build is always cross-build, so check it only here
if c_compiler.compiles(
'''#ifndef __EMSCRIPTEN__
error fail
#endif''',
name: 'emscripten')
emscripten = true
else
emscripten = false
endif
else
cross_inc_str = ''
cross_inc_path = []
cross_lib_path = []
crosser = false
emscripten = false
endif
server_type = get_option('server')
......
pub_conf_data.set('FREECIV_HAVE_CXX_NULLPTR', 1)
endif
if emscripten
if host_system == 'emscripten'
icu_dep = []
zlib_dep = []
syslua = 'false'
......
c_compiler.find_library('SDL2main', dirs: cross_lib_path),
dependency('SDL2')]
else
if emscripten
if host_system == 'emscripten'
emscripten_sdl2_args = [
'-s', 'USE_SDL=2'
]
......
sdl3main_dep = [c_compiler.find_library('mingw32', dirs: cross_lib_path),
dependency('sdl3')]
else
if emscripten
if host_system == 'emscripten'
emscripten_sdl3_args = [
'-s', 'USE_SDL=3'
]
......
if get_option('audio') != 'none'
priv_conf_data.set('AUDIO_SDL', 1)
if emscripten
if host_system == 'emscripten'
audio_dep = []
elif get_option('audio') == 'sdl3'
audio_sdl3_dep = dependency('sdl3-mixer')
......
gettext_dep = []
endif
if emscripten
if host_system == 'emscripten'
curl_dep = []
m_dep = []
else
......
m_dep = c_compiler.find_library('m', dirs: cross_lib_path)
endif
if not emscripten
if host_system != 'emscripten'
if c_compiler.compiles(net_incl + '''
#include <stddef.h>
#include <curl/curl.h>
......
endif
endif
if not emscripten
if host_system != 'emscripten'
sqlite3_dep = c_compiler.find_library('sqlite3', dirs: cross_lib_path)
else
sqlite3_dep = []
......
endif
if fcdb
if emscripten
if host_system == 'emscripten'
error('FCDB not supported on emscripten builds.')
endif
priv_conf_data.set('HAVE_FCDB', 1)
......
sdl2_image_dep = []
sdl2_ttf_dep = []
if not emscripten
if host_system != 'emscripten'
sdl2_gfx_dep = dependency('SDL2_gfx', required: false)
if not sdl2_gfx_dep.found()
......
sdl3_image_dep = []
sdl3_ttf_dep = []
if not emscripten
if host_system != 'emscripten'
sdl3_gfx_inc = include_directories('dependencies')
sdl3_image_dep = dependency('sdl3-image', required: false)
(1-1/2)