aboutsummaryrefslogtreecommitdiff
path: root/meson.build
blob: 5cece60316ccde88c3da2f3157ea229d1bbb51f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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