mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2025-01-08 14:20:31 +00:00
118 lines
2.6 KiB
Meson
118 lines
2.6 KiB
Meson
project('TR2X', ['c'],
|
|
default_options: [
|
|
'c_std=c17',
|
|
'warning_level=2',
|
|
],
|
|
)
|
|
|
|
warning_level = 3
|
|
|
|
c_compiler = meson.get_compiler('c')
|
|
|
|
is_mingw = c_compiler.get_id() == 'gcc' and host_machine.system() == 'windows'
|
|
if is_mingw
|
|
add_project_link_arguments([], language: 'c')
|
|
endif
|
|
|
|
build_opts = [
|
|
'-Wno-unused',
|
|
'-D_GNU_SOURCE',
|
|
]
|
|
c_opts = [
|
|
'-ffile-prefix-map=../../src/=',
|
|
]
|
|
add_project_arguments(build_opts + c_opts, language: 'c')
|
|
|
|
# autogenerated files
|
|
resources = []
|
|
python3 = find_program('python3', required: true)
|
|
git = find_program('git', required: true)
|
|
|
|
version = custom_target('version',
|
|
output: ['version.txt'],
|
|
command: [python3, meson.source_root() + '/tools/generate_version', '-o', '@OUTPUT0@'],
|
|
build_by_default: true,
|
|
build_always_stale: true
|
|
)
|
|
|
|
init = custom_target(
|
|
'fake_init',
|
|
depends: [version],
|
|
input: [version[0]],
|
|
output: ['init.c'],
|
|
command: [python3, meson.source_root() + '/tools/generate_init', '--version-file', '@INPUT@', '-o', '@OUTPUT0@'],
|
|
build_by_default: true,
|
|
)
|
|
version_rc = custom_target(
|
|
'fake_version',
|
|
depends: [version],
|
|
input: [version[0]],
|
|
output: ['version.rc'],
|
|
command: [python3, meson.source_root() + '/tools/generate_rcfile', '--version-file', '@INPUT@', '-o', '@OUTPUT0@'],
|
|
build_by_default: true,
|
|
)
|
|
icon_rc = custom_target(
|
|
'fake_icon',
|
|
input: [version[0]],
|
|
output: ['icon.rc'],
|
|
command: [python3, meson.source_root() + '/tools/generate_rcfile', '--version-file', '@INPUT@', '-o', '@OUTPUT0@'],
|
|
)
|
|
if host_machine.system() == 'windows'
|
|
windows = import('windows')
|
|
resources = [
|
|
windows.compile_resources(version_rc),
|
|
windows.compile_resources(icon_rc),
|
|
]
|
|
link_args = ['-static']
|
|
else
|
|
link_args = []
|
|
endif
|
|
|
|
exe_sources = [
|
|
init,
|
|
'src/main_exe.c',
|
|
resources,
|
|
]
|
|
|
|
dll_sources = [
|
|
'src/filesystem.c',
|
|
'src/game/camera.c',
|
|
'src/game/lara/lara_col.c',
|
|
'src/game/lara/lara_misc.c',
|
|
'src/game/lara/lara_state.c',
|
|
'src/game/math.c',
|
|
'src/game/math_misc.c',
|
|
'src/game/matrix.c',
|
|
'src/game/music.c',
|
|
'src/game/output.c',
|
|
'src/game/shell.c',
|
|
'src/game/sound.c',
|
|
'src/inject_exec.c',
|
|
'src/inject_util.c',
|
|
'src/lib/winmm.c',
|
|
'src/log.c',
|
|
'src/main_dll.c',
|
|
'src/memory.c',
|
|
'src/specific/s_audio_sample.c',
|
|
'src/specific/s_filesystem.c',
|
|
'src/specific/s_flagged_string.c',
|
|
'src/specific/s_music_mm.c',
|
|
'src/specific/s_music_pauld.c',
|
|
]
|
|
|
|
executable(
|
|
'TR2X',
|
|
exe_sources,
|
|
name_prefix: '',
|
|
include_directories: ['src/'],
|
|
link_args: link_args,
|
|
gui_app: true,
|
|
)
|
|
library(
|
|
'TR2X',
|
|
dll_sources,
|
|
name_prefix: '',
|
|
include_directories: ['src/'],
|
|
link_args: link_args,
|
|
)
|