From 2fbb18392a0cc3dd956f24514491c81a55e3c941 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 5 Aug 2024 02:39:41 +0200 Subject: Add meson build --- meson.build | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 meson.build (limited to 'meson.build') 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 -- cgit v1.2.3