diff --git a/test/initmain.c b/test/initmain.c index a9a568b4..46ec5ddf 100644 --- a/test/initmain.c +++ b/test/initmain.c @@ -1,8 +1,8 @@ // 10 april 2019 #include #include +#include "lib/thread.h" #include "test.h" -#include "thread.h" // TODO fix up the formatting of testing.c so we can use newlines on the got/want stuff diff --git a/test/lib/meson.build b/test/lib/meson.build new file mode 100644 index 00000000..afa6926c --- /dev/null +++ b/test/lib/meson.build @@ -0,0 +1,51 @@ +# 23 march 2019 + +libui_test_sources += [ + 'lib/testing.c', + 'lib/timer.c', +] + +if libui_OS == 'windows' + libui_test_sources += [ + 'lib/thread_windows.c', + 'lib/timer_windows.c', + ] +else + libui_test_sources += [ + 'lib/thread_darwinunix.c', + 'lib/timer_darwinunix.c' + ] +endif + +libui_test_deps += [ + dependency('threads', + required: true), +] +if libui_OS == 'windows' + libui_test_manifest = 'test.manifest' + if libui_mode == 'static' + libui_test_manifest = 'test.static.manifest' + endif + libui_test_sources += [ + windows.compile_resources('resources.rc', + args: libui_manifest_args, + depend_files: [libui_test_manifest]), + ] + if libui_mode != 'static' + libui_test_deps += [ + meson.get_compiler('c').find_library('kernel32', + required: true), + meson.get_compiler('c').find_library('user32', + required: true), + ] + endif +elif libui_OS == 'darwin' + # do nothing +else + libui_test_deps += [ + # satisfy old versions of glibc + # TODO is this really needed? + meson.get_compiler('c').find_library('rt', + required: false), + ] +endif diff --git a/test/testing.c b/test/lib/testing.c similarity index 100% rename from test/testing.c rename to test/lib/testing.c diff --git a/test/testing.h b/test/lib/testing.h similarity index 100% rename from test/testing.h rename to test/lib/testing.h diff --git a/test/thread.h b/test/lib/thread.h similarity index 100% rename from test/thread.h rename to test/lib/thread.h diff --git a/test/thread_darwinunix.c b/test/lib/thread_darwinunix.c similarity index 100% rename from test/thread_darwinunix.c rename to test/lib/thread_darwinunix.c diff --git a/test/thread_windows.c b/test/lib/thread_windows.c similarity index 100% rename from test/thread_windows.c rename to test/lib/thread_windows.c diff --git a/test/timer.c b/test/lib/timer.c similarity index 100% rename from test/timer.c rename to test/lib/timer.c diff --git a/test/timer.h b/test/lib/timer.h similarity index 100% rename from test/timer.h rename to test/lib/timer.h diff --git a/test/timer_darwinunix.c b/test/lib/timer_darwinunix.c similarity index 100% rename from test/timer_darwinunix.c rename to test/lib/timer_darwinunix.c diff --git a/test/timer_windows.c b/test/lib/timer_windows.c similarity index 100% rename from test/timer_windows.c rename to test/lib/timer_windows.c diff --git a/test/meson.build b/test/meson.build index f20a1b19..6fc094cf 100644 --- a/test/meson.build +++ b/test/meson.build @@ -3,54 +3,11 @@ libui_test_sources = [ 'initmain.c', 'main.c', - 'testing.c', - 'timer.c', ] -if libui_OS == 'windows' - libui_test_sources += [ - 'thread_windows.c', - 'timer_windows.c', - ] -else - libui_test_sources += [ - 'thread_darwinunix.c', - 'timer_darwinunix.c' - ] -endif +libui_test_deps = [] -libui_test_deps = [ - dependency('threads', - required: true), -] -if libui_OS == 'windows' - libui_test_manifest = 'test.manifest' - if libui_mode == 'static' - libui_test_manifest = 'test.static.manifest' - endif - libui_test_sources += [ - windows.compile_resources('resources.rc', - args: libui_manifest_args, - depend_files: [libui_test_manifest]), - ] - if libui_mode != 'static' - libui_test_deps += [ - meson.get_compiler('c').find_library('kernel32', - required: true), - meson.get_compiler('c').find_library('user32', - required: true), - ] - endif -elif libui_OS == 'darwin' - # do nothing -else - libui_test_deps += [ - # satisfy old versions of glibc - # TODO is this really needed? - meson.get_compiler('c').find_library('rt', - required: false), - ] -endif +subdir('lib') # TODO once we upgrade to 0.49.0, add pie: true # TODO once we upgrade to 0.50.0, add protocol: 'exitcode' diff --git a/test/test.h b/test/test.h index 460146f2..ff476012 100644 --- a/test/test.h +++ b/test/test.h @@ -1,7 +1,7 @@ // 28 april 2019 #include "../ui.h" -#include "testing.h" -#include "timer.h" +#include "lib/testing.h" +#include "lib/timer.h" // main.c extern void timeoutMain(void *data);