Andrea Blankenstijn
a19d2ea6bd
- mark as const every pointer that can be const. - in implementation mark const args passed by value that are meant to be read-only. - wrap in a lambda complex initializations of (const) values. - argument passing: - pass by value arguments of cheap-to-copy types or meant to be copied anyway. - pass by (const) reference args not meant to outlive called function scope and not cheap-to-copy. - pass (const) pointers to (const) args when null is a valid option and pointed data aren't expected to outlive function scope. - use string_view for non-owned strings (not meant to outlive function scope). - use span for collection types like vector and arrays. - fancy pointers passing: - pass by value if a reference will be held: - pass by const reference if a reference _may_ be hell. - when no references are meant to be held: - dereference the pointer to pass the pointed data by reference if null is not an option. - pass the underlying raw pointer if null is an option. … and random subtle changes and fixes here and there that I forgot to mention.
74 lines
1.9 KiB
Meson
74 lines
1.9 KiB
Meson
project('sdl2_basic_widgets', 'cpp',
|
|
version : '0.1pre',
|
|
default_options : [
|
|
'b_lundef=false',
|
|
'b_sanitize=undefined',
|
|
'cpp_std=c++20',
|
|
'optimization=g',
|
|
'warning_level=3',
|
|
],
|
|
license: 'EUPL-1.2')
|
|
|
|
add_project_arguments('-pedantic', language: 'cpp')
|
|
|
|
if (get_option('buildtype').startswith('debug'))
|
|
add_project_arguments('-DBWIDGETS_DEBUG', language: 'cpp')
|
|
endif
|
|
|
|
sdl = [
|
|
dependency('sdl2', version: '>=2.0.5'),
|
|
dependency('SDL2_ttf')
|
|
]
|
|
fontconfig = dependency('fontconfig')
|
|
|
|
pub_api = include_directories('inc')
|
|
|
|
libbasic_widgets = static_library('basic_widgets',
|
|
'src/core/draw.cpp',
|
|
'src/core/font.cpp',
|
|
'src/core/renderer.cpp',
|
|
'src/core/texture.cpp',
|
|
'src/w/base/layout_impl.cpp',
|
|
'src/w/base/widget_impl.cpp',
|
|
'src/w/button_impl.cpp',
|
|
'src/w/caption_impl.cpp',
|
|
'src/w/feat/event_handler_impl.cpp',
|
|
'src/w/feat/keyboard_handler_impl.cpp',
|
|
'src/w/feat/mouse_handler_impl.cpp',
|
|
'src/w/widget_factory.cpp',
|
|
dependencies : [sdl, fontconfig],
|
|
include_directories : pub_api,
|
|
install : true)
|
|
|
|
libbasic_widgets_dep = declare_dependency(
|
|
include_directories : pub_api,
|
|
link_with: libbasic_widgets,
|
|
dependencies : [sdl, fontconfig])
|
|
|
|
executable('button_demo',
|
|
'examples/button_example.cpp',
|
|
dependencies: [sdl],
|
|
include_directories : pub_api,
|
|
link_with : libbasic_widgets,
|
|
install : false)
|
|
|
|
executable('caption_demo',
|
|
'examples/caption_example.cpp',
|
|
dependencies: [sdl],
|
|
include_directories : pub_api,
|
|
link_with : libbasic_widgets,
|
|
install : false)
|
|
|
|
executable('example_demo',
|
|
'examples/example_example.cpp',
|
|
dependencies: [sdl],
|
|
include_directories : pub_api,
|
|
link_with : libbasic_widgets,
|
|
install : false)
|
|
|
|
executable('input_demo',
|
|
'examples/input_example.cpp',
|
|
dependencies: [sdl],
|
|
include_directories : pub_api,
|
|
link_with : libbasic_widgets,
|
|
install : false)
|