jadeite/game_payload/meson.build

81 lines
1.8 KiB
Meson
Raw Normal View History

fs = import('fs')
include_dir = include_directories('include')
2023-06-05 21:23:08 +00:00
# Input files
sources = [
'src/main.c',
'src/ntdll.c',
'src/ace.c',
'src/pe.c',
'src/game.c',
'src/hi3.c',
2023-06-08 15:36:22 +00:00
'src/hsr.c',
2023-06-05 21:23:08 +00:00
'src/utils.c',
'src/msg.c'
2023-06-05 21:23:08 +00:00
]
resources = [
'res/hi3/glb/allocations.dat',
2023-06-08 16:38:36 +00:00
'res/hi3/glb/entries.dat',
'res/hsr/os/allocations.dat',
'res/hsr/os/entries.dat',
'res/hsr/cn/allocations.dat',
'res/hsr/cn/entries.dat'
2023-06-05 21:23:08 +00:00
]
# Generate resource files for ./res
res_header = custom_target(
'resources.h',
output: 'resources.h',
2023-06-05 21:23:08 +00:00
input: resources,
command: [ gen_res, '--header', meson.current_source_dir(), '@OUTPUT0@', '@INPUT@' ]
2023-06-05 21:23:08 +00:00
)
res_object = custom_target(
'resources.o',
output: 'resources.o',
input: resources,
command: [ gen_res, '--object', meson.current_source_dir(), '@OUTPUT0@', '@INPUT@' ]
)
2023-07-27 22:51:04 +00:00
if fs.exists('src/core.c')
# Compile the real file first (dirty hack)
2023-07-27 22:51:04 +00:00
core_fake_exe = executable(
'core.o',
'src/core.c',
res_header,
link_args: [ '-r' ], # Output an object file
include_directories: include_dir
)
# another dirty hack
2023-07-27 22:51:04 +00:00
copy_core = find_program('copy_core.sh')
2023-07-27 22:51:04 +00:00
core_target = [custom_target(
'copy_core',
output: 'core.o',
input: core_fake_exe.extract_all_objects(recursive: false),
command: [
2023-07-27 22:51:04 +00:00
copy_core,
'@INPUT0@',
2023-07-27 22:51:04 +00:00
'@OUTPUT0@', meson.current_source_dir() / 'blob/core.o'
]
)]
2023-07-27 22:51:04 +00:00
core_blob = []
else
2023-07-27 22:51:04 +00:00
message('Using precompiled core blob. Refer to the readme for more details')
core_target = []
core_blob = [ 'blob/core.o' ]
endif
2023-06-05 21:23:08 +00:00
shared_library(
'game_payload',
sources,
res_header,
res_object,
2023-07-27 22:51:04 +00:00
core_target,
objects: core_blob,
include_directories: include_dir,
2023-06-05 21:23:08 +00:00
name_prefix: ''
)