Some checks failed
Ubuntu Cross to Win64 / Cross Compile with ming64 (1.4.0, ubuntu-latest) (push) Failing after 1m32s
146 lines
4.5 KiB
Meson
146 lines
4.5 KiB
Meson
project('rtengine', ['c', 'cpp'],
|
|
default_options: ['buildtype=debug',
|
|
'b_sanitize=address',
|
|
'c_std=c17',
|
|
'cpp_std=c++20',
|
|
'warning_level=2',
|
|
'werror=true',
|
|
'b_vscrt=static_from_buildtype',
|
|
'default_library=static',
|
|
'cpp_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(
|
|
['-Wno-sign-conversion',
|
|
'-Wdouble-promotion', '-Wno-unused-function', '-Wno-unused-parameter',
|
|
'-fms-extensions'],
|
|
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
|
|
|
|
# OS Specific flags
|
|
if host_machine.system() == 'linux'
|
|
add_project_arguments(['-D_GNU_SOURCE'], language : ['c', 'cpp'])
|
|
endif
|
|
|
|
|
|
# Handle Linux to Windows cross compilation.
|
|
# By default, mingw does not find its own windows headers...
|
|
if build_machine.system() == 'linux' and host_machine.system() == 'windows'
|
|
message('Adding /usr/share/mingw-w64/include to the project include path.')
|
|
add_project_arguments(['-isystem/usr/share/mingw-w64/include',
|
|
'-DRT_CROSS_LINUX_WINDOWS',
|
|
'-D_WIN32_WINNT=0x600'],
|
|
language: ['c', 'cpp'],
|
|
native: false)
|
|
endif
|
|
|
|
fs = import('fs')
|
|
|
|
# Gather dependencies
|
|
thread_dep = dependency('threads')
|
|
m_dep = compiler.find_library('m', required : false)
|
|
vk_dep = dependency('vulkan', required : false)
|
|
|
|
# Subprojects installed via wraps
|
|
meshoptimizer_proj = subproject('meshoptimizer', default_options: ['warning_level=0', 'werror=false'] )
|
|
meshoptimizer_dep = meshoptimizer_proj.get_variable('meshoptimizer_dep')
|
|
|
|
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'
|
|
contrib_incdir = include_directories('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, app_lib, vk_renderer_lib]
|
|
elif get_option('static_renderer') == 'null'
|
|
engine_link_libs = [runtime_lib, app_lib, null_renderer_lib]
|
|
elif get_option('static_renderer') == 'dx11'
|
|
engine_link_libs = [runtime_lib, app_lib, dx11_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
|
|
|
|
# For Cross builds, we need libgcc from mingw
|
|
if build_machine.system() == 'linux' and host_machine.system() == 'windows'
|
|
custom_target('copy libgcc',
|
|
input : '/usr/lib/gcc/x86_64-w64-mingw32/10-win32/libgcc_s_seh-1.dll',
|
|
output : 'libgcc_s_seh-1.dll',
|
|
command : [copy_util, '@INPUT@', '@OUTPUT@'],
|
|
build_by_default : true)
|
|
endif
|
|
|
|
|