From 9bd01a2f4100af4ca41cc7acf933d54ed8883896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Mon, 9 Mar 2020 12:17:58 +0100 Subject: [PATCH] test-case for sources in subdirs --- tests/subdir/Makefile | 27 +++++++++++++++++++++++++++ tests/subdir/README.md | 8 ++++++++ tests/subdir/src/subdir.c | 13 +++++++++++++ tests/subdir/src/subdir~.c | 13 +++++++++++++ tests/subdir/subdir-help.pd | 4 ++++ tests/subdir/subdir-meta.pd | 9 +++++++++ tests/subdir/subdir~-help.pd | 4 ++++ 7 files changed, 78 insertions(+) create mode 100644 tests/subdir/Makefile create mode 100644 tests/subdir/README.md create mode 100644 tests/subdir/src/subdir.c create mode 100644 tests/subdir/src/subdir~.c create mode 100644 tests/subdir/subdir-help.pd create mode 100644 tests/subdir/subdir-meta.pd create mode 100644 tests/subdir/subdir~-help.pd diff --git a/tests/subdir/Makefile b/tests/subdir/Makefile new file mode 100644 index 0000000..044f736 --- /dev/null +++ b/tests/subdir/Makefile @@ -0,0 +1,27 @@ +# Makefile to build class 'subdir' for Pure Data. +# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build +# settings and rules. + +# library name +lib.name = subdir + +# input source file (class name == source file basename) +class.sources = src/subdir.c src/subdir~.c + +# all extra files to be included in binary distribution of the library +datafiles = subdir-help.pd subdir-meta.pd + +# include Makefile.pdlibbuilder +# (for real-world projects see the "Project Management" section +# in tips-tricks.md) + +PDLIBBUILDER_DIR=../.. +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder +cflags+=-DYYY + + +# simplistic tests whether all expected files have been produced/installed +#buildcheck: all +# test -e subdir.$(extension) +#installcheck: install +# test -e $(installpath)/subdir.$(extension) diff --git a/tests/subdir/README.md b/tests/subdir/README.md new file mode 100644 index 0000000..e5185e5 --- /dev/null +++ b/tests/subdir/README.md @@ -0,0 +1,8 @@ +subdir +====== + +pd-lib-builder project that shows how to compile +a library that contains a single C-file in a separate src/ directory, +that is compiled into a single binary containing a subdir Pd-objectclass. + +this is a special case of the one-object-per-binary library structure. diff --git a/tests/subdir/src/subdir.c b/tests/subdir/src/subdir.c new file mode 100644 index 0000000..cdcc8ce --- /dev/null +++ b/tests/subdir/src/subdir.c @@ -0,0 +1,13 @@ +#include +t_class*subdir_class; +static void subdir_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*subdir_new(void) { + return pd_new(subdir_class); +} +void subdir_setup(void) { + post("%s", __FUNCTION__); + subdir_class = class_new(gensym("subdir"), subdir_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(subdir_class, subdir_float); +} diff --git a/tests/subdir/src/subdir~.c b/tests/subdir/src/subdir~.c new file mode 100644 index 0000000..ca3ed20 --- /dev/null +++ b/tests/subdir/src/subdir~.c @@ -0,0 +1,13 @@ +#include +t_class*subdir_tilde_class; +static void subdir_tilde_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*subdir_tilde_new(void) { + return pd_new(subdir_tilde_class); +} +void subdir_tilde_setup(void) { + post("%s", __FUNCTION__); + subdir_tilde_class = class_new(gensym("subdir~"), subdir_tilde_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(subdir_tilde_class, subdir_tilde_float); +} diff --git a/tests/subdir/subdir-help.pd b/tests/subdir/subdir-help.pd new file mode 100644 index 0000000..725f149 --- /dev/null +++ b/tests/subdir/subdir-help.pd @@ -0,0 +1,4 @@ +#N canvas 335 160 450 300 12; +#X obj 143 125 subdir; +#X msg 143 93 7; +#X connect 1 0 0 0; diff --git a/tests/subdir/subdir-meta.pd b/tests/subdir/subdir-meta.pd new file mode 100644 index 0000000..3e0b529 --- /dev/null +++ b/tests/subdir/subdir-meta.pd @@ -0,0 +1,9 @@ +#N canvas 966 322 200 200 10; +#N canvas 19 51 420 300 META 0; +#X text 10 10 META this is a prototype of a libdir meta file; +#X text 10 51 AUTHOR IOhannes m zmolnig; +#X text 10 110 VERSION 1.0.0; +#X text 10 90 LICENSE CC0; +#X text 10 70 DESCRIPTION Example "subdir" external.; +#X text 10 30 NAME subdir; +#X restore 10 10 pd META; diff --git a/tests/subdir/subdir~-help.pd b/tests/subdir/subdir~-help.pd new file mode 100644 index 0000000..d3a782b --- /dev/null +++ b/tests/subdir/subdir~-help.pd @@ -0,0 +1,4 @@ +#N canvas 335 160 450 300 12; +#X obj 143 125 subdir~; +#X msg 143 93 7; +#X connect 1 0 0 0;