Skip to content

Commit 9bd01a2

Browse files
committed
test-case for sources in subdirs
1 parent b96e369 commit 9bd01a2

7 files changed

Lines changed: 78 additions & 0 deletions

File tree

tests/subdir/Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Makefile to build class 'subdir' for Pure Data.
2+
# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build
3+
# settings and rules.
4+
5+
# library name
6+
lib.name = subdir
7+
8+
# input source file (class name == source file basename)
9+
class.sources = src/subdir.c src/subdir~.c
10+
11+
# all extra files to be included in binary distribution of the library
12+
datafiles = subdir-help.pd subdir-meta.pd
13+
14+
# include Makefile.pdlibbuilder
15+
# (for real-world projects see the "Project Management" section
16+
# in tips-tricks.md)
17+
18+
PDLIBBUILDER_DIR=../..
19+
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
20+
cflags+=-DYYY
21+
22+
23+
# simplistic tests whether all expected files have been produced/installed
24+
#buildcheck: all
25+
# test -e subdir.$(extension)
26+
#installcheck: install
27+
# test -e $(installpath)/subdir.$(extension)

tests/subdir/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
subdir
2+
======
3+
4+
pd-lib-builder project that shows how to compile
5+
a library that contains a single C-file in a separate src/ directory,
6+
that is compiled into a single binary containing a subdir Pd-objectclass.
7+
8+
this is a special case of the one-object-per-binary library structure.

tests/subdir/src/subdir.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <m_pd.h>
2+
t_class*subdir_class;
3+
static void subdir_float(t_object*x, t_float f1) {
4+
pd_error(x, "%s got %f", __FUNCTION__, f1);
5+
}
6+
static void*subdir_new(void) {
7+
return pd_new(subdir_class);
8+
}
9+
void subdir_setup(void) {
10+
post("%s", __FUNCTION__);
11+
subdir_class = class_new(gensym("subdir"), subdir_new, 0, sizeof(t_object), 0, A_NULL);
12+
class_addfloat(subdir_class, subdir_float);
13+
}

tests/subdir/src/subdir~.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <m_pd.h>
2+
t_class*subdir_tilde_class;
3+
static void subdir_tilde_float(t_object*x, t_float f1) {
4+
pd_error(x, "%s got %f", __FUNCTION__, f1);
5+
}
6+
static void*subdir_tilde_new(void) {
7+
return pd_new(subdir_tilde_class);
8+
}
9+
void subdir_tilde_setup(void) {
10+
post("%s", __FUNCTION__);
11+
subdir_tilde_class = class_new(gensym("subdir~"), subdir_tilde_new, 0, sizeof(t_object), 0, A_NULL);
12+
class_addfloat(subdir_tilde_class, subdir_tilde_float);
13+
}

tests/subdir/subdir-help.pd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#N canvas 335 160 450 300 12;
2+
#X obj 143 125 subdir;
3+
#X msg 143 93 7;
4+
#X connect 1 0 0 0;

tests/subdir/subdir-meta.pd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#N canvas 966 322 200 200 10;
2+
#N canvas 19 51 420 300 META 0;
3+
#X text 10 10 META this is a prototype of a libdir meta file;
4+
#X text 10 51 AUTHOR IOhannes m zmolnig;
5+
#X text 10 110 VERSION 1.0.0;
6+
#X text 10 90 LICENSE CC0;
7+
#X text 10 70 DESCRIPTION Example "subdir" external.;
8+
#X text 10 30 NAME subdir;
9+
#X restore 10 10 pd META;

tests/subdir/subdir~-help.pd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#N canvas 335 160 450 300 12;
2+
#X obj 143 125 subdir~;
3+
#X msg 143 93 7;
4+
#X connect 1 0 0 0;

0 commit comments

Comments
 (0)