diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/meson.build b/meson.build index 78c6d7c..6fc3973 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021-2023 David Robillard <d@drobilla.net> +# Copyright 2021-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC project( @@ -8,11 +8,12 @@ project( 'b_ndebug=if-release', 'buildtype=release', 'c_std=c99', + 'c_winlibs=', 'cpp_std=c++14', ], license: 'ISC', meson_version: '>= 0.54.0', - version: '0.5.3', + version: '0.5.5', ) pugl_src_root = meson.current_source_dir() @@ -28,8 +29,11 @@ versioned_name = 'pugl' + version_suffix pkg = import('pkgconfig') cc = meson.get_compiler('c') -# Enable C++ support if we're building the examples -if not get_option('examples').disabled() or not get_option('tests').disabled() +# Enable C++ support if we're building the examples or the bindings +if ( + not get_option('bindings_cpp').disabled() + or not get_option('examples').disabled() +) if add_languages(['cpp'], native: false, required: false) cpp = meson.get_compiler('cpp') endif @@ -44,12 +48,6 @@ endif # Set global warning suppressions subdir('meson/suppressions') -# Disable deprecated API which is not used by tests or examples -add_project_arguments( - ['-DPUGL_DISABLE_DEPRECATED'], - language: ['c', 'cpp', 'objc', 'objcpp'], -) - ############# # Platforms # ############# @@ -156,15 +154,20 @@ elif host_machine.system() == 'windows' ] endif + if not get_option('win_wchar').disabled() + win_args += ['-DUNICODE', '-D_UNICODE'] + endif + add_project_arguments(win_args, language: ['c', 'cpp']) user32_dep = cc.find_library('user32') shlwapi_dep = cc.find_library('shlwapi') dwmapi_dep = cc.find_library('dwmapi') + gdi32_dep = cc.find_library('gdi32') platform = 'win' platform_sources = files('src/win.c') - core_deps = [user32_dep, shlwapi_dep, dwmapi_dep] + core_deps = [user32_dep, shlwapi_dep, dwmapi_dep, gdi32_dep] extension = '.c' soversion = '' @@ -240,6 +243,7 @@ libpugl = library( c_args: library_args + core_args, dependencies: core_deps, gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, include_directories: includes, install: true, soversion: soversion, @@ -249,7 +253,7 @@ libpugl = library( pugl_dep = declare_dependency( compile_args: extra_c_args, dependencies: core_deps, - include_directories: ['include'], + include_directories: includes, link_with: libpugl, ) @@ -279,6 +283,7 @@ if get_option('stub') c_args: library_args, dependencies: [pugl_dep], gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, include_directories: includes, install: true, soversion: soversion, @@ -321,6 +326,7 @@ if opengl_dep.found() c_args: library_args, dependencies: [pugl_dep, opengl_dep], gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, include_directories: includes, install: true, soversion: soversion, @@ -374,6 +380,7 @@ if cairo_dep.found() c_args: library_args + cairo_args, dependencies: [pugl_dep, cairo_dep], gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, include_directories: includes, install: true, objc_args: library_args + cairo_args, @@ -429,6 +436,7 @@ if vulkan_dep.found() c_args: library_args, dependencies: vulkan_deps, gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, include_directories: includes, install: true, soversion: soversion, @@ -460,12 +468,20 @@ endif ############################### subdir('include') -subdir('bindings/cpp') + +if not get_option('bindings_cpp').disabled() + subdir('bindings/cpp') +endif ###################### # Tests and Examples # ###################### +if not get_option('tests').disabled() or not get_option('examples').disabled() + puglutil = subproject('puglutil') + puglutil_dep = puglutil.get_variable('puglutil_dep') +endif + if not get_option('tests').disabled() subdir('test') endif @@ -520,6 +536,7 @@ if meson.version().version_compare('>=0.53.0') 'Tests': not get_option('tests').disabled(), 'Examples': not get_option('examples').disabled(), 'Documentation': build_docs, + 'C++ bindings': not get_option('bindings_cpp').disabled(), }, bool_yn: true, section: 'Components', |