TRX/meson.build

322 lines
9.2 KiB
Meson
Raw Normal View History

2024-04-29 19:25:40 +02:00
project(
'TR1X',
'c',
2021-11-12 21:26:26 +01:00
default_options: [
2021-11-14 23:42:18 +01:00
'c_std=c11',
2021-11-12 21:26:26 +01:00
'warning_level=2',
],
)
2024-04-29 19:25:40 +02:00
trx = subproject('libtrx')
2021-11-14 23:42:18 +01:00
c_compiler = meson.get_compiler('c')
2021-11-12 21:26:26 +01:00
build_opts = [
'-Wno-unused',
'-DMESON_BUILD',
'-fno-omit-frame-pointer',
'-ffile-prefix-map=../../src/=',
2021-11-12 21:26:26 +01:00
]
2024-03-09 23:30:30 +04:00
add_project_arguments(build_opts, language: 'c')
2021-11-12 21:26:26 +01:00
staticdeps = get_option('staticdeps')
# Always dynamically link on macOS
if host_machine.system() == 'darwin'
staticdeps = false
endif
2024-03-09 23:30:30 +04:00
null_dep = dependency('', required: false)
2023-09-20 14:00:42 +02:00
if host_machine.system() == 'windows'
2024-03-09 23:30:30 +04:00
dep_opengl = c_compiler.find_library('opengl32')
2023-09-20 14:00:42 +02:00
else
2024-03-09 23:30:30 +04:00
dep_opengl = dependency('GL')
2023-09-20 14:00:42 +02:00
endif
2021-11-12 21:26:26 +01:00
2024-04-29 19:25:40 +02:00
dep_trx = trx.get_variable('dep_trx')
dep_avcodec = dependency('libavcodec', static: staticdeps)
dep_avformat = dependency('libavformat', static: staticdeps)
dep_avutil = dependency('libavutil', static: staticdeps)
dep_mathlibrary = c_compiler.find_library('m', static: staticdeps, required : false)
dep_swscale = dependency('libswscale', static: staticdeps)
dep_swresample = dependency('libswresample', static: staticdeps)
2024-03-09 23:30:30 +04:00
dep_sdl2 = dependency('SDL2', static: staticdeps)
dep_zlib = null_dep
2024-03-09 23:30:30 +04:00
if not staticdeps
dep_zlib = dependency('zlib', static: staticdeps)
endif
2021-11-20 22:40:57 +01:00
2021-11-12 21:26:26 +01:00
# autogenerated files
2021-12-07 18:19:14 +01:00
resources = []
python3 = find_program('python3', required: true)
git = find_program('git', required: true)
2023-09-20 14:00:42 +02:00
init = custom_target(
'fake_init',
output: ['init.c'],
build: change directory before calling git Fix linux build issue : https://github.com/LostArtefacts/TR1X/issues/1296 'init.c' file is generated into meson build directory. > [3/201] /usr/bin/python3 /var/tmp/portage/games-engines/TR1X-9999/work/TR1X-9999/tools/generate_init -o init.c > FAILED: init.c > /usr/bin/python3 /var/tmp/portage/games-engines/TR1X-9999/work/TR1X-9999/tools/generate_init -o init.c > fatal: not a git repository (or any parent up to mount point /var/tmp) > Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). > Traceback (most recent call last): > File "/var/tmp/portage/games-engines/TR1X-9999/work/TR1X-9999/tools/generate_init", line 37, in <module> > main() > File "/var/tmp/portage/games-engines/TR1X-9999/work/TR1X-9999/tools/generate_init", line 31, in main > update_init_c(output_path=args.output) > File "/var/tmp/portage/games-engines/TR1X-9999/work/TR1X-9999/tools/generate_init", line 23, in update_init_c > new_text = get_init_c() > ^^^^^^^^^^^^ > File "/var/tmp/portage/games-engines/TR1X-9999/work/TR1X-9999/tools/generate_init", line 19, in get_init_c > return TEMPLATE.format(version=generate_version()) > ^^^^^^^^^^^^^^^^^^ > File "/var/tmp/portage/games-engines/TR1X-9999/work/TR1X-9999/tools/shared/versioning.py", line 21, in generate_version > version = get_branch_version(None) > ^^^^^^^^^^^^^^^^^^^^^^^^ > File "/var/tmp/portage/games-engines/TR1X-9999/work/TR1X-9999/tools/shared/versioning.py", line 5, in get_branch_version > return check_output( > ^^^^^^^^^^^^^ > File "/usr/lib/python3.11/subprocess.py", line 466, in check_output > return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib/python3.11/subprocess.py", line 571, in run > raise CalledProcessError(retcode, process.args, > subprocess.CalledProcessError: Command '['git', 'describe', '--dirty', '--always', '--abbrev=7', '--tags', '--exclude', 'latest']' returned non-zero exit status 128. Signed-off-by: Fabrice Delliaux <netbox253@gmail.com>
2024-04-11 13:18:21 +02:00
command: [python3, meson.source_root() + '/tools/generate_init', '-o', meson.current_build_dir() / '@OUTPUT0@'],
build_always_stale: true,
2023-09-20 14:00:42 +02:00
)
2024-03-09 23:30:30 +04:00
2023-09-20 14:00:42 +02:00
version_rc = custom_target(
'fake_version',
output: ['version.rc'],
command: [python3, meson.source_root() + '/tools/generate_rcfile', '-o', '@OUTPUT0@'],
build_always_stale: true,
2023-09-20 14:00:42 +02:00
)
2024-03-09 23:30:30 +04:00
2023-09-20 14:00:42 +02:00
icon_rc = custom_target(
'fake_icon',
output: ['icon.rc'],
command: [python3, meson.source_root() + '/tools/generate_rcfile', '-o', '@OUTPUT0@'],
2023-09-20 14:00:42 +02:00
)
2024-03-09 23:30:30 +04:00
link_args = []
2023-09-20 14:00:42 +02:00
if host_machine.system() == 'windows'
windows = import('windows')
2024-03-09 23:30:30 +04:00
2023-09-20 14:00:42 +02:00
resources = [
windows.compile_resources(version_rc),
windows.compile_resources(icon_rc),
]
2024-03-09 23:30:30 +04:00
link_args += ['-static']
2021-11-12 21:26:26 +01:00
endif
sources = [
init,
2021-11-12 21:26:26 +01:00
'src/config.c',
'src/config_map.c',
'src/game/anim.c',
2021-11-16 11:49:49 +01:00
'src/game/box.c',
'src/game/camera.c',
'src/game/carrier.c',
'src/game/clock.c',
2021-11-16 11:49:49 +01:00
'src/game/collide.c',
2023-11-04 01:47:43 +01:00
'src/game/console.c',
'src/game/console_cmd.c',
2022-05-12 22:23:22 +02:00
'src/game/creature.c',
2022-03-24 15:08:02 +01:00
'src/game/effect_routines/bubbles.c',
'src/game/effect_routines/chain_block.c',
2022-03-24 15:10:19 +01:00
'src/game/effect_routines/dino_stomp.c',
2022-03-24 15:13:47 +01:00
'src/game/effect_routines/earthquake.c',
2022-03-24 15:15:42 +01:00
'src/game/effect_routines/explosion.c',
2022-03-24 15:16:43 +01:00
'src/game/effect_routines/finish_level.c',
2022-03-24 15:17:56 +01:00
'src/game/effect_routines/flicker.c',
2022-03-24 15:19:15 +01:00
'src/game/effect_routines/flipmap.c',
2022-03-24 15:22:26 +01:00
'src/game/effect_routines/flood.c',
2022-03-24 15:27:51 +01:00
'src/game/effect_routines/lara_effects.c',
2022-03-24 15:34:36 +01:00
'src/game/effect_routines/powerup.c',
2022-03-24 15:35:55 +01:00
'src/game/effect_routines/raising_block.c',
2022-03-24 15:39:30 +01:00
'src/game/effect_routines/sand.c',
2022-03-24 15:41:32 +01:00
'src/game/effect_routines/stairs2slope.c',
2022-03-24 15:42:38 +01:00
'src/game/effect_routines/turn_180.c',
2022-05-05 11:56:29 +02:00
'src/game/effects.c',
2022-03-24 14:56:24 +01:00
'src/game/effects/blood.c',
2022-03-24 15:01:20 +01:00
'src/game/effects/exploding_death.c',
2022-03-24 15:33:00 +01:00
'src/game/effects/gun.c',
2022-03-24 15:25:49 +01:00
'src/game/effects/gunshot.c',
2021-11-20 21:40:15 +01:00
'src/game/fmv.c',
'src/game/game/game.c',
'src/game/game/game_draw.c',
2024-02-21 23:26:23 +01:00
'src/game/game/game_main_menu.c',
'src/game/game_string.c',
2021-11-16 11:49:49 +01:00
'src/game/gamebuf.c',
2021-11-12 21:26:26 +01:00
'src/game/gameflow.c',
'src/game/gun/gun.c',
'src/game/gun/gun_misc.c',
'src/game/gun/gun_pistols.c',
'src/game/gun/gun_rifle.c',
'src/game/inject.c',
2021-11-18 13:06:27 +01:00
'src/game/input.c',
2024-03-30 16:34:18 +01:00
'src/game/interpolation.c',
'src/game/inventory/inventory.c',
2022-05-14 23:14:02 +02:00
'src/game/inventory/inventory_func.c',
'src/game/inventory/inventory_ring.c',
'src/game/inventory/inventory_vars.c',
2021-11-16 11:49:49 +01:00
'src/game/items.c',
'src/game/lara/lara.c',
2022-05-13 22:03:51 +02:00
'src/game/lara/lara_cheat.c',
'src/game/lara/lara_col.c',
'src/game/lara/lara_control.c',
'src/game/lara/lara_draw.c',
2022-05-13 23:48:10 +02:00
'src/game/lara/lara_hair.c',
'src/game/lara/lara_look.c',
'src/game/lara/lara_misc.c',
'src/game/lara/lara_state.c',
2021-11-20 21:27:48 +01:00
'src/game/level.c',
2022-05-05 12:41:03 +02:00
'src/game/los.c',
2021-11-16 11:49:49 +01:00
'src/game/lot.c',
'src/game/music.c',
2022-05-14 22:56:37 +02:00
'src/game/objects/common.c',
2022-05-12 22:16:36 +02:00
'src/game/objects/creatures/ape.c',
'src/game/objects/creatures/bacon_lara.c',
'src/game/objects/creatures/baldy.c',
'src/game/objects/creatures/bat.c',
'src/game/objects/creatures/bear.c',
'src/game/objects/creatures/centaur.c',
'src/game/objects/creatures/cowboy.c',
'src/game/objects/creatures/crocodile.c',
2022-05-13 23:38:26 +02:00
'src/game/objects/creatures/cutscene_player.c',
2022-05-12 22:16:36 +02:00
'src/game/objects/creatures/larson.c',
'src/game/objects/creatures/lion.c',
'src/game/objects/creatures/mummy.c',
'src/game/objects/creatures/mutant.c',
'src/game/objects/creatures/natla.c',
'src/game/objects/creatures/pierre.c',
'src/game/objects/creatures/pod.c',
'src/game/objects/creatures/raptor.c',
'src/game/objects/creatures/rat.c',
'src/game/objects/creatures/skate_kid.c',
'src/game/objects/creatures/statue.c',
'src/game/objects/creatures/torso.c',
'src/game/objects/creatures/trex.c',
'src/game/objects/creatures/wolf.c',
'src/game/objects/effects/blood.c',
'src/game/objects/effects/body_part.c',
'src/game/objects/effects/bubble.c',
'src/game/objects/effects/earthquake.c',
'src/game/objects/effects/explosion.c',
'src/game/objects/effects/gunshot.c',
'src/game/objects/effects/missile.c',
'src/game/objects/effects/ricochet.c',
'src/game/objects/effects/splash.c',
'src/game/objects/effects/twinkle.c',
'src/game/objects/effects/waterfall.c',
2022-05-14 22:56:37 +02:00
'src/game/objects/general/boat.c',
'src/game/objects/general/bridge.c',
'src/game/objects/general/cabin.c',
'src/game/objects/general/cog.c',
'src/game/objects/general/door.c',
'src/game/objects/general/keyhole.c',
'src/game/objects/general/misc.c',
'src/game/objects/general/pickup.c',
'src/game/objects/general/puzzle_hole.c',
'src/game/objects/general/save_crystal.c',
'src/game/objects/general/scion.c',
'src/game/objects/general/switch.c',
'src/game/objects/general/trapdoor.c',
'src/game/objects/names.c',
'src/game/objects/traps/damocles_sword.c',
'src/game/objects/traps/dart.c',
'src/game/objects/traps/falling_block.c',
'src/game/objects/traps/falling_ceiling.c',
'src/game/objects/traps/flame.c',
'src/game/objects/traps/lava.c',
'src/game/objects/traps/lightning_emitter.c',
'src/game/objects/traps/midas_touch.c',
'src/game/objects/traps/movable_block.c',
'src/game/objects/traps/pendulum.c',
'src/game/objects/traps/rolling_ball.c',
'src/game/objects/traps/sliding_pillar.c',
'src/game/objects/traps/spikes.c',
'src/game/objects/traps/teeth_trap.c',
'src/game/objects/traps/thors_hammer.c',
'src/game/option/option.c',
'src/game/option/option_compass.c',
'src/game/option/option_control.c',
'src/game/option/option_control_pick.c',
'src/game/option/option_graphics.c',
'src/game/option/option_passport.c',
'src/game/option/option_sound.c',
'src/game/output.c',
2021-11-16 11:49:49 +01:00
'src/game/overlay.c',
'src/game/packer.c',
2024-02-16 14:39:01 +01:00
'src/game/phase/phase.c',
2024-02-18 00:07:04 +01:00
'src/game/phase/phase_cutscene.c',
2024-04-04 10:37:14 +02:00
'src/game/phase/phase_demo.c',
2024-02-16 14:39:01 +01:00
'src/game/phase/phase_game.c',
2024-02-21 21:39:02 +01:00
'src/game/phase/phase_inventory.c',
2024-02-16 14:57:51 +01:00
'src/game/phase/phase_pause.c',
2024-02-16 22:35:37 +01:00
'src/game/phase/phase_picture.c',
2024-02-17 16:07:37 +01:00
'src/game/phase/phase_stats.c',
'src/game/random.c',
2021-11-16 11:49:49 +01:00
'src/game/requester.c',
'src/game/room.c',
2022-05-14 18:32:14 +02:00
'src/game/room_draw.c',
'src/game/savegame/savegame.c',
'src/game/savegame/savegame_bson.c',
'src/game/savegame/savegame_legacy.c',
2021-11-19 00:12:38 +01:00
'src/game/screen.c',
2021-11-12 21:26:26 +01:00
'src/game/setup.c',
'src/game/shell.c',
2021-11-16 11:49:49 +01:00
'src/game/sound.c',
'src/game/stats.c',
2021-11-16 11:49:49 +01:00
'src/game/text.c',
'src/game/viewport.c',
2021-12-05 20:59:57 +01:00
'src/gfx/2d/2d_renderer.c',
2021-12-05 21:08:16 +01:00
'src/gfx/2d/2d_surface.c',
2021-12-06 16:24:20 +01:00
'src/gfx/3d/3d_renderer.c',
2021-12-06 15:32:43 +01:00
'src/gfx/3d/vertex_stream.c',
2021-12-05 18:35:11 +01:00
'src/gfx/blitter.c',
2021-12-05 19:51:05 +01:00
'src/gfx/context.c',
2021-12-05 18:14:55 +01:00
'src/gfx/gl/buffer.c',
'src/gfx/gl/gl_core_3_3.c',
'src/gfx/gl/program.c',
'src/gfx/gl/sampler.c',
'src/gfx/gl/texture.c',
'src/gfx/gl/utils.c',
'src/gfx/gl/vertex_array.c',
2024-06-17 21:43:43 +02:00
'src/gfx/renderers/fbo_renderer.c',
'src/gfx/renderers/legacy_renderer.c',
2021-12-05 18:14:55 +01:00
'src/gfx/screenshot.c',
'src/global/enum_str.c',
2021-11-16 11:49:49 +01:00
'src/global/vars.c',
2022-05-05 11:59:28 +02:00
'src/math/math.c',
2022-05-14 11:01:30 +02:00
'src/math/math_misc.c',
2022-05-05 11:41:58 +02:00
'src/math/matrix.c',
'src/specific/s_clock.c',
2021-11-20 21:40:15 +01:00
'src/specific/s_fmv.c',
'src/specific/s_input.c',
2021-12-01 14:19:01 +01:00
'src/specific/s_output.c',
'src/specific/s_shell.c',
2021-12-07 18:19:14 +01:00
resources,
2021-11-12 21:26:26 +01:00
]
dependencies = [
2024-04-29 19:25:40 +02:00
dep_trx,
2023-09-20 14:00:42 +02:00
dep_avcodec,
dep_avformat,
dep_avutil,
dep_mathlibrary,
2024-03-09 23:30:30 +04:00
dep_opengl,
2023-09-20 14:00:42 +02:00
dep_sdl2,
dep_swresample,
dep_swscale,
dep_zlib,
2023-09-20 14:00:42 +02:00
]
gfx_options = configuration_data()
if host_machine.system() == 'darwin'
gfx_options.set('GFX_GL_DEFAULT_BACKEND', 'GFX_GL_33C')
else
gfx_options.set('GFX_GL_DEFAULT_BACKEND', 'GFX_GL_21')
endif
configure_file(
output: 'gfx_options.h',
configuration: gfx_options)
2021-11-19 14:19:15 +01:00
executable(
2023-09-26 16:22:29 +02:00
'TR1X',
2021-11-12 21:26:26 +01:00
sources,
2024-07-23 10:26:23 +02:00
include_directories: ['src/'],
dependencies: dependencies,
2023-09-20 14:00:42 +02:00
link_args: link_args,
2021-11-19 14:19:15 +01:00
gui_app: true,
install: true,
2021-11-12 21:26:26 +01:00
)
if host_machine.system() == 'darwin'
2024-03-23 13:34:59 +01:00
install_subdir('data/ship/cfg', install_dir : 'Contents/Resources')
install_subdir('data/ship/data', install_dir : 'Contents/Resources')
install_subdir('data/ship/shaders', install_dir : 'Contents/Resources')
install_data('data/mac/icon.icns', install_dir : 'Contents/Resources')
install_data('data/mac/Info.plist', install_dir : 'Contents')
meson.add_install_script('tools/mac/bundle_dylibs')
endif