C++ example project
This commit is contained in:
parent
c52b97e770
commit
b975a90c55
6 changed files with 86 additions and 0 deletions
28
tests/multiplexx/Makefile
Normal file
28
tests/multiplexx/Makefile
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Makefile to build class 'multiplexx' for Pure Data.
|
||||
# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build
|
||||
# settings and rules.
|
||||
|
||||
# library name
|
||||
lib.name = multiplexx
|
||||
|
||||
# input source file (class name == source file basename)
|
||||
class.sources = multiplexxA.cpp multiplexxB.c
|
||||
|
||||
# all extra files to be included in binary distribution of the library
|
||||
datafiles = multiplexx-help.pd multiplexx-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
|
||||
|
||||
# simplistic tests whether all expected files have been produced/installed
|
||||
buildcheck: all
|
||||
test -e multiplexxA.$(extension)
|
||||
test -e multiplexxB.$(extension)
|
||||
installcheck: install
|
||||
test -e $(installpath)/multiplexxA.$(extension)
|
||||
test -e $(installpath)/multiplexxB.$(extension)
|
||||
test -e $(installpath)/multiplexx-help.pd
|
||||
test -e $(installpath)/multiplexx-meta.pd
|
||||
8
tests/multiplexx/README.md
Normal file
8
tests/multiplexx/README.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
multiplexx
|
||||
========
|
||||
|
||||
minimal pd-lib-builder project that shows how to compile
|
||||
a library that contains multiplexx C-files that are compiled into
|
||||
multiplexx binaries each containing a different Pd-objectclass.
|
||||
|
||||
this is the general case of the one-object-per-binary library structure.
|
||||
7
tests/multiplexx/multiplexx-help.pd
Normal file
7
tests/multiplexx/multiplexx-help.pd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#N canvas 335 160 450 300 12;
|
||||
#X msg 143 93 7;
|
||||
#X obj 143 125 multiplexxA;
|
||||
#X obj 223 125 multiplexxB;
|
||||
#X msg 223 93 12;
|
||||
#X connect 0 0 1 0;
|
||||
#X connect 3 0 2 0;
|
||||
9
tests/multiplexx/multiplexx-meta.pd
Normal file
9
tests/multiplexx/multiplexx-meta.pd
Normal file
|
|
@ -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 "multiplexx" external.;
|
||||
#X text 10 30 NAME multiplexx;
|
||||
#X restore 10 10 pd META;
|
||||
21
tests/multiplexx/multiplexxA.cpp
Normal file
21
tests/multiplexx/multiplexxA.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include <m_pd.h>
|
||||
#include <iostream>
|
||||
t_class*multiplexxA_class;
|
||||
static void multiplexxA_float(t_object*x, t_float f1) {
|
||||
pd_error(x, "%s got %f", __FUNCTION__, f1);
|
||||
}
|
||||
static void*multiplexxA_new(void) {
|
||||
return pd_new(multiplexxA_class);
|
||||
}
|
||||
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
void multiplexxA_setup(void);
|
||||
}
|
||||
#endif
|
||||
void multiplexxA_setup(void) {
|
||||
std::cerr << __FUNCTION__ << std::endl;
|
||||
multiplexxA_class = class_new(gensym("multiplexxA"), multiplexxA_new, 0, sizeof(t_object), 0, A_NULL);
|
||||
class_addfloat(multiplexxA_class, multiplexxA_float);
|
||||
}
|
||||
|
||||
|
||||
13
tests/multiplexx/multiplexxB.c
Normal file
13
tests/multiplexx/multiplexxB.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include <m_pd.h>
|
||||
t_class*multiplexxB_class;
|
||||
static void multiplexxB_float(t_object*x, t_float f1) {
|
||||
pd_error(x, "%s got %f", __FUNCTION__, f1);
|
||||
}
|
||||
static void*multiplexxB_new(void) {
|
||||
return pd_new(multiplexxB_class);
|
||||
}
|
||||
void multiplexxB_setup(void) {
|
||||
post("%s", __FUNCTION__);
|
||||
multiplexxB_class = class_new(gensym("multiplexxB"), multiplexxB_new, 0, sizeof(t_object), 0, A_NULL);
|
||||
class_addfloat(multiplexxB_class, multiplexxB_float);
|
||||
}
|
||||
Loading…
Reference in a new issue