meson.build 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. project('gamingcore', 'cpp', default_options : ['default_library=static'])
  2. src = [
  3. 'images/ImageReader.cpp',
  4. 'input/Button.cpp',
  5. 'input/Buttons.cpp',
  6. 'input/TextInput.cpp',
  7. 'math/Frustum.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/Attributes.cpp',
  17. 'rendering/FileTexture.cpp',
  18. 'rendering/Shader.cpp',
  19. 'rendering/Texture.cpp',
  20. 'rendering/TextureFormat.cpp',
  21. 'rendering/VertexBuffer.cpp',
  22. 'rendering/Window.cpp',
  23. 'rendering/WindowOptions.cpp',
  24. 'utils/BitArray.cpp',
  25. 'utils/Buffer.cpp',
  26. 'utils/Clock.cpp',
  27. 'utils/Error.cpp',
  28. 'utils/Logger.cpp',
  29. 'utils/Random.cpp',
  30. 'utils/Size.cpp',
  31. 'wrapper/GL.cpp',
  32. 'lodepng/lodepng.cpp',
  33. ]
  34. src_tests = [
  35. 'Main.cpp',
  36. 'tests/ArrayListTests.cpp',
  37. 'tests/ArrayTests.cpp',
  38. 'tests/BitArrayTests.cpp',
  39. 'tests/BufferTests.cpp',
  40. 'tests/ClockTests.cpp',
  41. 'tests/ColorTests.cpp',
  42. 'tests/FrustumTests.cpp',
  43. 'tests/HashMapTests.cpp',
  44. 'tests/ListTests.cpp',
  45. 'tests/MatrixStackTests.cpp',
  46. 'tests/MatrixTests.cpp',
  47. 'tests/NetworkTests.cpp',
  48. 'tests/ImageReaderTests.cpp',
  49. 'tests/PlaneTests.cpp',
  50. 'tests/QuaternionTests.cpp',
  51. 'tests/RandomTests.cpp',
  52. 'tests/RingBufferTests.cpp',
  53. 'tests/SplitStringTests.cpp',
  54. 'tests/StackTests.cpp',
  55. 'tests/StringBufferTests.cpp',
  56. 'tests/Test.cpp',
  57. 'tests/TypedBufferTests.cpp',
  58. 'tests/UniquePointerTests.cpp',
  59. 'tests/UtilsTests.cpp',
  60. 'tests/VectorTests.cpp',
  61. 'tests/ComponentsTests.cpp',
  62. ]
  63. compiler = meson.get_compiler('cpp')
  64. args = compiler.get_supported_arguments(['-Wall', '-Wextra', '-pedantic', '-Werror'])
  65. cmake = import('cmake')
  66. glfw_proj = cmake.subproject('glfw')
  67. glfw_includes = glfw_proj.include_directories('glfw')
  68. glfw_dep = glfw_proj.dependency('glfw')
  69. glew_proj = subproject('glew', default_options: 'default_library=static')
  70. glew_includes = glew_proj.get_variable('glew_include')
  71. glew_dep = glew_proj.get_variable('glew_dep')
  72. thread_dep = dependency('threads', static: true)
  73. gl_dep = dependency('GL')
  74. ws2_32_dep = compiler.find_library('ws2_32', required: false)
  75. winmm_dep = compiler.find_library('winmm', required: false)
  76. glu_dep = compiler.find_library('glu32', required: false)
  77. dl_dep = compiler.find_library('dl', required: false)
  78. gamingcore_include = [include_directories('.'), glfw_includes, glew_includes]
  79. gamingcore = static_library('gamingcore',
  80. sources: src,
  81. include_directories : gamingcore_include,
  82. dependencies : [thread_dep, glfw_dep, glew_dep, gl_dep, ws2_32_dep, winmm_dep, glu_dep, dl_dep, glu_dep],
  83. cpp_args: args)
  84. gamingcore_dep = declare_dependency(
  85. include_directories : gamingcore_include,
  86. link_with: gamingcore)
  87. executable('tests',
  88. sources: src_tests,
  89. dependencies : gamingcore_dep,
  90. cpp_args: args + ['-DLOG_LEVEL=4'])