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
|
project('libembed', ['cpp'],
default_options: ['cpp_std=c++2a', 'warning_level=3'],
)
# libstdc++ lacks std::span at the moment
add_project_arguments(['-stdlib=libc++'], language: 'cpp')
add_project_link_arguments(['-stdlib=libc++'], language : 'cpp')
libzstd = dependency('libzstd')
libembed_sourceset = import('sourceset').source_set()
libembed_sourceset.add(files('lib/embed.cpp'))
libembed_sourceset.add(when: libzstd, if_true: [ libzstd, files('lib/embed_zstd.cpp') ] )
libembed_conf = libembed_sourceset.apply(configuration_data())
libembed = library('embed',
libembed_conf.sources(),
dependencies: libembed_conf.dependencies(),
include_directories: '3rd-party/frozen/include/'
)
dep_embed = declare_dependency(
link_with: libembed,
include_directories: include_directories('lib/', '3rd-party/frozen/include')
)
prog_python = import('python').find_installation('python3')
resources_h = custom_target('resources.h',
output: 'resources.h',
input: 'scripts/rcc',
command: [prog_python, '@INPUT@', '--namespace=staticdata', '--output=@OUTPUT@', '-', files('test/resources.xrc')],
)
zstd_dictionary = custom_target('zstd_dictionary',
output: 'zstd_dict',
input: 'scripts/rcc',
command: [ prog_python, '@INPUT@', 'Zstd', '--train=@OUTPUT@', files('test/resources.xrc') ]
)
zstd_resources_h = custom_target('zstd_resources.h',
output: 'zstd_resources.h',
input: [ 'scripts/rcc', zstd_dictionary ],
command: [prog_python, '@INPUT0@', '--namespace=zstd_data', '--output=@OUTPUT@', 'Zstd', '--dict=@INPUT1@', files('test/resources.xrc')],
)
test('libembed',
executable('embed',
sources: [ 'test/main.cpp', resources_h, zstd_resources_h ],
dependencies: [ dep_embed ]
)
)
|