meson.build 3.1 KB

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