meson.build 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. project('gamingcore', 'cpp', default_options : ['default_library=static'])
  2. src = [
  3. 'io/ImageReader.cpp',
  4. 'math/Math.cpp',
  5. 'math/Frustum.cpp',
  6. 'math/Matrix.cpp',
  7. 'math/Plane.cpp',
  8. 'math/Quaternion.cpp',
  9. 'math/Vector.cpp',
  10. 'network/Client.cpp',
  11. 'network/ENet.cpp',
  12. 'network/Packet.cpp',
  13. 'network/Server.cpp',
  14. 'rendering/Attributes.cpp',
  15. 'rendering/FileTexture.cpp',
  16. 'rendering/Shader.cpp',
  17. 'rendering/Texture.cpp',
  18. 'rendering/TextureFormat.cpp',
  19. 'rendering/VertexBuffer.cpp',
  20. 'rendering/Window.cpp',
  21. 'rendering/WindowOptions.cpp',
  22. 'utils/BitArray.cpp',
  23. 'utils/Buffer.cpp',
  24. 'utils/Clock.cpp',
  25. 'utils/Error.cpp',
  26. 'utils/Logger.cpp',
  27. 'utils/Random.cpp',
  28. 'wrapper/GL.cpp',
  29. 'libs/lodepng/lodepng.cpp',
  30. ]
  31. src_tests = [
  32. 'Main.cpp',
  33. 'tests/ArrayListTests.cpp',
  34. 'tests/ArrayTests.cpp',
  35. 'tests/BitArrayTests.cpp',
  36. 'tests/BufferTests.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/UtilsTests.cpp',
  57. 'tests/VectorTests.cpp',
  58. 'tests/ComponentsTests.cpp',
  59. ]
  60. compiler = meson.get_compiler('cpp')
  61. args = compiler.get_supported_arguments(['-Wall', '-Wextra', '-pedantic', '-Werror'])
  62. cmake = import('cmake')
  63. glfw_proj = cmake.subproject('glfw')
  64. glfw_includes = glfw_proj.include_directories('glfw')
  65. glfw_dep = glfw_proj.dependency('glfw')
  66. glew_proj = subproject('glew', default_options: 'default_library=static')
  67. glew_includes = glew_proj.get_variable('glew_include')
  68. glew_dep = glew_proj.get_variable('glew_dep')
  69. thread_dep = dependency('threads', static: true)
  70. gl_dep = dependency('GL')
  71. ws2_32_dep = compiler.find_library('ws2_32', required: false)
  72. winmm_dep = compiler.find_library('winmm', required: false)
  73. glu_dep = compiler.find_library('glu32', required: false)
  74. dl_dep = compiler.find_library('dl', required: false)
  75. gamingcore_include = [include_directories('.'), glfw_includes, glew_includes]
  76. gamingcore = static_library('gamingcore',
  77. sources: src,
  78. include_directories : gamingcore_include,
  79. dependencies : [thread_dep, glfw_dep, glew_dep, gl_dep, ws2_32_dep, winmm_dep, glu_dep, dl_dep, glu_dep],
  80. cpp_args: args)
  81. gamingcore_dep = declare_dependency(
  82. include_directories : gamingcore_include,
  83. link_with: gamingcore)
  84. executable('tests',
  85. sources: src_tests,
  86. dependencies : gamingcore_dep,
  87. cpp_args: args + ['-DLOG_LEVEL=4'])