meson.build 3.1 KB

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