2023-09-23 18:20:47 +00:00
|
|
|
project('TR2X', ['c'],
|
|
|
|
default_options: [
|
2023-10-05 09:21:28 +00:00
|
|
|
'c_std=c17',
|
2023-09-23 18:20:47 +00:00
|
|
|
'warning_level=2',
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2024-04-29 22:44:09 +00:00
|
|
|
trx = subproject('libtrx')
|
2023-09-23 18:20:47 +00:00
|
|
|
c_compiler = meson.get_compiler('c')
|
|
|
|
|
|
|
|
build_opts = [
|
|
|
|
'-Wno-unused',
|
2024-04-13 19:28:12 +00:00
|
|
|
'-DMESON_BUILD',
|
2023-10-06 22:42:56 +00:00
|
|
|
'-ffile-prefix-map=../../src/=',
|
|
|
|
]
|
2024-04-13 19:28:12 +00:00
|
|
|
|
|
|
|
add_project_arguments(build_opts, language: 'c')
|
|
|
|
|
|
|
|
staticdeps = get_option('staticdeps')
|
|
|
|
|
|
|
|
null_dep = dependency('', required: false)
|
2024-04-29 22:44:09 +00:00
|
|
|
dep_trx = trx.get_variable('dep_trx')
|
2024-04-28 16:19:55 +00:00
|
|
|
dep_sdl2 = dependency('SDL2', static: staticdeps)
|
2024-04-13 19:28:12 +00:00
|
|
|
dep_mathlibrary = c_compiler.find_library('m', static: staticdeps, required : false)
|
2023-09-23 18:20:47 +00:00
|
|
|
|
|
|
|
# autogenerated files
|
2024-04-26 17:42:22 +00:00
|
|
|
exe_resources = []
|
|
|
|
dll_resources = []
|
2023-09-23 18:20:47 +00:00
|
|
|
python3 = find_program('python3', required: true)
|
|
|
|
git = find_program('git', required: true)
|
|
|
|
|
|
|
|
init = custom_target(
|
|
|
|
'fake_init',
|
|
|
|
output: ['init.c'],
|
2024-04-13 19:28:12 +00:00
|
|
|
command: [python3, meson.source_root() + '/tools/generate_init', '-o', meson.current_build_dir() / '@OUTPUT0@'],
|
|
|
|
build_always_stale: true,
|
2023-09-23 18:20:47 +00:00
|
|
|
)
|
2024-04-13 19:28:12 +00:00
|
|
|
|
2023-09-23 18:20:47 +00:00
|
|
|
version_rc = custom_target(
|
|
|
|
'fake_version',
|
|
|
|
output: ['version.rc'],
|
2024-04-13 19:28:12 +00:00
|
|
|
command: [python3, meson.source_root() + '/tools/generate_rcfile', '-o', '@OUTPUT0@'],
|
|
|
|
build_always_stale: true,
|
2023-09-23 18:20:47 +00:00
|
|
|
)
|
2024-04-13 19:28:12 +00:00
|
|
|
|
2023-09-23 18:20:47 +00:00
|
|
|
icon_rc = custom_target(
|
|
|
|
'fake_icon',
|
|
|
|
output: ['icon.rc'],
|
2024-04-13 19:28:12 +00:00
|
|
|
command: [python3, meson.source_root() + '/tools/generate_rcfile', '-o', '@OUTPUT0@'],
|
2023-09-23 18:20:47 +00:00
|
|
|
)
|
2024-04-13 19:28:12 +00:00
|
|
|
|
|
|
|
link_args = []
|
|
|
|
|
2023-09-23 18:20:47 +00:00
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
windows = import('windows')
|
2024-04-13 19:28:12 +00:00
|
|
|
|
2024-04-26 17:42:22 +00:00
|
|
|
version_resource = windows.compile_resources(version_rc)
|
|
|
|
icon_resource = windows.compile_resources(icon_rc)
|
|
|
|
exe_resources = [version_resource, icon_resource]
|
|
|
|
dll_resources = [version_resource]
|
2024-04-13 19:28:12 +00:00
|
|
|
|
|
|
|
link_args += ['-static']
|
2023-09-23 18:20:47 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
exe_sources = [
|
|
|
|
'src/main_exe.c',
|
2024-04-26 17:42:22 +00:00
|
|
|
exe_resources,
|
2023-09-23 18:20:47 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
dll_sources = [
|
2024-04-26 21:07:16 +00:00
|
|
|
init,
|
2024-03-17 20:40:45 +00:00
|
|
|
'src/decomp/decomp.c',
|
2024-05-30 10:36:51 +00:00
|
|
|
'src/game/background.c',
|
2024-04-14 19:14:19 +00:00
|
|
|
'src/game/box.c',
|
2023-10-02 09:13:31 +00:00
|
|
|
'src/game/camera.c',
|
2024-05-30 10:36:51 +00:00
|
|
|
'src/game/clock.c',
|
2024-04-27 21:44:03 +00:00
|
|
|
'src/game/console.c',
|
|
|
|
'src/game/console_cmd.c',
|
2024-04-14 18:01:26 +00:00
|
|
|
'src/game/creature.c',
|
2023-11-13 20:57:36 +00:00
|
|
|
'src/game/effects.c',
|
2024-05-30 10:59:17 +00:00
|
|
|
'src/game/hwr.c',
|
2023-11-16 17:11:47 +00:00
|
|
|
'src/game/input.c',
|
2024-04-26 20:57:48 +00:00
|
|
|
'src/game/inventory.c',
|
2023-11-03 21:18:05 +00:00
|
|
|
'src/game/items.c',
|
2023-10-06 15:09:28 +00:00
|
|
|
'src/game/lara/lara_col.c',
|
2023-11-13 22:38:04 +00:00
|
|
|
'src/game/lara/lara_control.c',
|
2023-11-13 22:09:52 +00:00
|
|
|
'src/game/lara/lara_look.c',
|
2023-10-07 12:57:05 +00:00
|
|
|
'src/game/lara/lara_misc.c',
|
2023-10-05 19:07:50 +00:00
|
|
|
'src/game/lara/lara_state.c',
|
2023-11-03 18:58:42 +00:00
|
|
|
'src/game/los.c',
|
2023-10-01 16:39:52 +00:00
|
|
|
'src/game/math.c',
|
2023-10-29 10:08:55 +00:00
|
|
|
'src/game/math_misc.c',
|
2023-09-26 22:30:59 +00:00
|
|
|
'src/game/matrix.c',
|
2024-05-01 08:44:37 +00:00
|
|
|
'src/game/music/music_backend_cdaudio.c',
|
2024-05-30 10:59:17 +00:00
|
|
|
'src/game/music/music_backend_files.c',
|
|
|
|
'src/game/music/music_main.c',
|
2024-04-13 21:07:42 +00:00
|
|
|
'src/game/objects/creatures/bird.c',
|
2023-10-29 10:30:33 +00:00
|
|
|
'src/game/output.c',
|
2023-11-17 09:26:21 +00:00
|
|
|
'src/game/overlay.c',
|
2023-11-16 19:06:45 +00:00
|
|
|
'src/game/random.c',
|
2024-05-30 10:59:17 +00:00
|
|
|
'src/game/room.c',
|
2023-10-02 07:45:42 +00:00
|
|
|
'src/game/shell.c',
|
2023-10-04 19:01:02 +00:00
|
|
|
'src/game/sound.c',
|
2023-11-03 22:01:22 +00:00
|
|
|
'src/game/text.c',
|
2024-04-26 21:07:16 +00:00
|
|
|
'src/global/vars.c',
|
2023-09-26 22:30:59 +00:00
|
|
|
'src/inject_exec.c',
|
|
|
|
'src/inject_util.c',
|
2023-10-05 08:11:38 +00:00
|
|
|
'src/lib/winmm.c',
|
2023-09-26 22:30:59 +00:00
|
|
|
'src/main_dll.c',
|
2023-10-04 19:28:11 +00:00
|
|
|
'src/specific/s_audio_sample.c',
|
2023-10-04 19:08:18 +00:00
|
|
|
'src/specific/s_flagged_string.c',
|
2023-11-16 17:11:47 +00:00
|
|
|
'src/specific/s_input.c',
|
2024-04-26 17:42:22 +00:00
|
|
|
dll_resources,
|
2023-09-23 18:20:47 +00:00
|
|
|
]
|
|
|
|
|
2024-04-29 22:44:09 +00:00
|
|
|
dll_dependencies = [
|
|
|
|
dep_trx,
|
2024-04-28 16:19:55 +00:00
|
|
|
dep_sdl2,
|
2024-04-13 19:28:12 +00:00
|
|
|
dep_mathlibrary,
|
|
|
|
]
|
|
|
|
|
2023-09-23 18:20:47 +00:00
|
|
|
executable(
|
|
|
|
'TR2X',
|
|
|
|
exe_sources,
|
|
|
|
name_prefix: '',
|
|
|
|
include_directories: ['src/'],
|
|
|
|
link_args: link_args,
|
|
|
|
gui_app: true,
|
|
|
|
)
|
2024-04-13 19:28:12 +00:00
|
|
|
|
2023-09-23 18:20:47 +00:00
|
|
|
library(
|
|
|
|
'TR2X',
|
|
|
|
dll_sources,
|
|
|
|
name_prefix: '',
|
2024-04-29 22:44:09 +00:00
|
|
|
include_directories: [
|
|
|
|
'src/',
|
|
|
|
include_directories('subprojects/libtrx/include', is_system: true),
|
|
|
|
],
|
|
|
|
dependencies: dll_dependencies,
|
2023-09-23 18:20:47 +00:00
|
|
|
link_args: link_args,
|
|
|
|
)
|