meson.build 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. project('core', 'cpp', default_options : ['cpp_std=c++2a'])
  2. src = [
  3. 'utils/Logger.cpp',
  4. 'utils/Utility.cpp',
  5. 'utils/Error.cpp',
  6. 'utils/New.cpp',
  7. 'utils/Buffer.cpp',
  8. 'utils/Clock.cpp',
  9. 'utils/Random.cpp',
  10. 'data/BitArray.cpp',
  11. 'math/Math.cpp',
  12. 'math/Vector.cpp',
  13. 'math/Quaternion.cpp',
  14. 'math/Matrix.cpp',
  15. 'math/Box.cpp',
  16. 'math/Plane.cpp',
  17. 'math/Frustum.cpp',
  18. 'math/View.cpp',
  19. 'thread/Thread.cpp',
  20. 'io/FileReader.cpp',
  21. ]
  22. src_tests = [
  23. 'test/Main.cpp',
  24. 'test/Test.cpp',
  25. 'tests/ArrayTests.cpp',
  26. 'tests/ArrayStringTests.cpp',
  27. 'tests/UtilityTests.cpp',
  28. 'tests/ArrayListTests.cpp',
  29. 'tests/BitArrayTests.cpp',
  30. 'tests/MathTests.cpp',
  31. 'tests/ListTests.cpp',
  32. 'tests/LinkedListTests.cpp',
  33. 'tests/UniquePointerTests.cpp',
  34. 'tests/HashMapTests.cpp',
  35. 'tests/ProbingHashMapTests.cpp',
  36. 'tests/StackTests.cpp',
  37. 'tests/RingBufferTests.cpp',
  38. 'tests/ComponentsTests.cpp',
  39. 'tests/VectorTests.cpp',
  40. 'tests/QuaternionTests.cpp',
  41. 'tests/MatrixTests.cpp',
  42. 'tests/BoxTests.cpp',
  43. 'tests/BufferedValueTests.cpp',
  44. 'tests/PlaneTests.cpp',
  45. 'tests/FrustumTests.cpp',
  46. 'tests/ViewTests.cpp',
  47. 'tests/MatrixStackTests.cpp',
  48. 'tests/ColorTests.cpp',
  49. 'tests/BufferTests.cpp',
  50. 'tests/ClockTests.cpp',
  51. 'tests/RandomTests.cpp',
  52. 'tests/ThreadTests.cpp',
  53. 'tests/FileReaderTests.cpp',
  54. ]
  55. src_performance = [
  56. 'performance/Main.cpp',
  57. 'test/Test.cpp',
  58. ]
  59. compiler = meson.get_compiler('cpp')
  60. error_args = compiler.get_supported_arguments([
  61. '-Wdeprecated-enum-float-conversion', '-Wctad-maybe-unsupported', '-Werror',
  62. '-Wdeprecated-enum-enum-conversion', '-Winvalid-imported-macros', '-Wextra',
  63. '-Wzero-as-null-pointer-constant', '-Wframe-larger-than=8388608', '-Wundef',
  64. '-Wunused-const-variable=2', '-Wconditionally-supported', '-Wwrite-strings',
  65. '-Wlarger-than=1073741824', '-Wimplicit-fallthrough=5', '-Wduplicated-cond',
  66. '-Wdisabled-optimization', '-Wsuggest-final-methods', '-Wformat-signedness',
  67. '-Wtrivial-auto-var-init', '-Wmissing-include-dirs', '-Winfinite-recursion',
  68. '-Wdeprecated-copy-dtor', '-Wanalyzer-too-complex', '-Wduplicated-branches',
  69. '-Wstrict-null-sentinel', '-Wmissing-declarations', '-Wformat-truncation=2',
  70. '-Wmultiple-inheritance', '-Wstack-usage=8388608', '-Winit-self', '-Wsynth',
  71. '-Wvirtual-inheritance', '-Wstringop-overflow=4', '-Wcast-qual', '-Wshadow',
  72. '-Wsuggest-final-types', '-Woverloaded-virtual', '-Wconversion', '-Walloca',
  73. '-Woverlength-strings', '-Wctor-dtor-privacy', '-Wswitch-enum', '-pedantic',
  74. '-Wstrict-overflow=2', '-Wcast-align=strict', '-Wfloat-equal', '-Wformat=2',
  75. '-Wattribute-alias=2', '-Wformat-overflow=2', '-Winvalid-pch', '-Wvolatile',
  76. '-Wshift-overflow=2', '-Warith-conversion', '-Wcatch-value=3', '-Wnoexcept',
  77. '-Wuse-after-free=3', '-Wdouble-promotion', '-Wunused-macros', '-Wregister',
  78. '-Wsuggest-override', '-Wnull-dereference', '-Wtrampolines', '-Wlogical-op',
  79. '-Wnon-virtual-dtor', '-pedantic-errors', '-Wbidi-chars=any', '-Wdate-time',
  80. '-Warray-parameter', '-Waligned-new=all', '-Wold-style-cast', '-Wmultichar',
  81. '-Wstack-protector', '-Wmissing-braces', '-Warray-bounds=2', '-Walloc-zero',
  82. '-Wplacement-new=2', '-Wmismatched-tags', '-Wcomma-subscript', '-Wall',
  83. '-Wbidi-chars', '-Wredundant-tags', '-Wenum-conversion', '-Wall',
  84. '-Wredundant-decls', '-Wsign-conversion'
  85. ])
  86. compile_args = compiler.get_supported_arguments([
  87. '-nostdinc++', '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics'
  88. ])
  89. link_args = compiler.get_supported_arguments([
  90. '-nodefaultlibs', '-lc', '-lm', '-lpthread'
  91. ])
  92. core_include = [include_directories('.')]
  93. core = static_library('core',
  94. sources: src,
  95. include_directories: core_include,
  96. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  97. link_args: link_args)
  98. core_dep = declare_dependency(
  99. include_directories: core_include,
  100. link_with: core)
  101. executable('tests',
  102. sources: src_tests,
  103. dependencies: core_dep,
  104. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  105. link_args: link_args)
  106. executable('performance',
  107. sources: src_performance,
  108. dependencies: core_dep,
  109. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  110. link_args: link_args)