aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-05 02:39:41 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-05 03:08:14 +0200
commit2fbb18392a0cc3dd956f24514491c81a55e3c941 (patch)
tree21ee993e0b86108b32c9c80876d17a8338ca91a2
parent90739659800c4bf893882098d70b575c26958883 (diff)
Add meson build
-rw-r--r--README.md4
-rw-r--r--meson.build98
-rw-r--r--tests/meson.build1
3 files changed, 101 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2b866e3..d952ba8 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
# Minimal Graphics Library
Written in C and uses OpenGL 2.1 to support as many platforms as possible.\
-Right now mgl only supports x11.
+Right now mgl only supports x11. Mgl allows you to choose glx or egl at runtime.
# Dependencies
## 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.\
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..5cece60
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,98 @@
+project('mgl', ['c'], version : '1.0.0', default_options : ['warning_level=2'])
+
+if get_option('buildtype') == 'debug'
+ add_project_arguments('-g3', language : ['c'])
+elif get_option('buildtype') == 'release'
+ add_project_arguments('-DNDEBUG', language : ['c'])
+endif
+
+src = [
+ 'src/graphics/texture.c',
+ 'src/graphics/sprite.c',
+ 'src/graphics/image.c',
+ 'src/graphics/font_char_map.c',
+ 'src/graphics/font.c',
+ 'src/graphics/vertex.c',
+ 'src/graphics/primitive_type.c',
+ 'src/graphics/vertex_buffer.c',
+ 'src/graphics/text.c',
+ 'src/graphics/shader.c',
+ 'src/graphics/rectangle.c',
+ 'src/system/fileutils.c',
+ 'src/system/utf8.c',
+ 'src/system/clock.c',
+ 'src/mgl.c',
+ 'src/window/window.c',
+ 'src/gl.c',
+]
+
+project_headers = [
+ 'include/mgl/graphics/rectangle.h',
+ 'include/mgl/graphics/sprite.h',
+ 'include/mgl/graphics/texture.h',
+ 'include/mgl/graphics/font_char_map.h',
+ 'include/mgl/graphics/font.h',
+ 'include/mgl/graphics/image.h',
+ 'include/mgl/graphics/shader.h',
+ 'include/mgl/graphics/primitive_type.h',
+ 'include/mgl/graphics/vertex.h',
+ 'include/mgl/graphics/vertex_buffer.h',
+ 'include/mgl/graphics/font_glyph.h',
+ 'include/mgl/graphics/color.h',
+ 'include/mgl/graphics/text.h',
+ 'include/mgl/system/fileutils.h',
+ 'include/mgl/system/clock.h',
+ 'include/mgl/system/vec.h',
+ 'include/mgl/system/utf8.h',
+ 'include/mgl/gl.h',
+ 'include/mgl/window/event.h',
+ 'include/mgl/window/mouse_button.h',
+ 'include/mgl/window/window.h',
+ 'include/mgl/window/key.h',
+ 'include/mgl/gl_macro.h',
+ 'include/mgl/mgl.h',
+]
+
+cc = meson.get_compiler('c')
+dep = [
+ dependency('x11'),
+ dependency('xrender'),
+ dependency('xrandr'),
+ dependency('threads'),
+ cc.find_library('m'),
+]
+
+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.c']),
+ 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