diff options
42 files changed, 74 insertions, 52 deletions
diff --git a/examples/meson.build b/examples/meson.build index ef77e65..8206a10 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -28,7 +28,6 @@ vulkan_examples = [ ] includes = include_directories( - '..', '../bindings/cpp/include', '../include', ) @@ -120,7 +119,7 @@ else foreach example : stub_examples source = [example] target = example.split('.')[0] - dependencies = [pugl_dep, pugl_stub_dep] + dependencies = [pugl_dep, pugl_stub_dep, puglutil_dep] defines = [] executable( @@ -138,7 +137,7 @@ else foreach example : gl_examples source = [example] target = example.split('.')[0] - dependencies = [pugl_dep, pugl_gl_dep] + dependencies = [pugl_dep, pugl_gl_dep, puglutil_dep] defines = [] if target == 'pugl_shader_demo' @@ -174,7 +173,7 @@ else target, example, c_args: example_defines + example_c_args + cairo_args, - dependencies: [pugl_dep, pugl_cairo_dep], + dependencies: [pugl_dep, pugl_cairo_dep, puglutil_dep], include_directories: includes, ) endforeach @@ -185,7 +184,7 @@ else foreach example : vulkan_examples source = [example] target = example.split('.')[0] - dependencies = [dl_dep, pugl_vulkan_dep] + dependencies = [dl_dep, pugl_vulkan_dep, puglutil_dep] defines = [] if target == 'pugl_vulkan_cpp_demo' diff --git a/examples/pugl_cairo_demo.app/MacOS/meson.build b/examples/pugl_cairo_demo.app/MacOS/meson.build index 18e1fcf..66221c7 100644 --- a/examples/pugl_cairo_demo.app/MacOS/meson.build +++ b/examples/pugl_cairo_demo.app/MacOS/meson.build @@ -6,6 +6,6 @@ executable( ['../../pugl_cairo_demo.c'], c_args: example_defines + example_c_args + cairo_args, cpp_args: example_defines + example_cpp_args, - dependencies: [pugl_dep, pugl_cairo_dep], + dependencies: [pugl_dep, pugl_cairo_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c index 143f49e..1c16a93 100644 --- a/examples/pugl_cairo_demo.c +++ b/examples/pugl_cairo_demo.c @@ -2,7 +2,8 @@ // SPDX-License-Identifier: ISC #include "demo_utils.h" -#include "test/test_utils.h" + +#include "puglutil/test_utils.h" #include "pugl/cairo.h" #include "pugl/pugl.h" diff --git a/examples/pugl_clipboard_demo.app/MacOS/meson.build b/examples/pugl_clipboard_demo.app/MacOS/meson.build index 31ad2f0..0727404 100644 --- a/examples/pugl_clipboard_demo.app/MacOS/meson.build +++ b/examples/pugl_clipboard_demo.app/MacOS/meson.build @@ -5,6 +5,5 @@ executable( 'pugl_clipboard_demo', '../../pugl_clipboard_demo.c', c_args: example_defines + example_c_args, - dependencies: [pugl_dep, pugl_gl_dep], - include_directories: include_directories('../../..'), + dependencies: [pugl_dep, pugl_gl_dep, puglutil_dep], ) diff --git a/examples/pugl_clipboard_demo.c b/examples/pugl_clipboard_demo.c index 706d32a..2f1fdbe 100644 --- a/examples/pugl_clipboard_demo.c +++ b/examples/pugl_clipboard_demo.c @@ -4,7 +4,8 @@ // A demonstration of using clipboards for copy/paste and drag and drop #include "cube_view.h" -#include "test/test_utils.h" + +#include "puglutil/test_utils.h" #include "pugl/gl.h" #include "pugl/pugl.h" diff --git a/examples/pugl_cpp_demo.app/MacOS/meson.build b/examples/pugl_cpp_demo.app/MacOS/meson.build index f5ddd67..b840771 100644 --- a/examples/pugl_cpp_demo.app/MacOS/meson.build +++ b/examples/pugl_cpp_demo.app/MacOS/meson.build @@ -6,6 +6,6 @@ executable( '../../pugl_cpp_demo.cpp', c_args: example_defines + example_c_args, cpp_args: example_defines + example_cpp_args, - dependencies: [puglpp_dep, pugl_gl_dep], + dependencies: [puglpp_dep, pugl_gl_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_cpp_demo.cpp b/examples/pugl_cpp_demo.cpp index 6b52d18..37efe45 100644 --- a/examples/pugl_cpp_demo.cpp +++ b/examples/pugl_cpp_demo.cpp @@ -3,7 +3,8 @@ #include "cube_view.h" #include "demo_utils.h" -#include "test/test_utils.h" + +#include "puglutil/test_utils.h" #include "pugl/gl.hpp" #include "pugl/pugl.h" diff --git a/examples/pugl_cursor_demo.app/MacOS/meson.build b/examples/pugl_cursor_demo.app/MacOS/meson.build index 94359cd..54670ad 100644 --- a/examples/pugl_cursor_demo.app/MacOS/meson.build +++ b/examples/pugl_cursor_demo.app/MacOS/meson.build @@ -6,6 +6,6 @@ executable( '../../pugl_cursor_demo.c', c_args: example_defines + example_c_args, cpp_args: example_defines + example_cpp_args, - dependencies: [pugl_dep, pugl_gl_dep], + dependencies: [pugl_dep, pugl_gl_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_cursor_demo.c b/examples/pugl_cursor_demo.c index 8ae7631..a70a5eb 100644 --- a/examples/pugl_cursor_demo.c +++ b/examples/pugl_cursor_demo.c @@ -1,7 +1,7 @@ // Copyright 2012-2020 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "test/test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/gl.h" #include "pugl/pugl.h" diff --git a/examples/pugl_embed_demo.app/MacOS/meson.build b/examples/pugl_embed_demo.app/MacOS/meson.build index 9e6dd58..3bef9c1 100644 --- a/examples/pugl_embed_demo.app/MacOS/meson.build +++ b/examples/pugl_embed_demo.app/MacOS/meson.build @@ -6,6 +6,6 @@ executable( '../../pugl_embed_demo.c', c_args: example_defines + example_c_args, cpp_args: example_defines + example_cpp_args, - dependencies: [pugl_dep, pugl_gl_dep], + dependencies: [pugl_dep, pugl_gl_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index 417e690..ff6a63e 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -3,7 +3,8 @@ #include "cube_view.h" #include "demo_utils.h" -#include "test/test_utils.h" + +#include "puglutil/test_utils.h" #include "pugl/gl.h" #include "pugl/pugl.h" diff --git a/examples/pugl_management_demo.app/MacOS/meson.build b/examples/pugl_management_demo.app/MacOS/meson.build index 69dafc7..31604f6 100644 --- a/examples/pugl_management_demo.app/MacOS/meson.build +++ b/examples/pugl_management_demo.app/MacOS/meson.build @@ -6,6 +6,6 @@ executable( ['../../pugl_management_demo.c'], c_args: example_defines + example_c_args + cairo_args, cpp_args: example_defines + example_cpp_args, - dependencies: [pugl_dep, pugl_cairo_dep], + dependencies: [pugl_dep, pugl_cairo_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_management_demo.c b/examples/pugl_management_demo.c index 163e063..156b2dd 100644 --- a/examples/pugl_management_demo.c +++ b/examples/pugl_management_demo.c @@ -5,7 +5,7 @@ A demonstration of window types, states, and management. */ -#include "test/test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/cairo.h" #include "pugl/pugl.h" diff --git a/examples/pugl_print_events.c b/examples/pugl_print_events.c index 96a8889..7f5fe21 100644 --- a/examples/pugl_print_events.c +++ b/examples/pugl_print_events.c @@ -1,7 +1,7 @@ // Copyright 2012-2020 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "test/test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/examples/pugl_shader_demo.app/MacOS/meson.build b/examples/pugl_shader_demo.app/MacOS/meson.build index d3d0755..9507e17 100644 --- a/examples/pugl_shader_demo.app/MacOS/meson.build +++ b/examples/pugl_shader_demo.app/MacOS/meson.build @@ -10,6 +10,6 @@ executable( ], c_args: example_defines + example_c_args, cpp_args: example_defines + example_cpp_args, - dependencies: [pugl_dep, pugl_gl_dep, dl_dep], + dependencies: [pugl_dep, pugl_gl_dep, dl_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index c05a9dd..209e8bd 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -25,7 +25,8 @@ #include "file_utils.h" #include "rects.h" #include "shader_utils.h" -#include "test/test_utils.h" + +#include "puglutil/test_utils.h" #include "glad/glad.h" diff --git a/examples/pugl_vulkan_cpp_demo.app/MacOS/meson.build b/examples/pugl_vulkan_cpp_demo.app/MacOS/meson.build index d75c75d..08078a0 100644 --- a/examples/pugl_vulkan_cpp_demo.app/MacOS/meson.build +++ b/examples/pugl_vulkan_cpp_demo.app/MacOS/meson.build @@ -9,6 +9,6 @@ executable( ], c_args: example_defines + example_c_args, cpp_args: example_defines + example_cpp_args, - dependencies: [puglpp_dep, pugl_vulkan_dep], + dependencies: [puglpp_dep, pugl_vulkan_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp index 52976e6..16f9778 100644 --- a/examples/pugl_vulkan_cpp_demo.cpp +++ b/examples/pugl_vulkan_cpp_demo.cpp @@ -17,7 +17,8 @@ #include "demo_utils.h" #include "file_utils.h" #include "rects.h" -#include "test/test_utils.h" + +#include "puglutil/test_utils.h" #include "sybok.hpp" diff --git a/examples/pugl_vulkan_demo.app/MacOS/meson.build b/examples/pugl_vulkan_demo.app/MacOS/meson.build index 0d07171..172b8a4 100644 --- a/examples/pugl_vulkan_demo.app/MacOS/meson.build +++ b/examples/pugl_vulkan_demo.app/MacOS/meson.build @@ -8,6 +8,6 @@ executable( '../../file_utils.c', ], c_args: example_defines + example_c_args, - dependencies: [pugl_dep, pugl_vulkan_dep], + dependencies: [pugl_dep, pugl_vulkan_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_vulkan_demo.c b/examples/pugl_vulkan_demo.c index 708a28f..6b9f03d 100644 --- a/examples/pugl_vulkan_demo.c +++ b/examples/pugl_vulkan_demo.c @@ -10,7 +10,8 @@ */ #include "demo_utils.h" -#include "test/test_utils.h" + +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/vulkan.h" diff --git a/examples/pugl_window_demo.app/MacOS/meson.build b/examples/pugl_window_demo.app/MacOS/meson.build index 7bfc219..d1f7b98 100644 --- a/examples/pugl_window_demo.app/MacOS/meson.build +++ b/examples/pugl_window_demo.app/MacOS/meson.build @@ -6,6 +6,6 @@ executable( '../../pugl_window_demo.c', c_args: example_defines + example_c_args, cpp_args: example_defines + example_cpp_args, - dependencies: [pugl_dep, pugl_gl_dep], + dependencies: [pugl_dep, pugl_gl_dep, puglutil_dep], include_directories: include_directories('../../..'), ) diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index 6ae6f8b..757c0f9 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -7,7 +7,8 @@ #include "cube_view.h" #include "demo_utils.h" -#include "test/test_utils.h" + +#include "puglutil/test_utils.h" #include "pugl/gl.h" #include "pugl/pugl.h" diff --git a/meson.build b/meson.build index a84729c..a0df352 100644 --- a/meson.build +++ b/meson.build @@ -470,6 +470,11 @@ 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 diff --git a/test/test_utils.h b/subprojects/puglutil/include/puglutil/test_utils.h index 4ebd985..4ebd985 100644 --- a/test/test_utils.h +++ b/subprojects/puglutil/include/puglutil/test_utils.h diff --git a/subprojects/puglutil/meson.build b/subprojects/puglutil/meson.build new file mode 100644 index 0000000..e7ffece --- /dev/null +++ b/subprojects/puglutil/meson.build @@ -0,0 +1,14 @@ +# Copyright 2025 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +project( + 'puglutil', + ['c'], + license: 'ISC', + meson_version: '>= 0.54.0', + version: '0.0.0', +) + +puglutil_dep = declare_dependency( + include_directories: include_directories(['include']), +) diff --git a/test/meson.build b/test/meson.build index 6bd0aa3..cd95c4a 100644 --- a/test/meson.build +++ b/test/meson.build @@ -57,7 +57,6 @@ if with_timers endif includes = [ - '.', '../include', ] @@ -68,7 +67,7 @@ foreach test : basic_tests 'test_' + test, 'test_@0@.c'.format(test), c_args: test_c_args, - dependencies: [pugl_dep, pugl_stub_dep], + dependencies: [pugl_dep, pugl_stub_dep, puglutil_dep], include_directories: include_directories(includes), ), suite: 'unit', @@ -82,7 +81,7 @@ foreach test : basic_exclusive_tests 'test_' + test, 'test_@0@.c'.format(test), c_args: test_c_args, - dependencies: [pugl_dep, pugl_stub_dep], + dependencies: [pugl_dep, pugl_stub_dep, puglutil_dep], include_directories: include_directories(includes), ), is_parallel: false, @@ -98,7 +97,7 @@ if opengl_dep.found() 'test_' + test, 'test_@0@.c'.format(test), c_args: test_c_args, - dependencies: [pugl_dep, pugl_gl_dep], + dependencies: [pugl_dep, pugl_gl_dep, puglutil_dep], include_directories: include_directories(includes), ), suite: 'unit', @@ -114,7 +113,7 @@ if cairo_dep.found() 'test_' + test, 'test_@0@.c'.format(test), c_args: test_c_args + cairo_args, - dependencies: [pugl_dep, pugl_cairo_dep], + dependencies: [pugl_dep, pugl_cairo_dep, puglutil_dep], include_directories: include_directories(includes), ), suite: 'unit', @@ -130,7 +129,7 @@ if vulkan_dep.found() 'test_' + test, 'test_@0@.c'.format(test), c_args: test_c_args, - dependencies: [pugl_dep, pugl_vulkan_dep], + dependencies: [pugl_dep, pugl_vulkan_dep, puglutil_dep], include_directories: include_directories(includes), ), suite: 'unit', diff --git a/test/test_cairo.c b/test/test_cairo.c index 11d6cce..b96996e 100644 --- a/test/test_cairo.c +++ b/test/test_cairo.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/cairo.h" #include "pugl/pugl.h" diff --git a/test/test_cursor.c b/test/test_cursor.c index 9b0fa66..01b3301 100644 --- a/test/test_cursor.c +++ b/test/test_cursor.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_gl.c b/test/test_gl.c index 8854cad..2747eef 100644 --- a/test/test_gl.c +++ b/test/test_gl.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/gl.h" #include "pugl/pugl.h" diff --git a/test/test_gl_hints.c b/test/test_gl_hints.c index 250136a..9e31548 100644 --- a/test/test_gl_hints.c +++ b/test/test_gl_hints.c @@ -1,13 +1,11 @@ // Copyright 2020 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -/* - Tests that all hints are set to real values after a view is realized. -*/ +// Tests that all hints are set to real values after a view is realized #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/gl.h" #include "pugl/pugl.h" diff --git a/test/test_local_copy_paste.c b/test/test_local_copy_paste.c index 737f193..bfbfc38 100644 --- a/test/test_local_copy_paste.c +++ b/test/test_local_copy_paste.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_realize.c b/test/test_realize.c index 7e37319..561e712 100644 --- a/test/test_realize.c +++ b/test/test_realize.c @@ -11,7 +11,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_redisplay.c b/test/test_redisplay.c index 73fb9b7..19dd812 100644 --- a/test/test_redisplay.c +++ b/test/test_redisplay.c @@ -8,7 +8,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_remote_copy_paste.c b/test/test_remote_copy_paste.c index a9f079e..3f0261b 100644 --- a/test/test_remote_copy_paste.c +++ b/test/test_remote_copy_paste.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_show_hide.c b/test/test_show_hide.c index 1517203..c784ff0 100644 --- a/test/test_show_hide.c +++ b/test/test_show_hide.c @@ -8,7 +8,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_size.c b/test/test_size.c index e3f738a..28bae1d 100644 --- a/test/test_size.c +++ b/test/test_size.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_stub.c b/test/test_stub.c index bd8a0eb..11876f6 100644 --- a/test/test_stub.c +++ b/test/test_stub.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_stub_hints.c b/test/test_stub_hints.c index b7d54e3..b726757 100644 --- a/test/test_stub_hints.c +++ b/test/test_stub_hints.c @@ -7,7 +7,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_timer.c b/test/test_timer.c index 405a5c2..1ad0ee7 100644 --- a/test/test_timer.c +++ b/test/test_timer.c @@ -8,7 +8,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_update.c b/test/test_update.c index c5997ba..3259438 100644 --- a/test/test_update.c +++ b/test/test_update.c @@ -8,7 +8,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_view.c b/test/test_view.c index a6af9f2..b2423aa 100644 --- a/test/test_view.c +++ b/test/test_view.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/stub.h" diff --git a/test/test_vulkan.c b/test/test_vulkan.c index 3a7c612..ae76041 100644 --- a/test/test_vulkan.c +++ b/test/test_vulkan.c @@ -5,7 +5,7 @@ #undef NDEBUG -#include "test_utils.h" +#include "puglutil/test_utils.h" #include "pugl/pugl.h" #include "pugl/vulkan.h" |