2023-07-05 20:59:27 +00:00
|
|
|
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',
|
2023-08-04 19:17:31 +00:00
|
|
|
'src/msg.c',
|
|
|
|
'src/tx.c'
|
2023-06-05 21:23:08 +00:00
|
|
|
]
|
2023-07-05 20:59:27 +00:00
|
|
|
|
2023-07-27 22:51:04 +00:00
|
|
|
if fs.exists('src/core.c')
|
2023-07-05 20:59:27 +00:00
|
|
|
# Compile the real file first (dirty hack)
|
2023-07-27 22:51:04 +00:00
|
|
|
core_fake_exe = executable(
|
|
|
|
'core.o',
|
|
|
|
'src/core.c',
|
2023-07-05 20:59:27 +00:00
|
|
|
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-05 20:59:27 +00:00
|
|
|
|
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),
|
2023-07-05 20:59:27 +00:00
|
|
|
command: [
|
2023-07-27 22:51:04 +00:00
|
|
|
copy_core,
|
2023-07-05 20:59:27 +00:00
|
|
|
'@INPUT0@',
|
2023-07-27 22:51:04 +00:00
|
|
|
'@OUTPUT0@', meson.current_source_dir() / 'blob/core.o'
|
2023-07-05 20:59:27 +00:00
|
|
|
]
|
2023-07-08 18:17:28 +00:00
|
|
|
)]
|
2023-07-27 22:51:04 +00:00
|
|
|
core_blob = []
|
2023-07-05 20:59:27 +00:00
|
|
|
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' ]
|
2023-07-05 20:59:27 +00:00
|
|
|
endif
|
2023-06-05 21:23:08 +00:00
|
|
|
|
2023-08-04 19:17:31 +00:00
|
|
|
conf_data = configuration_data()
|
|
|
|
conf_data.set('version', meson.project_version())
|
|
|
|
|
|
|
|
conf = configure_file(input: 'include/config.h.in', output: 'config.h', configuration: conf_data)
|
|
|
|
|
2023-06-05 21:23:08 +00:00
|
|
|
shared_library(
|
|
|
|
'game_payload',
|
|
|
|
sources,
|
2023-07-27 22:51:04 +00:00
|
|
|
core_target,
|
2023-08-04 19:17:31 +00:00
|
|
|
conf,
|
2023-07-27 22:51:04 +00:00
|
|
|
objects: core_blob,
|
2023-07-05 20:59:27 +00:00
|
|
|
include_directories: include_dir,
|
2023-06-05 21:23:08 +00:00
|
|
|
name_prefix: ''
|
|
|
|
)
|