meson.build 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. project('gamingcore', 'cpp', default_options : ['default_library=static'])
  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. 'libs/lodepng/lodepng.cpp',
  28. ]
  29. src_tests = [
  30. 'Main.cpp',
  31. 'tests/ArrayListTests.cpp',
  32. 'tests/ArrayTests.cpp',
  33. 'tests/BitArrayTests.cpp',
  34. 'tests/BufferTests.cpp',
  35. 'tests/BufferedValueTests.cpp',
  36. 'tests/BoxTests.cpp',
  37. 'tests/ClockTests.cpp',
  38. 'tests/ColorTests.cpp',
  39. 'tests/FrustumTests.cpp',
  40. 'tests/HashMapTests.cpp',
  41. 'tests/ListTests.cpp',
  42. 'tests/MatrixStackTests.cpp',
  43. 'tests/MatrixTests.cpp',
  44. 'tests/NetworkTests.cpp',
  45. 'tests/ImageReaderTests.cpp',
  46. 'tests/PlaneTests.cpp',
  47. 'tests/QuaternionTests.cpp',
  48. 'tests/RandomTests.cpp',
  49. 'tests/RingBufferTests.cpp',
  50. 'tests/SplitStringTests.cpp',
  51. 'tests/StackTests.cpp',
  52. 'tests/StringBufferTests.cpp',
  53. 'tests/Test.cpp',
  54. 'tests/TypedBufferTests.cpp',
  55. 'tests/UniquePointerTests.cpp',
  56. 'tests/MathTests.cpp',
  57. 'tests/VectorTests.cpp',
  58. 'tests/ViewTests.cpp',
  59. 'tests/ComponentsTests.cpp',
  60. ]
  61. compiler = meson.get_compiler('cpp')
  62. args = compiler.get_supported_arguments(['-Wall', '-Wextra', '-pedantic', '-Werror'])
  63. cmake = import('cmake')
  64. glfw_proj = cmake.subproject('glfw')
  65. glfw_includes = glfw_proj.include_directories('glfw')
  66. glfw_dep = glfw_proj.dependency('glfw')
  67. glew_proj = subproject('glew', default_options: 'default_library=static')
  68. glew_includes = glew_proj.get_variable('glew_include')
  69. glew_dep = glew_proj.get_variable('glew_dep')
  70. thread_dep = dependency('threads', static: true)
  71. gl_dep = dependency('GL')
  72. ws2_32_dep = compiler.find_library('ws2_32', required: false)
  73. winmm_dep = compiler.find_library('winmm', required: false)
  74. glu_dep = compiler.find_library('glu32', required: false)
  75. dl_dep = compiler.find_library('dl', required: false)
  76. gamingcore_include = [include_directories('.'), glfw_includes, glew_includes]
  77. gamingcore = static_library('gamingcore',
  78. sources: src,
  79. include_directories : gamingcore_include,
  80. dependencies : [thread_dep, glfw_dep, glew_dep, gl_dep, ws2_32_dep, winmm_dep, glu_dep, dl_dep, glu_dep],
  81. cpp_args: args)
  82. gamingcore_dep = declare_dependency(
  83. include_directories : gamingcore_include,
  84. link_with: gamingcore)
  85. executable('tests',
  86. sources: src_tests,
  87. dependencies : gamingcore_dep,
  88. cpp_args: args + ['-DLOG_LEVEL=4'])