Set up examples meson.build.

This commit is contained in:
Pietro Gagliardi 2019-03-24 17:26:15 -04:00
parent 467a9102ec
commit 3457082b1b
2 changed files with 66 additions and 1 deletions

65
examples/meson.build Normal file
View File

@ -0,0 +1,65 @@
# 24 march 2019
libui_example_include_directories = libui_base_include_directories + [include_directories('.')]
libui_example_sources = []
libui_example_link_args = []
libui_example_cpp_extra_args = []
if libui_OS == 'windows'
libui_example_manifest = 'example.manifest'
if libui_mode == 'static'
libui_example_manifest = 'example.static.manifest'
endif
libui_example_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: [libui_example_manifest],
include_directories: libui_example_include_directories),
]
# because Microsoft's toolchain is dumb
if libui_MSVC
libui_example_link_args += ['/ENTRY:mainCRTStartup']
endif
elif libui_OS == 'darwin'
# since we use a deployment target of 10.8, the non-C++11-compliant libstdc++ is chosen by default; we need C++11
# see issue #302 for more details
libui_example_cpp_extra_args += ['--stdlib=libc++']
endif
libui_examples = {
'controlgallery': {
'sources': ['controlgallery/main.c'],
},
'histogram': {
'sources': ['histogram/main.c'],
},
'cpp-multithread': {
'sources': ['cpp-multithread/main.cpp'],
'deps': [
dependency('threads',
required: true),
],
'cpp_args': libui_example_cpp_extra_args,
'link_args': libui_example_cpp_extra_args,
},
'drawtext': {
'sources': ['drawtext/main.c'],
},
'timer': {
'sources': ['timer/main.c'],
},
'datetime': {
'sources': ['datetime/main.c'],
},
}
foreach name, args : libui_examples
executable(name, args['sources'] + libui_example_sources,
include_directories: libui_example_include_directories,
dependencies: args.get('deps', []) + libui_binary_deps,
link_with: libui_libui,
cpp_args: args.get('cpp_args', []),
link_args: args.get('link_args', []) + libui_example_link_args,
build_by_default: false,
gui_app: false,
install: false)
endforeach

View File

@ -166,4 +166,4 @@ if libui_mode == 'static'
libui_binary_deps = libui_deps
endif
subdir('test')
# TODO examples
subdir('examples')