2020-12-14 04:14:08 +01:00
|
|
|
project('dosbox-staging', 'c', 'cpp',
|
|
|
|
default_options : ['cpp_std=c++14', 'b_ndebug=if-release'],
|
|
|
|
version : '0.77.0')
|
|
|
|
|
2020-12-19 00:32:37 +01:00
|
|
|
assert(meson.version().version_compare('>= 0.45.1'),
|
|
|
|
'Expecting meson 0.45.1 or newer.')
|
2020-12-14 04:14:08 +01:00
|
|
|
|
|
|
|
# compiler flags
|
|
|
|
#
|
2020-12-16 20:26:16 +01:00
|
|
|
# Warnings enabled below are our baseline; use '-Dwarning_level=3' to
|
|
|
|
# turn on more. The default level is 1 (meson turns on -Wall).
|
|
|
|
#
|
2020-12-14 04:14:08 +01:00
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
cxx = meson.get_compiler('cpp')
|
|
|
|
|
|
|
|
add_global_arguments('-Weffc++', language : 'cpp')
|
|
|
|
if cxx.has_argument('-Wextra-semi')
|
|
|
|
add_global_arguments('-Wextra-semi', language : 'cpp')
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
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())
|
|
|
|
conf_data.set10('C_MODEM', get_option('use_sdl2_net'))
|
|
|
|
conf_data.set10('C_IPX', get_option('use_sdl2_net'))
|
|
|
|
conf_data.set10('C_OPENGL', get_option('use_opengl'))
|
|
|
|
conf_data.set10('C_FLUIDSYNTH', get_option('use_fluidsynth'))
|
|
|
|
conf_data.set10('C_SSHOT', get_option('use_png'))
|
2021-01-12 20:45:49 +01:00
|
|
|
conf_data.set10('C_FPU', true)
|
|
|
|
conf_data.set10('C_FPU_X86', (host_machine.cpu_family() == 'x86_64' or
|
|
|
|
host_machine.cpu_family() == 'x86'))
|
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-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-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-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-01-04 21:57:58 +01:00
|
|
|
if cc.has_header('netinet/in.h')
|
|
|
|
conf_data.set10('HAVE_NETINET_IN_H', true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.has_header('pwd.h')
|
|
|
|
conf_data.set10('HAVE_PWD_H', true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.has_header('strings.h')
|
|
|
|
conf_data.set10('HAVE_STRINGS_H', true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.has_header('sys/socket.h')
|
|
|
|
conf_data.set10('HAVE_SYS_SOCKET_H', 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.
|
|
|
|
if host_machine.cpu_family() == 'ppc64' or host_machine.cpu_family() == 'ppc64le'
|
|
|
|
conf_data.set('PAGESIZE', 65536)
|
|
|
|
endif
|
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
|
|
|
|
# external dependencies
|
|
|
|
#
|
|
|
|
msg = 'You can disable this dependency with: -D@0@=false'
|
|
|
|
dummy_dep = dependency('', required : false)
|
|
|
|
threads_dep = dependency('threads')
|
|
|
|
sdl2_dep = dependency('sdl2', version : '>= 2.0.2')
|
|
|
|
|
|
|
|
if get_option('use_sdl2_net')
|
|
|
|
sdl2_net_dep = dependency('SDL2_net', version : '>= 2.0.1',
|
|
|
|
not_found_message : msg.format('use_sdl2_net'))
|
|
|
|
else
|
|
|
|
sdl2_net_dep = dummy_dep
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('use_opengl')
|
|
|
|
opengl_dep = dependency('gl', not_found_message : msg.format('use_opengl'))
|
|
|
|
else
|
|
|
|
opengl_dep = dummy_dep
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('use_fluidsynth')
|
|
|
|
fluid_dep = dependency('fluidsynth', version : '>= 2.0.0',
|
|
|
|
not_found_message : msg.format('use_fluidsynth'))
|
|
|
|
else
|
|
|
|
fluid_dep = dummy_dep
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('use_opusfile')
|
|
|
|
opus_dep = dependency('opusfile', not_found_message : msg.format('use_opusfile'))
|
|
|
|
else
|
|
|
|
opus_dep = dummy_dep
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('use_png')
|
|
|
|
png_dep = dependency('libpng', not_found_message : msg.format('use_png'))
|
|
|
|
z_dep = dependency('zlib') # libpng in Ubuntu 16.04 needs zlib linked explicitly
|
|
|
|
else
|
|
|
|
png_dep = dummy_dep
|
|
|
|
z_dep = dummy_dep
|
|
|
|
endif
|
|
|
|
|
2020-12-17 07:15:53 +01:00
|
|
|
if get_option('enable_debugger') == 'none'
|
|
|
|
curses_dep = dummy_dep
|
|
|
|
else
|
|
|
|
curses_dep = dependency('ncurses') # or pdcurses on Windows
|
|
|
|
endif
|
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
|
|
|
|
# include directories
|
|
|
|
#
|
|
|
|
incdir = include_directories('include', '.')
|
|
|
|
|
|
|
|
|
|
|
|
# bundled dependencies
|
|
|
|
#
|
|
|
|
subdir('src/libs/decoders')
|
|
|
|
subdir('src/libs/nuked')
|
|
|
|
subdir('src/libs/ppscale')
|
|
|
|
|
|
|
|
libdecoders_dep = declare_dependency(link_with : libdecoders)
|
|
|
|
libnuked_dep = declare_dependency(link_with : libnuked)
|
|
|
|
libppscale_dep = declare_dependency(link_with : libppscale)
|
|
|
|
|
|
|
|
|
|
|
|
# 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-19 00:32:37 +01:00
|
|
|
# tests
|
|
|
|
#
|
|
|
|
# We use dictionaries for test declarations, dictionaries were added
|
|
|
|
# in meson 0.47.0.
|
|
|
|
#
|
|
|
|
if meson.version().version_compare('>= 0.47.0')
|
|
|
|
# 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')
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2020-12-14 04:14:08 +01:00
|
|
|
# dosbox executable
|
|
|
|
#
|
|
|
|
executable('dosbox', ['src/main.cpp', 'src/dosbox.cpp'],
|
|
|
|
dependencies : [threads_dep, sdl2_dep] + internal_deps,
|
|
|
|
include_directories : incdir)
|