meson.build 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. project('core', 'cpp', default_options : ['cpp_std=c++2a'])
  2. src = [
  3. 'utils/Logger.cpp',
  4. 'utils/Utility.cpp',
  5. 'utils/Buffer.cpp',
  6. 'utils/Clock.cpp',
  7. 'utils/Random.cpp',
  8. 'data/BitArray.cpp',
  9. 'math/Math.cpp',
  10. 'math/Vector.cpp',
  11. 'math/Quaternion.cpp',
  12. 'math/Matrix.cpp',
  13. 'math/Box.cpp',
  14. 'math/Plane.cpp',
  15. 'math/Frustum.cpp',
  16. 'math/View.cpp',
  17. 'thread/Thread.cpp',
  18. 'io/File.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/ProbingHashMapTests.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. src_performance = [
  54. 'performance/Main.cpp',
  55. 'test/Test.cpp',
  56. ]
  57. compiler = meson.get_compiler('cpp')
  58. error_args = compiler.get_supported_arguments([
  59. '-Wdeprecated-enum-float-conversion', '-Wctad-maybe-unsupported', '-Werror',
  60. '-Wdeprecated-enum-enum-conversion', '-Winvalid-imported-macros', '-Wextra',
  61. '-Wzero-as-null-pointer-constant', '-Wframe-larger-than=8388608', '-Wundef',
  62. '-Wunused-const-variable=2', '-Wconditionally-supported', '-Wwrite-strings',
  63. '-Wlarger-than=1073741824', '-Wimplicit-fallthrough=5', '-Wduplicated-cond',
  64. '-Wdisabled-optimization', '-Wsuggest-final-methods', '-Wformat-signedness',
  65. '-Wtrivial-auto-var-init', '-Wmissing-include-dirs', '-Winfinite-recursion',
  66. '-Wdeprecated-copy-dtor', '-Wanalyzer-too-complex', '-Wduplicated-branches',
  67. '-Wstrict-null-sentinel', '-Wmissing-declarations', '-Wformat-truncation=2',
  68. '-Wmultiple-inheritance', '-Wstack-usage=8388608', '-Winit-self', '-Wsynth',
  69. '-Wvirtual-inheritance', '-Wstringop-overflow=4', '-Wcast-qual', '-Wshadow',
  70. '-Wsuggest-final-types', '-Woverloaded-virtual', '-Wconversion', '-Walloca',
  71. '-Woverlength-strings', '-Wctor-dtor-privacy', '-Wswitch-enum', '-pedantic',
  72. '-Wstrict-overflow=2', '-Wcast-align=strict', '-Wfloat-equal', '-Wformat=2',
  73. '-Wattribute-alias=2', '-Wformat-overflow=2', '-Winvalid-pch', '-Wvolatile',
  74. '-Wshift-overflow=2', '-Warith-conversion', '-Wcatch-value=3', '-Wnoexcept',
  75. '-Wuse-after-free=3', '-Wdouble-promotion', '-Wunused-macros', '-Wregister',
  76. '-Wsuggest-override', '-Wnull-dereference', '-Wtrampolines', '-Wlogical-op',
  77. '-Wnon-virtual-dtor', '-pedantic-errors', '-Wbidi-chars=any', '-Wdate-time',
  78. '-Warray-parameter', '-Waligned-new=all', '-Wold-style-cast', '-Wmultichar',
  79. '-Wstack-protector', '-Wmissing-braces', '-Warray-bounds=2', '-Walloc-zero',
  80. '-Wplacement-new=2', '-Wmismatched-tags', '-Wcomma-subscript', '-Wall',
  81. '-Wbidi-chars', '-Wredundant-tags', '-Wenum-conversion', '-Wall',
  82. '-Wredundant-decls', '-Wsign-conversion'
  83. ])
  84. compile_args = compiler.get_supported_arguments([
  85. '-nostdinc++', '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics'
  86. ])
  87. link_args = compiler.get_supported_arguments([
  88. '-nodefaultlibs', '-lc', '-lm', '-lpthread'
  89. ])
  90. core_include = [include_directories('.')]
  91. core = static_library('core',
  92. sources: src,
  93. include_directories: core_include,
  94. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  95. link_args: link_args)
  96. core_dep = declare_dependency(
  97. include_directories: core_include,
  98. link_with: core)
  99. executable('tests',
  100. sources: src_tests,
  101. dependencies: core_dep,
  102. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  103. link_args: link_args)
  104. executable('performance',
  105. sources: src_performance,
  106. dependencies: core_dep,
  107. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  108. link_args: link_args)