meson.build 3.2 KB

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