meson.build 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. '-Wdeprecated-enum-float-conversion', '-Wctad-maybe-unsupported', '-Werror',
  56. '-Wdeprecated-enum-enum-conversion', '-Winvalid-imported-macros', '-Wextra',
  57. '-Wzero-as-null-pointer-constant', '-Wframe-larger-than=8388608', '-Wundef',
  58. '-Wsuggest-attribute=const', '-Wunused-const-variable=2', '-Wwrite-strings',
  59. '-Wconditionally-supported', '-Wimplicit-fallthrough=5', '-pedantic-errors',
  60. '-Wlarger-than=1073741824', '-Wtrivial-auto-var-init', '-Wdouble-promotion',
  61. '-Wsuggest-final-methods', '-Wdisabled-optimization', '-Wformat-signedness',
  62. '-Wmissing-declarations', '-Wdeprecated-copy-dtor', '-Wduplicated-branches',
  63. '-Wmultiple-inheritance', '-Wstrict-null-sentinel', '-Wformat-truncation=2',
  64. '-Wanalyzer-too-complex', '-Wmissing-include-dirs', '-Wstack-usage=8388608',
  65. '-Wstringop-overflow=4', '-Wsuggest-final-types', '-Wconversion', '-Wsynth',
  66. '-Wvirtual-inheritance', '-Woverlength-strings', '-Wlogical-op', '-Wshadow',
  67. '-Woverloaded-virtual', '-Winfinite-recursion', '-Wswitch-enum', '-Walloca',
  68. '-Wattribute-alias=2', '-Wformat-overflow=2', '-Wfloat-equal', '-Wformat=2',
  69. '-Wctor-dtor-privacy', '-Wstrict-overflow=5', '-Winvalid-pch', '-Wvolatile',
  70. '-Wcast-align=strict', '-Wshift-overflow=2', '-Wcatch-value=3', '-pedantic',
  71. '-Wsuggest-override', '-Wuse-after-free=3', '-Wunused-macros', '-Wnoexcept',
  72. '-Wnon-virtual-dtor', '-Wnull-dereference', '-Wtrampolines', '-Walloc-zero',
  73. '-Warith-conversion', '-Wsign-conversion', '-Wbidi-chars=any', '-Wregister',
  74. '-Wcomma-subscript', '-Warray-parameter', '-Wold-style-cast', '-Winit-self',
  75. '-Wplacement-new=2', '-Wstack-protector', '-Wmissing-braces', '-Wcast-qual',
  76. '-Wenum-conversion', '-Waligned-new=all', '-Warray-bounds=2', '-Wdate-time',
  77. '-Wredundant-decls', '-Wmismatched-tags', '-Wredundant-tags', '-Wmultichar',
  78. '-Wall', '-Wbidi-chars', '-Wsign-promo', '-Wduplicated-cond'
  79. ])
  80. compile_args = compiler.get_supported_arguments([
  81. '-nostdinc++', '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics'
  82. ])
  83. link_args = compiler.get_supported_arguments([
  84. '-nodefaultlibs', '-lc', '-lm', '-lpthread'
  85. ])
  86. core_include = [include_directories('.')]
  87. core = static_library('core',
  88. sources: src,
  89. include_directories: core_include,
  90. cpp_args: error_args + compile_args,
  91. link_args: link_args)
  92. core_dep = declare_dependency(
  93. include_directories: core_include,
  94. link_with: core)
  95. executable('tests',
  96. sources: src_tests,
  97. dependencies: core_dep,
  98. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  99. link_args: link_args)