meson.build 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. project('gamingcore', 'cpp', default_options : ['default_library=static', 'cpp_std=c++17'])
  2. src = [
  3. 'io/ImageReader.cpp',
  4. 'math/Math.cpp',
  5. 'math/Box.cpp',
  6. 'math/Frustum.cpp',
  7. 'math/View.cpp',
  8. 'math/Matrix.cpp',
  9. 'math/Plane.cpp',
  10. 'math/Quaternion.cpp',
  11. 'math/Vector.cpp',
  12. 'network/Client.cpp',
  13. 'network/ENet.cpp',
  14. 'network/Packet.cpp',
  15. 'network/Server.cpp',
  16. 'rendering/Shader.cpp',
  17. 'rendering/Texture.cpp',
  18. 'rendering/VertexBuffer.cpp',
  19. 'rendering/Window.cpp',
  20. 'rendering/GL.cpp',
  21. 'data/BitArray.cpp',
  22. 'utils/Buffer.cpp',
  23. 'utils/Clock.cpp',
  24. 'utils/Error.cpp',
  25. 'utils/Logger.cpp',
  26. 'utils/Random.cpp',
  27. ]
  28. src_tests = [
  29. 'Main.cpp',
  30. 'tests/ArrayListTests.cpp',
  31. 'tests/ArrayTests.cpp',
  32. 'tests/BitArrayTests.cpp',
  33. 'tests/BufferTests.cpp',
  34. 'tests/BufferedValueTests.cpp',
  35. 'tests/BoxTests.cpp',
  36. 'tests/ClockTests.cpp',
  37. 'tests/ColorTests.cpp',
  38. 'tests/FrustumTests.cpp',
  39. 'tests/HashMapTests.cpp',
  40. 'tests/ListTests.cpp',
  41. 'tests/MatrixStackTests.cpp',
  42. 'tests/MatrixTests.cpp',
  43. 'tests/NetworkTests.cpp',
  44. 'tests/ImageReaderTests.cpp',
  45. 'tests/PlaneTests.cpp',
  46. 'tests/QuaternionTests.cpp',
  47. 'tests/RandomTests.cpp',
  48. 'tests/RingBufferTests.cpp',
  49. 'tests/SplitStringTests.cpp',
  50. 'tests/StackTests.cpp',
  51. 'tests/StringBufferTests.cpp',
  52. 'tests/Test.cpp',
  53. 'tests/TypedBufferTests.cpp',
  54. 'tests/UniquePointerTests.cpp',
  55. 'tests/MathTests.cpp',
  56. 'tests/VectorTests.cpp',
  57. 'tests/ViewTests.cpp',
  58. 'tests/ComponentsTests.cpp',
  59. ]
  60. compiler = meson.get_compiler('cpp')
  61. args = compiler.get_supported_arguments([
  62. '-Wcast-align=strict', '-pedantic', '-Wmissing-declarations', '-Wdate-time',
  63. '-Winit-self', '-Woverlength-strings', '-Wsign-promo', '-Wnon-virtual-dtor',
  64. '-Wconversion', '-Woverloaded-virtual', '-Wdeprecated-enum-enum-conversion',
  65. '-Wdisabled-optimization', '-Winvalid-imported-macros', '-Wduplicated-cond',
  66. '-Wdeprecated-enum-float-conversion', '-Wduplicated-branches', '-Wformat=2',
  67. '-Wmissing-braces', '-Wsuggest-override', '-Wcast-qual', '-Wbidi-chars=any',
  68. '-Wzero-as-null-pointer-constant', '-pedantic-errors', '-Wnull-dereference',
  69. '-Wformat-signedness', '-Wfloat-equal', '-Wvolatile', '-Wctor-dtor-privacy',
  70. '-Winfinite-recursion', '-Wshift-overflow=2', '-Wmultichar', '-Walloc-zero',
  71. '-Wcomma-subscript', '-Wold-style-cast', '-Wwrite-strings', '-Wswitch-enum',
  72. '-Wredundant-decls', '-Werror', '-Wsign-conversion', '-Walloca', '-Wshadow',
  73. '-Winvalid-pch', '-Wdeprecated-copy-dtor', '-Wundef', '-Wdouble-promotion',
  74. '-Warith-conversion', '-Wextra', '-Wtrivial-auto-var-init', '-Wlogical-op',
  75. '-Wall', '-Wenum-conversion',
  76. ])
  77. cmake = import('cmake')
  78. glfw_proj = cmake.subproject('glfw')
  79. glfw_includes = glfw_proj.include_directories('glfw')
  80. glfw_dep = glfw_proj.dependency('glfw')
  81. glew_proj = subproject('glew', default_options: 'default_library=static')
  82. glew_includes = glew_proj.get_variable('glew_include')
  83. glew_dep = glew_proj.get_variable('glew_dep')
  84. thread_dep = dependency('threads', static: true)
  85. gl_dep = dependency('GL')
  86. ws2_32_dep = compiler.find_library('ws2_32', required: false)
  87. winmm_dep = compiler.find_library('winmm', required: false)
  88. glu_dep = compiler.find_library('glu32', required: false)
  89. dl_dep = compiler.find_library('dl', required: false)
  90. gamingcore_include = [include_directories('.'), glfw_includes, glew_includes]
  91. lodepng = static_library('lodepng', sources: 'libs/lodepng/lodepng.cpp')
  92. lodepng_dep = declare_dependency(link_with: lodepng)
  93. gamingcore = static_library('gamingcore',
  94. sources: src,
  95. include_directories: gamingcore_include,
  96. dependencies: [thread_dep, glfw_dep, glew_dep, gl_dep, ws2_32_dep, winmm_dep, glu_dep, dl_dep, glu_dep, lodepng_dep],
  97. cpp_args: args)
  98. gamingcore_dep = declare_dependency(
  99. include_directories: gamingcore_include,
  100. link_with: gamingcore)
  101. executable('tests',
  102. sources: src_tests,
  103. dependencies: gamingcore_dep,
  104. cpp_args: args + ['-DLOG_LEVEL=4'])