From d67d0686f2038cbef6fa110dadb5d77aba96e3e2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 5 Aug 2024 03:08:35 +0200 Subject: Add meson build --- README.md | 4 +-- depends/mgl | 2 +- meson.build | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 4 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 meson.build create mode 100644 tests/meson.build diff --git a/README.md b/README.md index 0a0b586..bd37d28 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ C++ wrapper for [mgl](https://git.dec05eba.com/mgl/about/) ## Build `x11, libxrender, libxrandr` ## Runtime -`libglvnd (libGL.so)` +`libglvnd (libGL.so, libGLX.so, libEGL.so)` # Notes Every window _get_ function is cached from the last event poll, no calls to x11 is made. Only one window can be created and used at once.\ -mglpp needs to be initialized first and then a window created, before other functions are called. +mglpp needs to be initialized first and then a window created, before other functions are called. \ No newline at end of file diff --git a/depends/mgl b/depends/mgl index 9073965..2fbb183 160000 --- a/depends/mgl +++ b/depends/mgl @@ -1 +1 @@ -Subproject commit 90739659800c4bf893882098d70b575c26958883 +Subproject commit 2fbb18392a0cc3dd956f24514491c81a55e3c941 diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..7ddaa84 --- /dev/null +++ b/meson.build @@ -0,0 +1,91 @@ +project('mglpp', ['cpp'], version : '1.0.0', default_options : ['warning_level=2'], subproject_dir : 'depends') + +if get_option('buildtype') == 'debug' + add_project_arguments('-g3', language : ['cpp']) +elif get_option('buildtype') == 'release' + add_project_arguments('-DNDEBUG', language : ['cpp']) +endif + +src = [ + 'src/graphics/Text.cpp', + 'src/graphics/Image.cpp', + 'src/graphics/Font.cpp', + 'src/graphics/VertexBuffer.cpp', + 'src/graphics/Rectangle.cpp', + 'src/graphics/Texture.cpp', + 'src/graphics/Sprite.cpp', + 'src/graphics/Shader.cpp', + 'src/system/MemoryMappedFile.cpp', + 'src/system/Clock.cpp', + 'src/system/Utf8.cpp', + 'src/window/Window.cpp', + 'src/mglpp.cpp', +] + +project_headers = [ + 'include/mglpp/graphics/Text.hpp', + 'include/mglpp/graphics/PrimitiveType.hpp', + 'include/mglpp/graphics/Vertex.hpp', + 'include/mglpp/graphics/Drawable.hpp', + 'include/mglpp/graphics/Texture.hpp', + 'include/mglpp/graphics/Shader.hpp', + 'include/mglpp/graphics/Sprite.hpp', + 'include/mglpp/graphics/Color.hpp', + 'include/mglpp/graphics/VertexBuffer.hpp', + 'include/mglpp/graphics/Image.hpp', + 'include/mglpp/graphics/Font.hpp', + 'include/mglpp/graphics/Rectangle.hpp', + 'include/mglpp/system/Utf8.hpp', + 'include/mglpp/system/vec.hpp', + 'include/mglpp/system/Clock.hpp', + 'include/mglpp/system/MemoryMappedFile.hpp', + 'include/mglpp/system/FloatRect.hpp', + 'include/mglpp/mglpp.hpp', + 'include/mglpp/window/Window.hpp', + 'include/mglpp/window/Mouse.hpp', + 'include/mglpp/window/Event.hpp', + 'include/mglpp/window/Keyboard.hpp', + 'include/mglpp/window/Clipboard.hpp', +] + +mgl_proj = subproject('mgl') +mgl_dep = mgl_proj.get_variable('mgl_dep') + +dep = [ + mgl_dep, +] + +public_headers = include_directories('include') + +project_target = static_library( + meson.project_name(), + src, + install : false, + include_directories : public_headers, + dependencies : dep, +) + +project_dep = declare_dependency(include_directories : public_headers, link_with : project_target) +set_variable(meson.project_name() + '_dep', project_dep) + +#install_headers(project_headers, subdir : meson.project_name(), preserve_path : true) + +# pkg_mod = import('pkgconfig') +# pkg_mod.generate( +# name : meson.project_name(), +# filebase : meson.project_name(), +# description : 'Minimal Graphics Library', +# subdirs : meson.project_name(), +# libraries : project_target, +# ) + +# if not meson.is_subproject() +# subdir('tests') +# test('tests', +# executable('run_tests', +# files(['tests/main.cpp']), +# dependencies : [project_dep, test_dep], +# install : false +# ) +# ) +# endif \ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..244810e --- /dev/null +++ b/tests/meson.build @@ -0,0 +1 @@ +test_dep = declare_dependency() \ No newline at end of file -- cgit v1.2.3