meson.build 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. project('core', 'cpp', default_options : ['cpp_std=c++2a'])
  2. src = [
  3. 'utils/Logger.cpp',
  4. 'utils/Utility.cpp',
  5. 'utils/HashCode.cpp',
  6. 'data/BitArray.cpp',
  7. 'math/Vector.cpp',
  8. 'math/Quaternion.cpp',
  9. ]
  10. src_tests = [
  11. 'test/Main.cpp',
  12. 'test/Test.cpp',
  13. 'tests/ArrayTests.cpp',
  14. 'tests/ArrayStringTests.cpp',
  15. 'tests/UtilityTests.cpp',
  16. 'tests/ArrayListTests.cpp',
  17. 'tests/BitArrayTests.cpp',
  18. 'tests/MathTests.cpp',
  19. 'tests/ListTests.cpp',
  20. 'tests/LinkedListTests.cpp',
  21. 'tests/UniquePointerTests.cpp',
  22. 'tests/HashMapTests.cpp',
  23. 'tests/StackTests.cpp',
  24. 'tests/RingBufferTests.cpp',
  25. 'tests/ComponentsTests.cpp',
  26. 'tests/VectorTests.cpp',
  27. 'tests/QuaternionTests.cpp',
  28. ]
  29. compiler = meson.get_compiler('cpp')
  30. error_args = compiler.get_supported_arguments([
  31. '-Wcast-align=strict', '-pedantic', '-Wmissing-declarations', '-Wdate-time',
  32. '-Winit-self', '-Woverlength-strings', '-Wsign-promo', '-Wnon-virtual-dtor',
  33. '-Wconversion', '-Woverloaded-virtual', '-Wdeprecated-enum-enum-conversion',
  34. '-Wdisabled-optimization', '-Winvalid-imported-macros', '-Wduplicated-cond',
  35. '-Wdeprecated-enum-float-conversion', '-Wduplicated-branches', '-Wformat=2',
  36. '-Wmissing-braces', '-Wsuggest-override', '-Wcast-qual', '-Wbidi-chars=any',
  37. '-Wzero-as-null-pointer-constant', '-pedantic-errors', '-Wnull-dereference',
  38. '-Wformat-signedness', '-Wfloat-equal', '-Wvolatile', '-Wctor-dtor-privacy',
  39. '-Winfinite-recursion', '-Wshift-overflow=2', '-Wmultichar', '-Walloc-zero',
  40. '-Wcomma-subscript', '-Wold-style-cast', '-Wwrite-strings', '-Wswitch-enum',
  41. '-Wredundant-decls', '-Werror', '-Wsign-conversion', '-Walloca', '-Wshadow',
  42. '-Winvalid-pch', '-Wdeprecated-copy-dtor', '-Wundef', '-Wdouble-promotion',
  43. '-Warith-conversion', '-Wextra', '-Wtrivial-auto-var-init', '-Wlogical-op',
  44. '-Wall', '-Wenum-conversion'
  45. ])
  46. compile_args = compiler.get_supported_arguments([
  47. '-nostdinc++', '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics'
  48. ])
  49. link_args = compiler.get_supported_arguments([
  50. '-nodefaultlibs', '-lc', '-lm'
  51. ])
  52. core_include = [include_directories('.')]
  53. core = static_library('core',
  54. sources: src,
  55. include_directories: core_include,
  56. cpp_args: error_args + compile_args,
  57. link_args: link_args)
  58. core_dep = declare_dependency(
  59. include_directories: core_include,
  60. link_with: core)
  61. executable('tests',
  62. sources: src_tests,
  63. dependencies: core_dep,
  64. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  65. link_args: link_args)