Skip to content

Commit bfbbdc8

Browse files
committed
update meson build with zstd option
1 parent cba7e00 commit bfbbdc8

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ if get_option('use_extlibs')
5454
add_project_arguments('-DUSE_EXTLIBS', language: ['cpp', 'c'])
5555
zdep = dependency('zlib', version : '>=1.2.8', required: true)
5656
pugidep = dependency('pugixml', required: true)
57+
zstddep = dependency('zstd', required: true)
58+
else
59+
if get_option('use_zstd')
60+
add_project_arguments('-DUSE_ZSTD', language: ['cpp', 'c'])
61+
zstddep = dependency('zstd', required: true)
62+
endif
5763
endif
5864

5965
subdir('tmxlite')

meson_options.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
option('use_rtti', type: 'boolean', value: true, description: 'Use run time type information?', yield: true)
22
option('project_static_runtime', type: 'boolean', value: false, description: 'Use statically linked standard/runtime libraries?', yield: true)
3-
option('use_extlibs', type: 'boolean', value: false, description: 'Use external pugixml and zlib libraries instead of the included source?', yield: true)
3+
option('use_extlibs', type: 'boolean', value: false, description: 'Use external pugixml, zstd and zlib libraries instead of the included source?', yield: true)
4+
option('use_zstd', type: 'boolean', value: false, description: 'Use zstd compression library (automatically enabled when use_extlibs is true)?', yield: true)
45
option('build_examples', type: 'boolean', value: false)
56
option('build_tests', type: 'boolean', value: false)
67
option('pause_test', type: 'boolean', value: true, description: 'Wait for user input after tests have finished running')

tmxlite/src/meson.build

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,30 @@ if get_option('use_extlibs')
1111
'Tileset.cpp',
1212
install: true,
1313
include_directories: incdir,
14-
dependencies: [zdep, pugidep]
14+
dependencies: [zdep, pugidep, zstddep]
1515
)
1616
else
17+
18+
if get_option('use_zstd')
19+
20+
tmxlite_lib = library(meson.project_name() + binary_postfix,
21+
'detail/pugixml.cpp',
22+
'FreeFuncs.cpp',
23+
'ImageLayer.cpp',
24+
'Map.cpp',
25+
'miniz.c',
26+
'Object.cpp',
27+
'ObjectGroup.cpp',
28+
'Property.cpp',
29+
'TileLayer.cpp',
30+
'LayerGroup.cpp',
31+
'Tileset.cpp',
32+
install: true,
33+
include_directories: incdir,
34+
dependencies: zstddep
35+
)
36+
else
37+
1738
tmxlite_lib = library(meson.project_name() + binary_postfix,
1839
'detail/pugixml.cpp',
1940
'FreeFuncs.cpp',
@@ -29,6 +50,7 @@ else
2950
install: true,
3051
include_directories: incdir,
3152
)
53+
endif
3254
endif
3355

3456
tmxlite_dep = declare_dependency(

0 commit comments

Comments
 (0)