mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
321 lines
9.2 KiB
Meson
321 lines
9.2 KiB
Meson
project(
|
|
'TR1X',
|
|
'c',
|
|
default_options: [
|
|
'c_std=c11',
|
|
'warning_level=2',
|
|
],
|
|
)
|
|
|
|
trx = subproject('libtrx')
|
|
c_compiler = meson.get_compiler('c')
|
|
|
|
build_opts = [
|
|
'-Wno-unused',
|
|
'-DMESON_BUILD',
|
|
'-fno-omit-frame-pointer',
|
|
'-ffile-prefix-map=../../src/=',
|
|
]
|
|
|
|
add_project_arguments(build_opts, language: 'c')
|
|
|
|
staticdeps = get_option('staticdeps')
|
|
|
|
# Always dynamically link on macOS
|
|
if host_machine.system() == 'darwin'
|
|
staticdeps = false
|
|
endif
|
|
|
|
null_dep = dependency('', required: false)
|
|
|
|
if host_machine.system() == 'windows'
|
|
dep_opengl = c_compiler.find_library('opengl32')
|
|
else
|
|
dep_opengl = dependency('GL')
|
|
endif
|
|
|
|
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)
|
|
dep_sdl2 = dependency('SDL2', static: staticdeps)
|
|
dep_zlib = null_dep
|
|
|
|
if not staticdeps
|
|
dep_zlib = dependency('zlib', static: staticdeps)
|
|
endif
|
|
|
|
# autogenerated files
|
|
resources = []
|
|
python3 = find_program('python3', required: true)
|
|
git = find_program('git', required: true)
|
|
|
|
init = custom_target(
|
|
'fake_init',
|
|
output: ['init.c'],
|
|
command: [python3, meson.source_root() + '/tools/generate_init', '-o', meson.current_build_dir() / '@OUTPUT0@'],
|
|
build_always_stale: true,
|
|
)
|
|
|
|
version_rc = custom_target(
|
|
'fake_version',
|
|
output: ['version.rc'],
|
|
command: [python3, meson.source_root() + '/tools/generate_rcfile', '-o', '@OUTPUT0@'],
|
|
build_always_stale: true,
|
|
)
|
|
|
|
icon_rc = custom_target(
|
|
'fake_icon',
|
|
output: ['icon.rc'],
|
|
command: [python3, meson.source_root() + '/tools/generate_rcfile', '-o', '@OUTPUT0@'],
|
|
)
|
|
|
|
link_args = []
|
|
|
|
if host_machine.system() == 'windows'
|
|
windows = import('windows')
|
|
|
|
resources = [
|
|
windows.compile_resources(version_rc),
|
|
windows.compile_resources(icon_rc),
|
|
]
|
|
|
|
link_args += ['-static']
|
|
endif
|
|
|
|
sources = [
|
|
init,
|
|
'src/config.c',
|
|
'src/config_map.c',
|
|
'src/game/anim.c',
|
|
'src/game/box.c',
|
|
'src/game/camera.c',
|
|
'src/game/carrier.c',
|
|
'src/game/clock.c',
|
|
'src/game/collide.c',
|
|
'src/game/console.c',
|
|
'src/game/console_cmd.c',
|
|
'src/game/creature.c',
|
|
'src/game/effect_routines/bubbles.c',
|
|
'src/game/effect_routines/chain_block.c',
|
|
'src/game/effect_routines/dino_stomp.c',
|
|
'src/game/effect_routines/earthquake.c',
|
|
'src/game/effect_routines/explosion.c',
|
|
'src/game/effect_routines/finish_level.c',
|
|
'src/game/effect_routines/flicker.c',
|
|
'src/game/effect_routines/flipmap.c',
|
|
'src/game/effect_routines/flood.c',
|
|
'src/game/effect_routines/lara_effects.c',
|
|
'src/game/effect_routines/powerup.c',
|
|
'src/game/effect_routines/raising_block.c',
|
|
'src/game/effect_routines/sand.c',
|
|
'src/game/effect_routines/stairs2slope.c',
|
|
'src/game/effect_routines/turn_180.c',
|
|
'src/game/effects.c',
|
|
'src/game/effects/blood.c',
|
|
'src/game/effects/exploding_death.c',
|
|
'src/game/effects/gun.c',
|
|
'src/game/effects/gunshot.c',
|
|
'src/game/fmv.c',
|
|
'src/game/game/game.c',
|
|
'src/game/game/game_draw.c',
|
|
'src/game/game/game_main_menu.c',
|
|
'src/game/game_string.c',
|
|
'src/game/gamebuf.c',
|
|
'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',
|
|
'src/game/input.c',
|
|
'src/game/interpolation.c',
|
|
'src/game/inventory/inventory.c',
|
|
'src/game/inventory/inventory_func.c',
|
|
'src/game/inventory/inventory_ring.c',
|
|
'src/game/inventory/inventory_vars.c',
|
|
'src/game/items.c',
|
|
'src/game/lara/lara.c',
|
|
'src/game/lara/lara_cheat.c',
|
|
'src/game/lara/lara_col.c',
|
|
'src/game/lara/lara_control.c',
|
|
'src/game/lara/lara_draw.c',
|
|
'src/game/lara/lara_hair.c',
|
|
'src/game/lara/lara_look.c',
|
|
'src/game/lara/lara_misc.c',
|
|
'src/game/lara/lara_state.c',
|
|
'src/game/level.c',
|
|
'src/game/los.c',
|
|
'src/game/lot.c',
|
|
'src/game/music.c',
|
|
'src/game/objects/common.c',
|
|
'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',
|
|
'src/game/objects/creatures/cutscene_player.c',
|
|
'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',
|
|
'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',
|
|
'src/game/overlay.c',
|
|
'src/game/packer.c',
|
|
'src/game/phase/phase.c',
|
|
'src/game/phase/phase_cutscene.c',
|
|
'src/game/phase/phase_demo.c',
|
|
'src/game/phase/phase_game.c',
|
|
'src/game/phase/phase_inventory.c',
|
|
'src/game/phase/phase_pause.c',
|
|
'src/game/phase/phase_picture.c',
|
|
'src/game/phase/phase_stats.c',
|
|
'src/game/random.c',
|
|
'src/game/requester.c',
|
|
'src/game/room.c',
|
|
'src/game/room_draw.c',
|
|
'src/game/savegame/savegame.c',
|
|
'src/game/savegame/savegame_bson.c',
|
|
'src/game/savegame/savegame_legacy.c',
|
|
'src/game/screen.c',
|
|
'src/game/setup.c',
|
|
'src/game/shell.c',
|
|
'src/game/sound.c',
|
|
'src/game/stats.c',
|
|
'src/game/text.c',
|
|
'src/game/viewport.c',
|
|
'src/gfx/2d/2d_renderer.c',
|
|
'src/gfx/2d/2d_surface.c',
|
|
'src/gfx/3d/3d_renderer.c',
|
|
'src/gfx/3d/vertex_stream.c',
|
|
'src/gfx/blitter.c',
|
|
'src/gfx/context.c',
|
|
'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',
|
|
'src/gfx/renderers/fbo_renderer.c',
|
|
'src/gfx/renderers/legacy_renderer.c',
|
|
'src/gfx/screenshot.c',
|
|
'src/global/enum_str.c',
|
|
'src/global/vars.c',
|
|
'src/math/math.c',
|
|
'src/math/math_misc.c',
|
|
'src/math/matrix.c',
|
|
'src/specific/s_clock.c',
|
|
'src/specific/s_fmv.c',
|
|
'src/specific/s_input.c',
|
|
'src/specific/s_output.c',
|
|
'src/specific/s_shell.c',
|
|
resources,
|
|
]
|
|
|
|
dependencies = [
|
|
dep_trx,
|
|
dep_avcodec,
|
|
dep_avformat,
|
|
dep_avutil,
|
|
dep_mathlibrary,
|
|
dep_opengl,
|
|
dep_sdl2,
|
|
dep_swresample,
|
|
dep_swscale,
|
|
dep_zlib,
|
|
]
|
|
|
|
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)
|
|
|
|
executable(
|
|
'TR1X',
|
|
sources,
|
|
include_directories: ['src/'],
|
|
dependencies: dependencies,
|
|
link_args: link_args,
|
|
gui_app: true,
|
|
install: true,
|
|
)
|
|
|
|
if host_machine.system() == 'darwin'
|
|
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
|