meson.build 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. fs = import('fs')
  2. include_dir = include_directories('include')
  3. # Input files
  4. sources = [
  5. 'src/main.c',
  6. 'src/ace.c',
  7. 'src/pe.c',
  8. 'src/game.c',
  9. 'src/utils.c',
  10. 'src/msg.c',
  11. 'src/tlzma.c',
  12. 'src/hi3/hi3.c',
  13. 'src/hsr/hsr.c'
  14. ]
  15. if fs.exists('src/core.c')
  16. # Compile the real file first (dirty hack)
  17. core_fake_exe = executable(
  18. 'core.o',
  19. 'src/core.c',
  20. link_args: [ '-r' ], # Output an object file
  21. include_directories: include_dir
  22. )
  23. # another dirty hack
  24. copy_core = find_program('copy_core.sh')
  25. core_target = [custom_target(
  26. 'copy_core',
  27. output: 'core.o',
  28. input: core_fake_exe.extract_all_objects(recursive: false),
  29. command: [
  30. copy_core,
  31. '@INPUT0@',
  32. '@OUTPUT0@', meson.current_source_dir() / 'blob/core.o'
  33. ]
  34. )]
  35. core_blob = []
  36. else
  37. message('Using precompiled core blob. Refer to the readme for more details')
  38. core_target = []
  39. core_blob = [ 'blob/core.o' ]
  40. endif
  41. lzma_include_dir = include_directories('lzma_sdk')
  42. lzma_sources = [
  43. 'lzma_sdk/LzmaDec.c'
  44. ]
  45. conf_data = configuration_data()
  46. conf_data.set('version', meson.project_version())
  47. conf = configure_file(input: 'include/config.h.in', output: 'config.h', configuration: conf_data)
  48. shared_library(
  49. 'game_payload',
  50. sources,
  51. core_target,
  52. lzma_sources,
  53. conf,
  54. objects: core_blob,
  55. include_directories: [ include_dir, lzma_include_dir ],
  56. name_prefix: ''
  57. )