meson.build 2.7 KB

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