meson.build 2.7 KB

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