meson.build 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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/ProbingHashMapTests.cpp',
  35. 'tests/StackTests.cpp',
  36. 'tests/RingBufferTests.cpp',
  37. 'tests/ComponentsTests.cpp',
  38. 'tests/VectorTests.cpp',
  39. 'tests/QuaternionTests.cpp',
  40. 'tests/MatrixTests.cpp',
  41. 'tests/BoxTests.cpp',
  42. 'tests/BufferedValueTests.cpp',
  43. 'tests/PlaneTests.cpp',
  44. 'tests/FrustumTests.cpp',
  45. 'tests/ViewTests.cpp',
  46. 'tests/MatrixStackTests.cpp',
  47. 'tests/ColorTests.cpp',
  48. 'tests/BufferTests.cpp',
  49. 'tests/ClockTests.cpp',
  50. 'tests/RandomTests.cpp',
  51. 'tests/ThreadTests.cpp',
  52. 'tests/FileTests.cpp',
  53. ]
  54. src_performance = [
  55. 'performance/Main.cpp',
  56. 'test/Test.cpp',
  57. ]
  58. compiler = meson.get_compiler('cpp')
  59. error_args = compiler.get_supported_arguments([
  60. '-Wdeprecated-enum-float-conversion', '-Wctad-maybe-unsupported', '-Werror',
  61. '-Wdeprecated-enum-enum-conversion', '-Winvalid-imported-macros', '-Wextra',
  62. '-Wzero-as-null-pointer-constant', '-Wframe-larger-than=8388608', '-Wundef',
  63. '-Wunused-const-variable=2', '-Wconditionally-supported', '-Wwrite-strings',
  64. '-Wlarger-than=1073741824', '-Wimplicit-fallthrough=5', '-Wduplicated-cond',
  65. '-Wdisabled-optimization', '-Wsuggest-final-methods', '-Wformat-signedness',
  66. '-Wtrivial-auto-var-init', '-Wmissing-include-dirs', '-Winfinite-recursion',
  67. '-Wdeprecated-copy-dtor', '-Wanalyzer-too-complex', '-Wduplicated-branches',
  68. '-Wstrict-null-sentinel', '-Wmissing-declarations', '-Wformat-truncation=2',
  69. '-Wmultiple-inheritance', '-Wstack-usage=8388608', '-Winit-self', '-Wsynth',
  70. '-Wvirtual-inheritance', '-Wstringop-overflow=4', '-Wcast-qual', '-Wshadow',
  71. '-Wsuggest-final-types', '-Woverloaded-virtual', '-Wconversion', '-Walloca',
  72. '-Woverlength-strings', '-Wctor-dtor-privacy', '-Wswitch-enum', '-pedantic',
  73. '-Wstrict-overflow=2', '-Wcast-align=strict', '-Wfloat-equal', '-Wformat=2',
  74. '-Wattribute-alias=2', '-Wformat-overflow=2', '-Winvalid-pch', '-Wvolatile',
  75. '-Wshift-overflow=2', '-Warith-conversion', '-Wcatch-value=3', '-Wnoexcept',
  76. '-Wuse-after-free=3', '-Wdouble-promotion', '-Wunused-macros', '-Wregister',
  77. '-Wsuggest-override', '-Wnull-dereference', '-Wtrampolines', '-Wlogical-op',
  78. '-Wnon-virtual-dtor', '-pedantic-errors', '-Wbidi-chars=any', '-Wdate-time',
  79. '-Warray-parameter', '-Waligned-new=all', '-Wold-style-cast', '-Wmultichar',
  80. '-Wstack-protector', '-Wmissing-braces', '-Warray-bounds=2', '-Walloc-zero',
  81. '-Wplacement-new=2', '-Wmismatched-tags', '-Wcomma-subscript', '-Wall',
  82. '-Wbidi-chars', '-Wredundant-tags', '-Wenum-conversion', '-Wall',
  83. '-Wredundant-decls', '-Wsign-conversion'
  84. ])
  85. compile_args = compiler.get_supported_arguments([
  86. '-nostdinc++', '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics'
  87. ])
  88. link_args = compiler.get_supported_arguments([
  89. '-nodefaultlibs', '-lc', '-lm', '-lpthread'
  90. ])
  91. core_include = [include_directories('.')]
  92. core = static_library('core',
  93. sources: src,
  94. include_directories: core_include,
  95. cpp_args: error_args + compile_args,
  96. link_args: link_args)
  97. core_dep = declare_dependency(
  98. include_directories: core_include,
  99. link_with: core)
  100. executable('tests',
  101. sources: src_tests,
  102. dependencies: core_dep,
  103. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  104. link_args: link_args)
  105. executable('performance',
  106. sources: src_performance,
  107. dependencies: core_dep,
  108. cpp_args: error_args + compile_args + ['-DCORE_LOG_LEVEL=4'],
  109. link_args: link_args)