浏览代码

build as static library

Kajetan Johannes Hammerle 3 年之前
父节点
当前提交
f2184c96f9
共有 1 个文件被更改,包括 69 次插入54 次删除
  1. 69 54
      meson.build

+ 69 - 54
meson.build

@@ -1,67 +1,82 @@
-project('gaming core tests', 'cpp')
+project('gamingcore', 'cpp')
 
-sources = ['Main.cpp',
-    'tests/Test.cpp',
-    'tests/ArrayTests.cpp',
-    'tests/ArrayListTests.cpp',
-    'tests/HashMapTests.cpp',
-    'tests/ListTests.cpp',
-    'utils/BitArray.cpp',
-    'tests/BitArrayTests.cpp',
-    'tests/StringBufferTests.cpp',
-    'tests/RandomTests.cpp',
-    'utils/Random.cpp',
-    'tests/RingBufferTests.cpp',
-    'tests/SplitStringTests.cpp',
-    'tests/VectorTests.cpp',
-    'math/Vector.cpp',
+src = [
+    'images/PNGReader.cpp',
+    'input/Button.cpp',
+    'input/Buttons.cpp',
+    'input/TextInput.cpp',
+    'math/Frustum.cpp',
     'math/Matrix.cpp',
-    'tests/MatrixTests.cpp',
-    'tests/StackTests.cpp',
-    'tests/MatrixStackTests.cpp',
-    'tests/PlaneTests.cpp',
     'math/Plane.cpp',
-    'tests/FrustumTests.cpp',
-    'math/Frustum.cpp',
-    'utils/Size.cpp',
-    'utils/Logger.cpp',
-    'tests/QuaternionTests.cpp',
     'math/Quaternion.cpp',
-    'tests/UtilsTests.cpp',
-    'tests/ColorTests.cpp',
-    'utils/Clock.cpp',
-    'tests/ClockTests.cpp',
-    'images/PNGReader.cpp',
-    'tests/PNGReaderTests.cpp',
-    'tests/BufferTests.cpp',
-    'tests/TypedBufferTests.cpp',
-    'wrapper/GL.cpp',
+    'math/Vector.cpp',
+    'network/Client.cpp',
+    'network/ENet.cpp',
+    'network/Packet.cpp',
+    'network/Server.cpp',
+    'rendering/Attributes.cpp',
+    'rendering/FileTexture.cpp',
+    'rendering/Shader.cpp',
     'rendering/Texture.cpp',
-    'rendering/Shader.cpp', 
+    'rendering/TextureFormat.cpp',
     'rendering/VertexBuffer.cpp',
-    'rendering/Attributes.cpp',
     'rendering/Window.cpp',
     'rendering/WindowOptions.cpp',
-    'rendering/TextureFormat.cpp',
-    'rendering/FileTexture.cpp',
-    'input/Button.cpp',
-    'input/Buttons.cpp',
-    'tests/UniquePointerTests.cpp',
+    'utils/BitArray.cpp',
     'utils/Buffer.cpp',
+    'utils/Clock.cpp',
+    'utils/Error.cpp',
+    'utils/Logger.cpp',
+    'utils/Random.cpp',
+    'utils/Size.cpp',
+    'wrapper/GL.cpp',
+]
+
+src_tests = [
+    'Main.cpp',
+    'tests/ArrayListTests.cpp',
+    'tests/ArrayTests.cpp',
+    'tests/BitArrayTests.cpp',
+    'tests/BufferTests.cpp',
+    'tests/ClockTests.cpp',
+    'tests/ColorTests.cpp',
+    'tests/FrustumTests.cpp',
+    'tests/HashMapTests.cpp',
+    'tests/ListTests.cpp',
+    'tests/MatrixStackTests.cpp',
+    'tests/MatrixTests.cpp',
     'tests/NetworkTests.cpp',
-    'network/Packet.cpp',
-    'network/Server.cpp',
-    'network/Client.cpp',
-    'network/ENet.cpp',
-    'input/TextInput.cpp',
-    'utils/Error.cpp']
+    'tests/PNGReaderTests.cpp',
+    'tests/PlaneTests.cpp',
+    'tests/QuaternionTests.cpp',
+    'tests/RandomTests.cpp',
+    'tests/RingBufferTests.cpp',
+    'tests/SplitStringTests.cpp',
+    'tests/StackTests.cpp',
+    'tests/StringBufferTests.cpp',
+    'tests/Test.cpp',
+    'tests/TypedBufferTests.cpp',
+    'tests/UniquePointerTests.cpp',
+    'tests/UtilsTests.cpp',
+    'tests/VectorTests.cpp',
+]
+
+thread_dep = dependency('threads')
+glew_dep = dependency('glew')
+glfw_dep = dependency('glfw3')
+png_dep = dependency('libpng')
+
+args = ['-Wall', '-Wextra', '-pedantic', '-Werror']
 
-threadDep = dependency('threads')
-glewDep = dependency('glew')
-glfwDep = dependency('glfw3')
-pngDep = dependency('libpng')
+inc = include_directories('.')
+libgamingcore = static_library('gamingcore', 
+    sources: src,
+    include_directories : inc,
+    dependencies : [thread_dep, glew_dep, glfw_dep, png_dep],
+    cpp_args: args)
+libgamingcore_dep = declare_dependency(include_directories : inc, link_with : libgamingcore)
 
 executable('tests', 
-    sources: sources,
-    dependencies : [threadDep, glewDep, glfwDep, pngDep],
-    cpp_args: ['-Wall', '-Wextra', '-pedantic', '-Werror', '-DLOG_LEVEL=4'])
+    sources: src_tests,
+    dependencies : libgamingcore_dep,
+    cpp_args: args)