Skip to content

Commit 4e95aff

Browse files
author
King_DuckZ
committed
Add meson file for the main lib
1 parent a6bfe54 commit 4e95aff

4 files changed

Lines changed: 79 additions & 0 deletions

File tree

meson.build

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
project('tmxlite', 'cpp', 'c',
2+
version: '1.2.1',
3+
meson_version: '>=0.49.2',
4+
default_options: [
5+
'buildtype=release',
6+
'cpp_std=c++14',
7+
'b_ndebug=if-release'
8+
]
9+
)
10+
11+
cpp = meson.get_compiler('cpp')
12+
if get_option('use_rtti')
13+
if cpp.get_argument_syntax() == 'gcc'
14+
if get_option('project_static_runtime')
15+
add_project_arguments('-Wall', '-static', language: ['cpp', 'c'])
16+
else
17+
add_project_arguments('-Wall', language: ['cpp', 'c'])
18+
endif
19+
endif
20+
else
21+
if cpp.get_argument_syntax() == 'gcc'
22+
if get_option('project_static_runtime')
23+
add_project_arguments('-Wall', '-fno-rtti', '-static', language: ['cpp', 'c'])
24+
else
25+
add_project_arguments('-Wall', '-fno-rtti', language: ['cpp', 'c'])
26+
endif
27+
endif
28+
endif
29+
30+
binary_postfix = ''
31+
if get_option('default_library') == 'static'
32+
if get_option('debug')
33+
add_project_arguments('-D_DEBUG_', '-DTMXLITE_STATIC', language: ['cpp', 'c'])
34+
binary_postfix = '-s-d'
35+
else
36+
add_project_arguments('-O4', '-DTMXLITE_STATIC', language: ['cpp', 'c'])
37+
binary_postfix = '-s'
38+
endif
39+
elif get_option('default_library') == 'shared'
40+
if get_option('debug')
41+
add_project_arguments('-D_DEBUG_', language: ['cpp', 'c'])
42+
binary_postfix = '-d'
43+
else
44+
add_project_arguments('-O4', language: ['cpp', 'c'])
45+
endif
46+
else
47+
error('Unsupported option \'' + get_option('default_library') + '\' for project ' + meson.project_name())
48+
endif
49+
50+
if cpp.get_argument_syntax() == 'msvc'
51+
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: ['cpp', 'c'])
52+
endif
53+
54+
subdir('tmxlite')

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
option('use_rtti', type: 'boolean', value: true, description: 'Use run time type information?', yield: true)
2+
option('project_static_runtime', type: 'boolean', value: false, description: 'Use statically linked standard/runtime libraries?', yield: true)

tmxlite/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
incdir = include_directories('include')
2+
3+
subdir('src')

tmxlite/src/meson.build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
tmxlite_lib = library(meson.project_name() + binary_postfix,
2+
'detail/pugixml.cpp',
3+
'FreeFuncs.cpp',
4+
'ImageLayer.cpp',
5+
'Map.cpp',
6+
'miniz.c',
7+
'Object.cpp',
8+
'ObjectGroup.cpp',
9+
'Property.cpp',
10+
'TileLayer.cpp',
11+
'LayerGroup.cpp',
12+
'Tileset.cpp',
13+
install: true,
14+
include_directories: incdir,
15+
)
16+
17+
tmxlite_dep = declare_dependency(
18+
link_with: tmxlite_lib,
19+
include_directories: incdir,
20+
)

0 commit comments

Comments
 (0)