2020-12-14 04:14:08 +01:00
|
|
|
project('dosbox-staging', 'c', 'cpp',
|
2021-12-25 09:08:39 -08:00
|
|
|
version : '0.79.0',
|
2021-12-12 10:58:28 -08:00
|
|
|
license : 'GPL-2.0-or-later',
|
|
|
|
meson_version : '>= 0.54.2',
|
|
|
|
default_options : [
|
|
|
|
'cpp_std=c++17',
|
|
|
|
'warning_level=3',
|
|
|
|
'b_ndebug=if-release',
|
|
|
|
'b_staticpic=false',
|
|
|
|
'fluidsynth:enable-floats=true',
|
|
|
|
'fluidsynth:openmp=disabled',
|
|
|
|
'fluidsynth:enable-threads=false',
|
|
|
|
'fluidsynth:try-static-deps=false',
|
|
|
|
'fluidsynth:warning_level=0',
|
|
|
|
'glib:glib_assert=false',
|
|
|
|
'glib:glib_checks=false',
|
|
|
|
'glib:glib_debug=disabled',
|
|
|
|
'glib:libmount=disabled',
|
2021-12-14 18:09:46 -08:00
|
|
|
'glib:libelf=disabled',
|
2021-12-12 10:58:28 -08:00
|
|
|
'glib:nls=disabled',
|
|
|
|
'glib:tests=false',
|
|
|
|
'glib:warning_level=0',
|
|
|
|
'glib:xattr=false',
|
|
|
|
'gtest:warning_level=0',
|
|
|
|
'mt32emu:warning_level=0',
|
|
|
|
'slirp:warning_level=0',
|
|
|
|
]
|
|
|
|
)
|
2020-12-14 04:14:08 +01:00
|
|
|
|
2021-02-06 18:06:49 +01:00
|
|
|
# After increasing the minimum-required meson version, make the following
|
|
|
|
# improvements:
|
|
|
|
#
|
2021-02-09 13:42:30 +01:00
|
|
|
# - 0.55.0 - subproject wraps are automatically promoted to fallbacks,
|
|
|
|
# stop using: "fallback : ['foo', 'foo_dep']" for dependencies
|
2021-02-06 18:06:49 +01:00
|
|
|
# - 0.56.0 - use meson.current_source_dir() in unit tests
|
2020-12-14 04:14:08 +01:00
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
cxx = meson.get_compiler('cpp')
|
2021-12-12 11:27:58 -08:00
|
|
|
prefers_static_libs = (get_option('default_library') == 'static')
|
2020-12-14 04:14:08 +01:00
|
|
|
|
2021-10-03 22:29:24 +02:00
|
|
|
summary('Build type', get_option('buildtype'), section : 'Build Summary')
|
|
|
|
summary('Install prefix', get_option('prefix'), section : 'Build Summary')
|
|
|
|
|
2021-12-30 09:30:34 -08:00
|
|
|
# extra compiler flags
|
2022-05-08 07:08:07 -07:00
|
|
|
extra_flags = ['-Wno-unknown-pragmas']
|
2021-12-30 09:30:34 -08:00
|
|
|
|
|
|
|
# If the compiler provides std::filesystem, then we consider it modern enough
|
|
|
|
# that we can trust it's extra helpful warnings to let us improve the code quality.
|
|
|
|
if cxx.has_header('filesystem')
|
|
|
|
extra_flags += ['-Wmaybe-uninitialized', '-Weffc++', '-Wextra-semi']
|
|
|
|
else
|
|
|
|
# Otherwise, it's an old compiler and we're just trying to build, and don't
|
|
|
|
# care about fixing their warnings (some generate warnings from their own STL).
|
|
|
|
warning('Compiler lacks the C++17 std::filesystem - try to upgrade your compiler!')
|
|
|
|
endif
|
|
|
|
|
2021-12-12 15:37:44 +13:00
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
extra_flags += '-Wno-pedantic-ms-format'
|
|
|
|
endif
|
2021-12-12 11:27:58 -08:00
|
|
|
if prefers_static_libs
|
|
|
|
extra_flags += ['-static-libstdc++', '-static-libgcc']
|
|
|
|
else
|
|
|
|
extra_flags += ['-shared-libstdc++', '-shared-libgcc', '-fPIC']
|
|
|
|
endif
|
2021-12-12 15:37:44 +13:00
|
|
|
foreach flag : extra_flags
|
|
|
|
if cc.has_argument(flag)
|
|
|
|
add_project_arguments(flag, language : 'c')
|
|
|
|
endif
|
|
|
|
if cxx.has_argument(flag)
|
|
|
|
add_project_arguments(flag, language : 'cpp')
|
2021-11-02 13:17:37 -07:00
|
|
|
endif
|
|
|
|
endforeach
|
2020-12-14 04:14:08 +01:00
|
|
|
|
2020-12-20 11:38:00 +01:00
|
|
|
# gather data for config file
|
2020-12-14 04:14:08 +01:00
|
|
|
#
|
2021-01-12 20:45:49 +01:00
|
|
|
# Actual config.h file will be generated after all interpreting build files
|
|
|
|
# for all subdirs.
|
|
|
|
#
|
2020-12-14 04:14:08 +01:00
|
|
|
conf_data = configuration_data()
|
|
|
|
conf_data.set('version', meson.project_version())
|
2021-01-04 23:54:37 +01:00
|
|
|
|
2021-02-07 22:17:05 +01:00
|
|
|
os_family_name = {
|
|
|
|
'linux' : 'LINUX',
|
|
|
|
'windows' : 'WIN32',
|
|
|
|
'cygwin' : 'WIN32',
|
|
|
|
'darwin' : 'MACOSX',
|
|
|
|
'freebsd' : 'BSD',
|
|
|
|
'netbsd' : 'BSD',
|
|
|
|
'openbsd' : 'BSD',
|
|
|
|
'dragonfly' : 'BSD',
|
|
|
|
}.get(host_machine.system(), 'UNKNOWN_OS')
|
|
|
|
conf_data.set(os_family_name, 1)
|
2021-01-04 23:54:37 +01:00
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
conf_data.set10('C_MODEM', get_option('use_sdl2_net'))
|
|
|
|
conf_data.set10('C_IPX', get_option('use_sdl2_net'))
|
2021-12-02 12:19:25 -08:00
|
|
|
conf_data.set10('C_SLIRP', get_option('use_slirp'))
|
|
|
|
conf_data.set10('C_NE2000', get_option('use_slirp'))
|
2020-12-14 04:14:08 +01:00
|
|
|
conf_data.set10('C_OPENGL', get_option('use_opengl'))
|
|
|
|
conf_data.set10('C_FLUIDSYNTH', get_option('use_fluidsynth'))
|
2021-02-09 13:42:30 +01:00
|
|
|
conf_data.set10('C_MT32EMU', get_option('use_mt32emu'))
|
2020-12-14 04:14:08 +01:00
|
|
|
conf_data.set10('C_SSHOT', get_option('use_png'))
|
2021-01-12 20:45:49 +01:00
|
|
|
conf_data.set10('C_FPU', true)
|
2021-02-06 18:58:02 +01:00
|
|
|
conf_data.set10('C_FPU_X86', host_machine.cpu_family() in ['x86', 'x86_64'])
|
2020-12-14 04:14:08 +01:00
|
|
|
|
2021-01-14 21:53:42 +01:00
|
|
|
if get_option('enable_debugger') != 'none'
|
|
|
|
conf_data.set10('C_DEBUG', true)
|
2020-12-14 04:14:08 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-14 21:53:42 +01:00
|
|
|
if get_option('enable_debugger') == 'heavy'
|
|
|
|
conf_data.set10('C_HEAVY_DEBUG', true)
|
2021-01-12 22:14:51 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-21 16:18:40 +01:00
|
|
|
foreach osdef : ['LINUX', 'WIN32', 'MACOSX', 'BSD']
|
|
|
|
if conf_data.has(osdef)
|
|
|
|
conf_data.set10('C_DIRECTSERIAL', true)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2021-01-14 21:53:42 +01:00
|
|
|
if cc.has_function('clock_gettime', prefix : '#include <time.h>')
|
|
|
|
conf_data.set10('HAVE_CLOCK_GETTIME', true)
|
2020-12-14 04:14:08 +01:00
|
|
|
endif
|
|
|
|
|
2021-06-01 09:02:39 -05:00
|
|
|
if cc.has_function('__builtin_available')
|
|
|
|
conf_data.set10('HAVE_BUILTIN_AVAILABLE', true)
|
|
|
|
endif
|
|
|
|
|
2021-08-16 12:23:27 -05:00
|
|
|
if cc.has_function('__builtin___clear_cache')
|
|
|
|
conf_data.set10('HAVE_BUILTIN_CLEAR_CACHE', true)
|
|
|
|
endif
|
|
|
|
|
2021-01-14 21:53:42 +01:00
|
|
|
if cc.has_function('mprotect', prefix : '#include <sys/mman.h>')
|
|
|
|
conf_data.set10('HAVE_MPROTECT', true)
|
2020-12-17 07:15:53 +01:00
|
|
|
endif
|
|
|
|
|
2021-06-01 09:02:39 -05:00
|
|
|
if cc.has_function('mmap', prefix : '#include <sys/mman.h>')
|
|
|
|
conf_data.set10('HAVE_MMAP', true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.has_header_symbol('sys/mman.h', 'MAP_JIT')
|
|
|
|
conf_data.set10('HAVE_MAP_JIT', true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.has_function('pthread_jit_write_protect_np', prefix : '#include <pthread.h>')
|
|
|
|
conf_data.set10('HAVE_PTHREAD_WRITE_PROTECT_NP', true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.has_function('sys_icache_invalidate', prefix : '#include <libkern/OSCacheControl.h>')
|
|
|
|
conf_data.set10('HAVE_SYS_ICACHE_INVALIDATE', true)
|
|
|
|
endif
|
|
|
|
|
2021-01-03 22:30:19 -08:00
|
|
|
if cxx.has_function('pthread_setname_np', prefix : '#include <pthread.h>',
|
|
|
|
dependencies : dependency('threads'))
|
|
|
|
conf_data.set10('HAVE_PTHREAD_SETNAME_NP', true)
|
|
|
|
endif
|
|
|
|
|
2021-01-04 21:32:03 +01:00
|
|
|
if cc.has_function('realpath', prefix : '#include <stdlib.h>')
|
|
|
|
conf_data.set10('HAVE_REALPATH', true)
|
|
|
|
endif
|
|
|
|
|
2021-01-14 21:53:42 +01:00
|
|
|
if cc.has_member('struct dirent', 'd_type', prefix : '#include <dirent.h>')
|
|
|
|
conf_data.set10('HAVE_STRUCT_DIRENT_D_TYPE', true)
|
2020-12-17 07:15:53 +01:00
|
|
|
endif
|
|
|
|
|
2021-12-02 08:26:58 -08:00
|
|
|
foreach header : ['pwd.h', 'strings.h', 'netinet/in.h']
|
2021-01-14 22:35:18 +01:00
|
|
|
if cc.has_header(header)
|
|
|
|
conf_data.set('HAVE_' + header.underscorify().to_upper(), 1)
|
|
|
|
endif
|
|
|
|
endforeach
|
2021-01-04 21:57:58 +01:00
|
|
|
|
2021-12-02 08:26:58 -08:00
|
|
|
# Check for the actual calls we need in socket.h, because some systems
|
|
|
|
# have socket.h but are missing some calls.
|
|
|
|
if cc.has_header('sys/socket.h')
|
|
|
|
if cc.has_function('getpeername', prefix : '#include <sys/socket.h>') and \
|
|
|
|
cc.has_function('getsockname', prefix : '#include <sys/socket.h>')
|
|
|
|
conf_data.set10('HAVE_SYS_SOCKET_H', true)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-01-21 16:33:25 +01:00
|
|
|
# Header windows.h defines old min/max macros, that conflict with C++11
|
|
|
|
# std::min/std::max. Defining NOMINMAX prevents these macros from appearing.
|
|
|
|
if cxx.get_id() == 'msvc'
|
|
|
|
conf_data.set('NOMINMAX', true)
|
|
|
|
endif
|
|
|
|
|
2021-02-06 18:58:02 +01:00
|
|
|
if host_machine.system() in ['windows', 'cygwin']
|
2021-01-21 22:49:07 +01:00
|
|
|
conf_data.set('_USE_MATH_DEFINES', true)
|
|
|
|
endif
|
|
|
|
|
2020-12-23 07:51:26 +01:00
|
|
|
if host_machine.endian() == 'big'
|
|
|
|
conf_data.set('WORDS_BIGENDIAN', 1)
|
|
|
|
endif
|
|
|
|
|
2021-01-12 22:00:50 +01:00
|
|
|
# Non-4K memory page size is supported only for ppc64 at the moment.
|
2021-02-16 12:09:11 +01:00
|
|
|
# TODO re-enable ppc dynrec while working on W^X stuff
|
|
|
|
# disabled because SVN r4424 broke compilation of ppc backends
|
|
|
|
#if host_machine.cpu_family() in ['ppc64', 'ppc64le']
|
|
|
|
# conf_data.set('PAGESIZE', 65536)
|
|
|
|
#endif
|
2021-01-12 22:00:50 +01:00
|
|
|
|
2021-01-13 02:04:50 +01:00
|
|
|
set_prio_code = '''
|
|
|
|
#include <sys/resource.h>
|
|
|
|
int main() {
|
|
|
|
return setpriority(PRIO_PROCESS, 0, PRIO_MIN + PRIO_MAX);
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
if cc.compiles(set_prio_code, name : 'test for setpriority support')
|
|
|
|
conf_data.set('HAVE_SETPRIORITY', 1)
|
|
|
|
endif
|
|
|
|
|
2021-01-21 15:49:04 +01:00
|
|
|
# New compilers can check for this feature using __has_builtin, but this is
|
|
|
|
# broken prior to Clang 10 and GCC 10, so we prefer to have this compilation
|
|
|
|
# check for now:
|
|
|
|
builtin_expect_code = '''
|
|
|
|
void fun(bool test) {
|
|
|
|
// value of 'test' is usually going to be true
|
|
|
|
if (__builtin_expect(test, true)) {
|
|
|
|
/* likely branch */
|
|
|
|
} else {
|
|
|
|
/* unlikely branch */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
if cxx.compiles(builtin_expect_code, name : 'test for __builtin_expect support')
|
|
|
|
conf_data.set('C_HAS_BUILTIN_EXPECT', 1)
|
|
|
|
endif
|
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
|
|
|
|
# external dependencies
|
|
|
|
#
|
2021-02-20 23:08:19 +01:00
|
|
|
static_libs_list = get_option('try_static_libs')
|
|
|
|
msg = 'You can disable this dependency with: -D@0@=false'
|
2021-12-11 19:20:43 -08:00
|
|
|
optional_dep = dependency('', required : false)
|
|
|
|
dl_dep = cc.find_library('dl', required : false)
|
|
|
|
atomic_dep = cxx.find_library('atomic', required : false)
|
|
|
|
stdcppfs_dep = cxx.find_library('stdc++fs', required : false)
|
|
|
|
opus_dep = dependency('opusfile',
|
|
|
|
static : ('opusfile' in static_libs_list))
|
|
|
|
threads_dep = dependency('threads')
|
|
|
|
sdl2_dep = dependency('sdl2', version : '>= 2.0.5',
|
|
|
|
static : ('sdl2' in static_libs_list))
|
2022-05-06 18:45:26 -07:00
|
|
|
zlib_dep = dependency('zlib', version : '>= 1.2.11',
|
|
|
|
static : ('zlib' in static_libs_list))
|
2022-05-19 06:31:45 -07:00
|
|
|
speexdsp_dep = dependency('speexdsp', version : '> 1.1.9',
|
2022-05-17 09:23:01 +10:00
|
|
|
static : ('speexdsp' in static_libs_list))
|
2021-12-11 19:20:43 -08:00
|
|
|
sdl2_net_dep = optional_dep
|
|
|
|
opengl_dep = optional_dep
|
|
|
|
fluid_dep = optional_dep
|
2021-12-09 15:05:51 -08:00
|
|
|
libslirp_dep = optional_dep
|
2021-12-11 19:20:43 -08:00
|
|
|
mt32emu_dep = optional_dep
|
|
|
|
png_dep = optional_dep
|
|
|
|
slirp_dep = optional_dep
|
|
|
|
alsa_dep = optional_dep # Linux-only
|
|
|
|
coreaudio_dep = optional_dep # macOS-only
|
|
|
|
corefoundation_dep = optional_dep # macOS-only
|
|
|
|
coremidi_dep = optional_dep # macOS-only
|
|
|
|
winsock2_dep = optional_dep # Windows-only
|
|
|
|
winmm_dep = optional_dep # Windows-only
|
2021-01-18 22:56:03 +01:00
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
|
|
|
|
if get_option('use_sdl2_net')
|
2021-02-21 15:06:58 +01:00
|
|
|
sdl2_net_dep = dependency('SDL2_net', version : '>= 2.0.0',
|
2021-02-20 23:08:19 +01:00
|
|
|
static : ('sdl2_net' in static_libs_list),
|
2020-12-14 04:14:08 +01:00
|
|
|
not_found_message : msg.format('use_sdl2_net'))
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('use_opengl')
|
|
|
|
opengl_dep = dependency('gl', not_found_message : msg.format('use_opengl'))
|
|
|
|
endif
|
|
|
|
|
2021-12-09 15:05:51 -08:00
|
|
|
# Use a single static setting for the pool of libraries that use glib
|
|
|
|
is_glib_realm_static = prefers_static_libs
|
|
|
|
foreach l : ['fluidsynth', 'slirp']
|
|
|
|
if l in static_libs_list
|
|
|
|
is_glib_realm_static = true
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
if get_option('use_fluidsynth')
|
2021-12-09 15:05:51 -08:00
|
|
|
fluid_dep = dependency('fluidsynth', version : '>= 2.2.3',
|
|
|
|
static : is_glib_realm_static,
|
2021-03-11 14:58:07 +01:00
|
|
|
fallback : ['fluidsynth', 'fluidsynth_dep'],
|
2020-12-14 04:14:08 +01:00
|
|
|
not_found_message : msg.format('use_fluidsynth'))
|
|
|
|
endif
|
|
|
|
|
2021-12-09 15:05:51 -08:00
|
|
|
if get_option('use_slirp')
|
|
|
|
libslirp_dep = dependency('slirp', version : '>= 4.6.1',
|
|
|
|
static : is_glib_realm_static,
|
|
|
|
fallback : ['slirp', 'libslirp_dep'],
|
|
|
|
not_found_message : msg.format('use_slirp'))
|
|
|
|
endif
|
|
|
|
|
2021-02-09 13:42:30 +01:00
|
|
|
if get_option('use_mt32emu')
|
2021-12-09 15:05:51 -08:00
|
|
|
mt32emu_dep = dependency('mt32emu', version : '>= 2.5.3',
|
|
|
|
static : prefers_static_libs or ('mt32emu' in static_libs_list),
|
2021-02-09 13:42:30 +01:00
|
|
|
fallback : ['mt32emu', 'mt32emu_dep'],
|
|
|
|
not_found_message : msg.format('use_mt32emu'))
|
|
|
|
endif
|
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
if get_option('use_png')
|
2021-12-09 15:05:51 -08:00
|
|
|
png_dep = dependency('libpng',
|
|
|
|
static : prefers_static_libs or ('png' in static_libs_list),
|
2021-02-20 23:22:15 +01:00
|
|
|
not_found_message : msg.format('use_png'))
|
2020-12-14 04:14:08 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-18 21:48:12 +01:00
|
|
|
# macOS-only dependencies
|
|
|
|
#
|
|
|
|
if host_machine.system() == 'darwin'
|
2021-11-03 09:41:31 -07:00
|
|
|
|
|
|
|
# ObjectiveC parsing, if possible
|
|
|
|
if cxx.has_argument('-lobjc')
|
|
|
|
add_project_arguments('-lobjc', language : 'cpp')
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Core Audio
|
2021-01-18 21:48:12 +01:00
|
|
|
coreaudio_dep = dependency('appleframeworks',
|
|
|
|
modules : ['CoreAudio', 'AudioUnit', 'AudioToolbox'],
|
|
|
|
required : false)
|
|
|
|
if coreaudio_dep.found()
|
2021-11-03 09:41:31 -07:00
|
|
|
if cxx.check_header('AudioToolbox/AUGraph.h')
|
|
|
|
conf_data.set('C_COREAUDIO', 1)
|
|
|
|
else
|
|
|
|
warning('''Core Audio support disabled: header is unsable''')
|
|
|
|
endif
|
2021-01-18 21:48:12 +01:00
|
|
|
else
|
|
|
|
warning('''Core Audio support disabled: compiler can't detect/use Apple Frameworks''')
|
|
|
|
endif
|
|
|
|
|
2021-11-03 09:41:31 -07:00
|
|
|
# Core MIDI
|
2021-01-18 21:48:12 +01:00
|
|
|
coremidi_dep = dependency('appleframeworks',
|
|
|
|
modules : ['CoreMIDI', 'CoreFoundation'],
|
|
|
|
required : false)
|
|
|
|
if coremidi_dep.found()
|
2021-11-03 09:41:31 -07:00
|
|
|
if cxx.check_header('CoreMIDI/MIDIServices.h')
|
|
|
|
conf_data.set('C_COREMIDI', 1)
|
|
|
|
else
|
|
|
|
warning('''Core Audio support disabled: header is unsable''')
|
|
|
|
endif
|
2021-01-18 21:48:12 +01:00
|
|
|
else
|
|
|
|
warning('''Core MIDI support disabled: compiler can't detect/use Apple Frameworks''')
|
|
|
|
endif
|
2021-06-01 09:02:39 -05:00
|
|
|
|
2021-12-11 19:20:43 -08:00
|
|
|
# Locale discovery
|
|
|
|
corefoundation_dep = dependency('appleframeworks',
|
2022-02-15 19:37:18 -05:00
|
|
|
modules : ['CoreFoundation'],
|
2021-12-11 19:20:43 -08:00
|
|
|
required : false)
|
|
|
|
if corefoundation_dep.found()
|
|
|
|
if cxx.check_header('CoreFoundation/CoreFoundation.h')
|
|
|
|
conf_data.set('C_COREFOUNDATION', 1)
|
|
|
|
else
|
|
|
|
warning('''Core Foundation support disabled: header is unsable''')
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
warning('''Core Foundation support disabled: compiler can't detect/use Apple Frameworks''')
|
|
|
|
endif
|
|
|
|
|
2022-02-15 19:37:18 -05:00
|
|
|
# SDL CD dependency
|
|
|
|
coreservices_dep = dependency('appleframeworks',
|
|
|
|
modules : ['CoreServices'],
|
|
|
|
required : false)
|
|
|
|
if coreservices_dep.found()
|
|
|
|
if cxx.check_header('CoreServices/CoreServices.h')
|
|
|
|
conf_data.set('C_CORESERVICES', 1)
|
|
|
|
else
|
|
|
|
warning('''Core Services support disabled: header is unsable''')
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
warning('''Core Services support disabled: compiler can't detect/use Apple Frameworks''')
|
|
|
|
endif
|
|
|
|
|
2021-06-01 09:02:39 -05:00
|
|
|
# Apple Silicon has 16k pages
|
|
|
|
pagesize_cmd = run_command('pagesize')
|
|
|
|
if pagesize_cmd.returncode() != 0
|
|
|
|
error('''error executing pagesize''')
|
|
|
|
else
|
|
|
|
pagesize = pagesize_cmd.stdout().strip().to_int()
|
|
|
|
if pagesize != 4096
|
|
|
|
conf_data.set('PAGESIZE', pagesize)
|
|
|
|
endif
|
|
|
|
endif
|
2021-01-18 21:48:12 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-21 13:44:19 +01:00
|
|
|
# Linux-only dependencies
|
|
|
|
#
|
2021-02-12 16:27:56 +01:00
|
|
|
using_linux = (host_machine.system() == 'linux')
|
|
|
|
force_alsa = (get_option('use_alsa') == 'true')
|
|
|
|
if force_alsa or (using_linux and get_option('use_alsa') == 'auto')
|
2021-01-21 13:44:19 +01:00
|
|
|
alsa_dep = dependency('alsa')
|
|
|
|
conf_data.set('C_ALSA', 1)
|
|
|
|
endif
|
|
|
|
|
2021-01-22 01:36:26 +01:00
|
|
|
# Windows-only dependencies
|
|
|
|
#
|
2021-02-06 18:58:02 +01:00
|
|
|
if host_machine.system() in ['windows', 'cygwin']
|
2021-01-22 01:36:26 +01:00
|
|
|
winsock2_dep = cxx.find_library('ws2_32', required : true)
|
|
|
|
winmm_dep = cxx.find_library('winmm', required : true)
|
|
|
|
endif
|
|
|
|
|
2021-10-03 22:29:24 +02:00
|
|
|
summary('OpenGL support', get_option('use_opengl'))
|
|
|
|
|
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
# include directories
|
|
|
|
#
|
2021-10-04 14:23:26 +02:00
|
|
|
incdir = include_directories('include', '.')
|
2020-12-14 04:14:08 +01:00
|
|
|
|
2021-08-24 12:09:11 -05:00
|
|
|
# bundled dependencies, in dependency-order
|
2020-12-14 04:14:08 +01:00
|
|
|
#
|
2021-12-30 09:30:34 -08:00
|
|
|
subdir('src/libs/ghc')
|
2021-08-24 12:09:11 -05:00
|
|
|
subdir('src/libs/loguru')
|
2021-10-04 14:23:26 +02:00
|
|
|
subdir('src/libs/decoders')
|
2020-12-14 04:14:08 +01:00
|
|
|
subdir('src/libs/nuked')
|
|
|
|
subdir('src/libs/ppscale')
|
2021-04-14 15:26:08 -07:00
|
|
|
subdir('src/libs/residfp')
|
2022-02-11 16:58:46 -05:00
|
|
|
subdir('src/libs/sdlcd')
|
2021-10-05 07:27:07 -07:00
|
|
|
subdir('src/libs/whereami')
|
2022-04-30 20:09:27 -05:00
|
|
|
subdir('src/libs/PDCurses')
|
2022-05-20 17:11:44 +10:00
|
|
|
subdir('src/libs/iir1')
|
2020-12-14 04:14:08 +01:00
|
|
|
|
|
|
|
# internal libs
|
|
|
|
#
|
|
|
|
internal_deps = []
|
|
|
|
subdir('src/cpu')
|
|
|
|
subdir('src/debug')
|
|
|
|
subdir('src/dos')
|
|
|
|
subdir('src/fpu')
|
|
|
|
subdir('src/gui')
|
|
|
|
subdir('src/hardware')
|
|
|
|
subdir('src/ints')
|
|
|
|
subdir('src/midi')
|
|
|
|
subdir('src/misc')
|
|
|
|
subdir('src/shell')
|
|
|
|
|
|
|
|
|
2021-01-12 20:45:49 +01:00
|
|
|
# generate config.h
|
|
|
|
#
|
|
|
|
configure_file(input : 'src/config.h.in', output : 'config.h',
|
|
|
|
configuration : conf_data)
|
|
|
|
|
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
# dosbox executable
|
|
|
|
#
|
2021-02-13 20:27:48 +01:00
|
|
|
version_file = vcs_tag(input : 'src/version.cpp.in', output : 'version.cpp')
|
2021-09-25 14:52:45 +12:00
|
|
|
dosbox_sources = ['src/main.cpp', 'src/dosbox.cpp', version_file]
|
|
|
|
|
|
|
|
# Add Windows resources file if building on Windows
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
winmod = import('windows')
|
|
|
|
res_file = winmod.compile_resources('src/winres.rc')
|
|
|
|
dosbox_sources += res_file
|
|
|
|
endif
|
|
|
|
|
|
|
|
executable('dosbox', dosbox_sources,
|
2021-10-03 21:33:52 -07:00
|
|
|
dependencies : [atomic_dep,
|
|
|
|
stdcppfs_dep,
|
|
|
|
sdl2_dep,
|
|
|
|
threads_dep,
|
2022-05-20 17:11:44 +10:00
|
|
|
libiir1_dep,
|
2021-12-30 09:30:34 -08:00
|
|
|
libghc_dep,
|
2021-10-03 21:33:52 -07:00
|
|
|
libloguru_dep,
|
2022-04-30 20:09:27 -05:00
|
|
|
libpdcurses_dep,
|
2022-02-11 16:58:46 -05:00
|
|
|
libsdlcd_dep,
|
2021-10-03 21:33:52 -07:00
|
|
|
libwhereami_dep]
|
|
|
|
+ internal_deps,
|
2021-02-04 16:56:23 +01:00
|
|
|
include_directories : incdir,
|
|
|
|
install : true)
|
2021-10-10 19:58:21 -07:00
|
|
|
# create a library so we can test things inside DOSBOX dep path
|
2022-01-01 07:48:27 -08:00
|
|
|
libdosbox = static_library('dosbox', ['src/dosbox.cpp', version_file],
|
2021-10-10 19:58:21 -07:00
|
|
|
include_directories : incdir,
|
2021-12-30 09:30:34 -08:00
|
|
|
dependencies : [atomic_dep,
|
|
|
|
threads_dep,
|
|
|
|
sdl2_dep,
|
2022-05-20 17:11:44 +10:00
|
|
|
libiir1_dep,
|
2021-12-30 09:30:34 -08:00
|
|
|
libghc_dep,
|
2022-02-11 16:58:46 -05:00
|
|
|
libloguru_dep,
|
|
|
|
libsdlcd_dep]
|
2021-12-30 09:30:34 -08:00
|
|
|
+ internal_deps)
|
|
|
|
|
2021-10-10 19:58:21 -07:00
|
|
|
dosbox_dep = declare_dependency(link_with : libdosbox)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# tests
|
|
|
|
#
|
|
|
|
# Some tests use relative paths; in meson 0.56.0 this can be replaced
|
|
|
|
# with meson.project_source_root().
|
|
|
|
project_source_root = meson.current_source_dir()
|
|
|
|
subdir('tests')
|
|
|
|
|
2021-02-04 16:56:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
# additional files for installation
|
|
|
|
#
|
|
|
|
data_dir = get_option('datadir')
|
|
|
|
licenses_dir = data_dir / 'licenses' / 'dosbox-staging'
|
|
|
|
doc_dir = data_dir / 'doc' / 'dosbox-staging'
|
|
|
|
|
|
|
|
install_man('docs/dosbox.1')
|
|
|
|
install_data('COPYING', install_dir : licenses_dir)
|
|
|
|
install_data('AUTHORS', 'README', 'THANKS', install_dir : doc_dir)
|
|
|
|
|
|
|
|
subdir('contrib/linux')
|
|
|
|
subdir('contrib/icons')
|
2022-03-25 15:28:51 -07:00
|
|
|
subdir('contrib/resources')
|