Now we need to draw something and also have the correct semaphore waits to establish dependencies.
108 lines
3.1 KiB
Meson
108 lines
3.1 KiB
Meson
project('voyage', ['c', 'cpp'],
|
|
default_options: ['buildtype=debug',
|
|
'b_sanitize=address',
|
|
'c_std=c17',
|
|
'cpp_std=c++14',
|
|
'warning_level=3',
|
|
'werror=true',
|
|
'b_vscrt=static_from_buildtype',
|
|
'default_library=static',
|
|
'b_rtti=false',
|
|
'cpp_eh=none'])
|
|
|
|
compiler = meson.get_compiler('c')
|
|
buildtype = get_option('buildtype')
|
|
|
|
# Build options
|
|
if compiler.get_argument_syntax() == 'gcc'
|
|
add_project_arguments(
|
|
['-Wconversion', '-Wno-sign-conversion',
|
|
'-Wdouble-promotion', '-Wno-unused-function', '-Wno-unused-parameter'],
|
|
language : ['c', 'cpp']
|
|
)
|
|
elif compiler.get_argument_syntax() == 'msvc'
|
|
add_project_arguments(
|
|
['/wd4146', '/wd4245', '/wd4100', '/D_CRT_SECURE_NO_WARNINGS'],
|
|
language: ['c', 'cpp']
|
|
)
|
|
if buildtype == 'debug'
|
|
add_project_arguments(['/RTCsu'], language : ['c', 'cpp'])
|
|
endif
|
|
# Allow nameless struct/unions (standard in C11)
|
|
add_project_arguments(['/wd4201'], language : 'cpp')
|
|
endif
|
|
|
|
if get_option('default_library') == 'static'
|
|
add_project_arguments(['-DRT_STATIC_LIB'], language : ['c', 'cpp'])
|
|
endif
|
|
|
|
if get_option('error_report_debugbreak')
|
|
add_project_arguments(['-DRT_ERROR_REPORT_DEBUGBREAK'], language : ['c', 'cpp'])
|
|
endif
|
|
|
|
# Debug specific flags
|
|
if buildtype == 'debug' or buildtype == 'debugoptimized'
|
|
add_project_arguments([ '-DRT_DEBUG'], language : ['c', 'cpp'])
|
|
endif
|
|
|
|
fs = import('fs')
|
|
|
|
# Gather dependencies
|
|
thread_dep = dependency('threads')
|
|
m_dep = compiler.find_library('m', required : false)
|
|
vk_dep = dependency('vulkan', required : false)
|
|
|
|
windowing_dep = []
|
|
if get_option('use_xlib')
|
|
windowing_dep = dependency('x11', required : true)
|
|
add_project_arguments(['-DRT_USE_XLIB'], language : ['c', 'cpp'])
|
|
endif
|
|
|
|
# Copy file utility
|
|
copy_util = find_program('scripts/copy_util.py')
|
|
|
|
engine_incdir = include_directories('src')
|
|
|
|
contrib_dir = meson.project_source_root() / 'contrib'
|
|
|
|
# Targets append to this, to enable us to run shared library builds from IDEs
|
|
engine_lib_paths = []
|
|
engine_libs = []
|
|
|
|
subdir('src')
|
|
|
|
# Handle linking against both runtime and renderer if we build static libs
|
|
engine_link_libs = []
|
|
if get_option('default_library') == 'static'
|
|
if get_option('static_renderer') == 'vk'
|
|
engine_link_libs = [runtime_lib, gfx_lib, app_lib, vk_renderer_lib]
|
|
else
|
|
error('Invalid static_renderer option ', get_option('static_renderer'))
|
|
endif
|
|
else
|
|
engine_link_libs = [runtime_lib, gfx_lib, app_lib]
|
|
endif
|
|
|
|
# Unit/Integration test driver
|
|
subdir('tests')
|
|
|
|
# Declare dependencies, to enable using the engine as a subproject
|
|
engine_dep = declare_dependency(link_with : engine_link_libs,
|
|
include_directories : engine_incdir)
|
|
|
|
assetc_dep = declare_dependency(link_with : asset_compiler,
|
|
include_directories : engine_incdir)
|
|
|
|
# "inline" game
|
|
if get_option('game_as_subdir')
|
|
subdir('src/game')
|
|
|
|
# If we are building shared libraries, copy them to the games output directory.
|
|
# This ensures that we can debug with visual studio.
|
|
foreach lib_path : engine_lib_paths
|
|
run_target('copy'+fs.name(lib_path),
|
|
command : [copy_util, lib_path, join_paths(game_build_dir, fs.name(lib_path))],
|
|
depends : engine_libs)
|
|
endforeach
|
|
endif
|