From df9eb41d68598180bdb532a8fbe5b7bd310796c0 Mon Sep 17 00:00:00 2001 From: katjav Date: Tue, 24 Dec 2019 22:13:20 +0100 Subject: [PATCH 01/39] Add two sections about variables to README.md --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index 187b132..234d469 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,43 @@ Root directory for installation of Pd library directories. Overrides the default install location. +### platform detection and predefined variables ### + + +Makefile.pdlibbuilder tries to detect architecture and operating system in +order to define platform-specific variables. Since v0.6.0 we let the compiler +report target platform, rather than taking the build machine as reference. This +simplifies cross compilation. The kind of build options that are predefined: + +- optimizations useful for realtime DSP processing +- options strictly required for the platform +- options to make the build work accross a range of CPU's and OS versions + +The exact choice and definition predefined variables changes over time, as new +platforms arrive and older platforms become obsolete. The easiest way to get an +overview for your platform is by checking the flags categories in the output of +target `vars`. Variables written in capitals (like `CFLAGS`) are intentionally +exposed as user variables, although technically all makefile variables can be +overridden by make command arguments. + + +### specific language versions ### + + +Makefile.pdlibbuilder handles C and C++, but can not detect if your code uses +features of a specific version (like C99, C++11, C++14 etc.). In such cases +your makefile should specify that version as compiler option: + + cflags = -std=c++11 + +Also you may need to be explicit about minimum OSX version. For example, C++11 +needs OSX 10.9 or higher: + + define forDarwin + cflags = -mmacosx-version-min=10.9 + endef + + ### documentation ### From f087faf44112350cbc4e3809c51ef55aad2c68cd Mon Sep 17 00:00:00 2001 From: katjav Date: Thu, 9 Jan 2020 12:56:50 +0100 Subject: [PATCH 02/39] Improve section about cross compilation in tips-tricks.md Title and text must be more general, but still be specific about cases which we know to work. --- tips-tricks.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tips-tricks.md b/tips-tricks.md index c1795f4..e8a02a2 100644 --- a/tips-tricks.md +++ b/tips-tricks.md @@ -3,14 +3,13 @@ pd-lib-builder cheatsheet # Creating special builds -## cross-compiling on linux x86_64 for other platforms +## building for non-native platform -Using pd-lib-builder >=0.6.0 we can define variable `PLATFORM` to specify a -target triplet for cross-compilation. Example to build W32 binaries (assuming -package `mingw-w64` is installed and a W32 package for Pd is unzipped into a -path `${PDWIN32}`: +Using pd-lib-builder >=0.6.0 we can define variable `PLATFORM` to specify a +target triplet for cross-compilation. Assuming a W32 package for Pd is unzipped +into path `${PDWIN32}`, to build for Windows 32 bit: - make PLATFORM=x86_64-w64-mingw32 PDDIR="${PDWIN32}" + make PLATFORM=i686-w64-mingw32 PDDIR="${PDWIN32}" #### older pd-lib-builder versions @@ -22,16 +21,18 @@ instead override variables `system`, `target.arch`, `CC` and / or `CXX`, #### toolchains -Cross toolchains for relevant platforms in Debian Buster (install g++ -with dependencies for a given platform to get the whole tool chain): +To build for non-native OS and/or architecture you need a cross toolchain. On +Linux such toolchains are relatively easy to get. For example Debian Buster +amd64 provides them for the following platforms (install g++ with dependencies +for a given platform to get the whole toolchain): - `arm-linux-gnueabihf` - `aarch64-linux-gnu` - `i686-linux-gnu` - `i686-w64-mingw32` and `x86_64-w64-mingw32` (install `mingw-w64`) -OSX/MacOS cross tool chains are not distributed by Debian. Use project -`osxcross` from Thomas Poechtraeger to create the tools. +Cross toolchains for OSX/MacOS are not generally distributed. Project +`osxcross` from Thomas Poechtraeger can create them for Linux. ## building double-precision externals From 2da8d220add22a02201a9f79f2f5676fa3ccbcd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 14:39:39 +0100 Subject: [PATCH 03/39] template for building tests --- tests/_template_/Makefile | 16 ++++++++++ tests/_template_/_template_-help.pd | 4 +++ tests/_template_/_template_-meta.pd | 9 ++++++ tests/_template_/_template_.c | 13 ++++++++ tests/make-from-template.sh | 46 +++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 tests/_template_/Makefile create mode 100644 tests/_template_/_template_-help.pd create mode 100644 tests/_template_/_template_-meta.pd create mode 100644 tests/_template_/_template_.c create mode 100755 tests/make-from-template.sh diff --git a/tests/_template_/Makefile b/tests/_template_/Makefile new file mode 100644 index 0000000..3a4de88 --- /dev/null +++ b/tests/_template_/Makefile @@ -0,0 +1,16 @@ +# Makefile to build class 'helloworld' for Pure Data. +# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build +# settings and rules. + +# library name +lib.name = _template_ + +# input source file (class name == source file basename) +class.sources = _template_.c + +# all extra files to be included in binary distribution of the library +datafiles = _template_-help.pd _template_-meta.pd + +# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +PDLIBBUILDER_DIR=../.. +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/_template_/_template_-help.pd b/tests/_template_/_template_-help.pd new file mode 100644 index 0000000..f7f922d --- /dev/null +++ b/tests/_template_/_template_-help.pd @@ -0,0 +1,4 @@ +#N canvas 335 160 450 300 12; +#X obj 143 125 test1; +#X msg 143 93 7; +#X connect 1 0 0 0; diff --git a/tests/_template_/_template_-meta.pd b/tests/_template_/_template_-meta.pd new file mode 100644 index 0000000..7f997bf --- /dev/null +++ b/tests/_template_/_template_-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 "_template_" external.; +#X text 10 30 NAME _template_; +#X restore 10 10 pd META; diff --git a/tests/_template_/_template_.c b/tests/_template_/_template_.c new file mode 100644 index 0000000..ef5293e --- /dev/null +++ b/tests/_template_/_template_.c @@ -0,0 +1,13 @@ +#include +t_class*_template__class; +static void _template__float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*_template__new(void) { + return pd_new(_template__class); +} +void _template__setup(void) { + post("%s", __FUNCTION__); + _template__class = class_new(gensym("_template_"), _template__new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(_template__class, _template__float); +} diff --git a/tests/make-from-template.sh b/tests/make-from-template.sh new file mode 100755 index 0000000..d4f6ade --- /dev/null +++ b/tests/make-from-template.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +template=_template_ +template_dir=${0%/*}/${template} + +outdir=$1 +outdir=${outdir%/} +outname=${outdir##*/} + + +usage() { + cat 1>&2 < + creates a new test-directory from _template_; + must not exist yet. +EOL + if [ "x$@" != "x" ]; then + echo + echo " $@" 1>&2 + fi + exit 1 +} + +if [ "x${outdir}" = "x" ]; then + usage +fi + +if [ -d "${outdir}" ]; then + usage "output directory '${outdir}' already exists!" +fi + +if [ ! -d "${template_dir}" ]; then + echo "unable to find '${template_dir}'" 1>&2 + exit 1 +fi + +mkdir -p "${outdir}" || usage "unable to create '${outdir}'!" +rmdir "${outdir}" +cp -r "${template_dir}" "${outdir}" +find "${outdir}" -type f -exec sed -e "s|${template}|${outname}|g" -i {} + +for f in "${outdir}"/*; do + g=$(echo $f | sed -e "s|${template}|${outname}|g") + if [ "x${f}" != "x${g}" ]; then + mv "${f}" "${g}" + fi +done From 968558f9f2e30d133154b956669085d039e96b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 14:48:46 +0100 Subject: [PATCH 04/39] Makefile to recursively build all subdirs --- tests/Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/Makefile diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..6226db3 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,16 @@ +# recursively build all example projects in the subdirectories + +projects := $(filter-out _%, $(dir $(wildcard */Makefile))) + +all: $(projects:%=%-build) +clean: $(projects:%=%-clean) +install: $(projects:%=%-install) +projects: + @echo $(projects) + +%-build: %/Makefile + $(MAKE) -C $( Date: Wed, 4 Mar 2020 15:01:27 +0100 Subject: [PATCH 05/39] fix description in template Makefile --- tests/_template_/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_template_/Makefile b/tests/_template_/Makefile index 3a4de88..d0bb5bd 100644 --- a/tests/_template_/Makefile +++ b/tests/_template_/Makefile @@ -1,4 +1,4 @@ -# Makefile to build class 'helloworld' for Pure Data. +# Makefile to build class '_template_' for Pure Data. # Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build # settings and rules. From 5c2b6d291069f288a24f909979bbb947636f8c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 15:04:57 +0100 Subject: [PATCH 06/39] fixed object-name in template --- tests/_template_/_template_-help.pd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_template_/_template_-help.pd b/tests/_template_/_template_-help.pd index f7f922d..94425c6 100644 --- a/tests/_template_/_template_-help.pd +++ b/tests/_template_/_template_-help.pd @@ -1,4 +1,4 @@ #N canvas 335 160 450 300 12; -#X obj 143 125 test1; +#X obj 143 125 _template_; #X msg 143 93 7; #X connect 1 0 0 0; From b8763a8e4be11c76d49c9a787aa85cfd3674e138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 15:14:40 +0100 Subject: [PATCH 07/39] first examples: single object, multitple objects, multiobject-library --- tests/multilib/Makefile | 21 +++++++++++++++++++++ tests/multilib/multilib-help.pd | 7 +++++++ tests/multilib/multilib-meta.pd | 9 +++++++++ tests/multilib/multilib.c | 8 ++++++++ tests/multilib/multilibA.c | 13 +++++++++++++ tests/multilib/multilibB.c | 13 +++++++++++++ tests/multiple/Makefile | 16 ++++++++++++++++ tests/multiple/multiple-help.pd | 7 +++++++ tests/multiple/multiple-meta.pd | 9 +++++++++ tests/multiple/multipleA.c | 13 +++++++++++++ tests/multiple/multipleB.c | 13 +++++++++++++ tests/single/Makefile | 16 ++++++++++++++++ tests/single/single-help.pd | 4 ++++ tests/single/single-meta.pd | 9 +++++++++ tests/single/single.c | 13 +++++++++++++ 15 files changed, 171 insertions(+) create mode 100644 tests/multilib/Makefile create mode 100644 tests/multilib/multilib-help.pd create mode 100644 tests/multilib/multilib-meta.pd create mode 100644 tests/multilib/multilib.c create mode 100644 tests/multilib/multilibA.c create mode 100644 tests/multilib/multilibB.c create mode 100644 tests/multiple/Makefile create mode 100644 tests/multiple/multiple-help.pd create mode 100644 tests/multiple/multiple-meta.pd create mode 100644 tests/multiple/multipleA.c create mode 100644 tests/multiple/multipleB.c create mode 100644 tests/single/Makefile create mode 100644 tests/single/single-help.pd create mode 100644 tests/single/single-meta.pd create mode 100644 tests/single/single.c diff --git a/tests/multilib/Makefile b/tests/multilib/Makefile new file mode 100644 index 0000000..abf0663 --- /dev/null +++ b/tests/multilib/Makefile @@ -0,0 +1,21 @@ +# Makefile to build class 'multilib' for Pure Data. +# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build +# settings and rules. + +# library name +lib.name = multilib + +make-lib-executable=yes + +# input source file (class name == source file basename) +class.sources = multilibA.c multilibB.c + +# glue for building a multi-object library +lib.setup.sources = $(lib.name).c + +# all extra files to be included in binary distribution of the library +datafiles = multilib-help.pd multilib-meta.pd + +# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +PDLIBBUILDER_DIR=../.. +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/multilib/multilib-help.pd b/tests/multilib/multilib-help.pd new file mode 100644 index 0000000..caaf6d9 --- /dev/null +++ b/tests/multilib/multilib-help.pd @@ -0,0 +1,7 @@ +#N canvas 335 160 450 300 12; +#X msg 143 93 7; +#X obj 143 125 multilibA; +#X obj 223 125 multilibB; +#X msg 223 93 12; +#X connect 0 0 1 0; +#X connect 3 0 2 0; diff --git a/tests/multilib/multilib-meta.pd b/tests/multilib/multilib-meta.pd new file mode 100644 index 0000000..ef08c03 --- /dev/null +++ b/tests/multilib/multilib-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 "multiple" external.; +#X text 10 30 NAME multiple; +#X restore 10 10 pd META; diff --git a/tests/multilib/multilib.c b/tests/multilib/multilib.c new file mode 100644 index 0000000..4799e85 --- /dev/null +++ b/tests/multilib/multilib.c @@ -0,0 +1,8 @@ + +void multilibA_setup(void); +void multilibB_setup(void); + +void multlib_setup(void) { + multilibA_setup(); + multilibB_setup(); +} diff --git a/tests/multilib/multilibA.c b/tests/multilib/multilibA.c new file mode 100644 index 0000000..4760746 --- /dev/null +++ b/tests/multilib/multilibA.c @@ -0,0 +1,13 @@ +#include +t_class*multilibA_class; +static void multilibA_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*multilibA_new(void) { + return pd_new(multilibA_class); +} +void multilibA_setup(void) { + post("%s", __FUNCTION__); + multilibA_class = class_new(gensym("multilibA"), multilibA_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multilibA_class, multilibA_float); +} diff --git a/tests/multilib/multilibB.c b/tests/multilib/multilibB.c new file mode 100644 index 0000000..ce7c4d8 --- /dev/null +++ b/tests/multilib/multilibB.c @@ -0,0 +1,13 @@ +#include +t_class*multilibB_class; +static void multilibB_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*multilibB_new(void) { + return pd_new(multilibB_class); +} +void multilibB_setup(void) { + post("%s", __FUNCTION__); + multilibB_class = class_new(gensym("multilibB"), multilibB_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multilibB_class, multilibB_float); +} diff --git a/tests/multiple/Makefile b/tests/multiple/Makefile new file mode 100644 index 0000000..a79d6ea --- /dev/null +++ b/tests/multiple/Makefile @@ -0,0 +1,16 @@ +# Makefile to build class 'multiple' for Pure Data. +# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build +# settings and rules. + +# library name +lib.name = multiple + +# input source file (class name == source file basename) +class.sources = multipleA.c multipleB.c + +# all extra files to be included in binary distribution of the library +datafiles = multiple-help.pd multiple-meta.pd + +# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +PDLIBBUILDER_DIR=../.. +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/multiple/multiple-help.pd b/tests/multiple/multiple-help.pd new file mode 100644 index 0000000..0e4a43e --- /dev/null +++ b/tests/multiple/multiple-help.pd @@ -0,0 +1,7 @@ +#N canvas 335 160 450 300 12; +#X msg 143 93 7; +#X obj 143 125 multipleA; +#X obj 223 125 multipleB; +#X msg 223 93 12; +#X connect 0 0 1 0; +#X connect 3 0 2 0; diff --git a/tests/multiple/multiple-meta.pd b/tests/multiple/multiple-meta.pd new file mode 100644 index 0000000..ef08c03 --- /dev/null +++ b/tests/multiple/multiple-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 "multiple" external.; +#X text 10 30 NAME multiple; +#X restore 10 10 pd META; diff --git a/tests/multiple/multipleA.c b/tests/multiple/multipleA.c new file mode 100644 index 0000000..dc7bfb0 --- /dev/null +++ b/tests/multiple/multipleA.c @@ -0,0 +1,13 @@ +#include +t_class*multipleA_class; +static void multipleA_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*multipleA_new(void) { + return pd_new(multipleA_class); +} +void multipleA_setup(void) { + post("%s", __FUNCTION__); + multipleA_class = class_new(gensym("multipleA"), multipleA_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multipleA_class, multipleA_float); +} diff --git a/tests/multiple/multipleB.c b/tests/multiple/multipleB.c new file mode 100644 index 0000000..aaf50ba --- /dev/null +++ b/tests/multiple/multipleB.c @@ -0,0 +1,13 @@ +#include +t_class*multipleB_class; +static void multipleB_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*multipleB_new(void) { + return pd_new(multipleB_class); +} +void multipleB_setup(void) { + post("%s", __FUNCTION__); + multipleB_class = class_new(gensym("multipleB"), multipleB_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multipleB_class, multipleB_float); +} diff --git a/tests/single/Makefile b/tests/single/Makefile new file mode 100644 index 0000000..2dd8090 --- /dev/null +++ b/tests/single/Makefile @@ -0,0 +1,16 @@ +# Makefile to build class 'single' for Pure Data. +# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build +# settings and rules. + +# library name +lib.name = single + +# input source file (class name == source file basename) +class.sources = single.c + +# all extra files to be included in binary distribution of the library +datafiles = single-help.pd single-meta.pd + +# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +PDLIBBUILDER_DIR=../.. +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/single/single-help.pd b/tests/single/single-help.pd new file mode 100644 index 0000000..f7f922d --- /dev/null +++ b/tests/single/single-help.pd @@ -0,0 +1,4 @@ +#N canvas 335 160 450 300 12; +#X obj 143 125 test1; +#X msg 143 93 7; +#X connect 1 0 0 0; diff --git a/tests/single/single-meta.pd b/tests/single/single-meta.pd new file mode 100644 index 0000000..57923af --- /dev/null +++ b/tests/single/single-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 "single" external.; +#X text 10 30 NAME single; +#X restore 10 10 pd META; diff --git a/tests/single/single.c b/tests/single/single.c new file mode 100644 index 0000000..a35f10c --- /dev/null +++ b/tests/single/single.c @@ -0,0 +1,13 @@ +#include +t_class*single_class; +static void single_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*single_new(void) { + return pd_new(single_class); +} +void single_setup(void) { + post("%s", __FUNCTION__); + single_class = class_new(gensym("single"), single_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(single_class, single_float); +} From 64140c7f69c673e9db47299171fe3109e7b2ddd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 15:26:04 +0100 Subject: [PATCH 08/39] added 'buildcheck/installcheck targets --- tests/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 6226db3..6eeab1a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -3,8 +3,11 @@ projects := $(filter-out _%, $(dir $(wildcard */Makefile))) all: $(projects:%=%-build) -clean: $(projects:%=%-clean) +buildcheck: $(projects:%=%-buildcheck) install: $(projects:%=%-install) +installcheck: $(projects:%=%-installcheck) +clean: $(projects:%=%-clean) + projects: @echo $(projects) @@ -14,3 +17,7 @@ projects: $(MAKE) -C $( Date: Wed, 4 Mar 2020 15:35:17 +0100 Subject: [PATCH 09/39] added buildcheck/installcheck --- tests/multilib/Makefile | 9 +++++++++ tests/multiple/Makefile | 10 ++++++++++ tests/single/Makefile | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/tests/multilib/Makefile b/tests/multilib/Makefile index abf0663..e34227c 100644 --- a/tests/multilib/Makefile +++ b/tests/multilib/Makefile @@ -19,3 +19,12 @@ datafiles = multilib-help.pd multilib-meta.pd # include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder + + +# simplistic tests whether all expected files have been produced/installed +buildcheck: all + test -e multilib.$(extension) +installcheck: install + test -e $(installpath)/multilib.$(extension) + test -e $(installpath)/multilib-help.pd + test -e $(installpath)/multilib-meta.pd diff --git a/tests/multiple/Makefile b/tests/multiple/Makefile index a79d6ea..2e045c0 100644 --- a/tests/multiple/Makefile +++ b/tests/multiple/Makefile @@ -14,3 +14,13 @@ datafiles = multiple-help.pd multiple-meta.pd # include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder + +# simplistic tests whether all expected files have been produced/installed +buildcheck: all + test -e multipleA.$(extension) + test -e multipleB.$(extension) +installcheck: install + test -e $(installpath)/multipleA.$(extension) + test -e $(installpath)/multipleB.$(extension) + test -e $(installpath)/multiple-help.pd + test -e $(installpath)/multiple-meta.pd diff --git a/tests/single/Makefile b/tests/single/Makefile index 2dd8090..8ae70f7 100644 --- a/tests/single/Makefile +++ b/tests/single/Makefile @@ -14,3 +14,9 @@ datafiles = single-help.pd single-meta.pd # include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder + +# simplistic tests whether all expected files have been produced/installed +buildcheck: all + test -e single.$(extension) +installcheck: install + test -e $(installpath)/single.$(extension) From 22d9ae409b4a0a3489b7ceb2a6349cff5934b1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 15:35:58 +0100 Subject: [PATCH 10/39] multifor: extended libraries with 'define for' --- tests/multifor/Makefile | 37 +++++++++++++++++++++++++++++++++ tests/multifor/multifor-help.pd | 7 +++++++ tests/multifor/multifor-meta.pd | 9 ++++++++ tests/multifor/multiforA.c | 13 ++++++++++++ tests/multifor/multiforB.c | 13 ++++++++++++ 5 files changed, 79 insertions(+) create mode 100644 tests/multifor/Makefile create mode 100644 tests/multifor/multifor-help.pd create mode 100644 tests/multifor/multifor-meta.pd create mode 100644 tests/multifor/multiforA.c create mode 100644 tests/multifor/multiforB.c diff --git a/tests/multifor/Makefile b/tests/multifor/Makefile new file mode 100644 index 0000000..3f44d67 --- /dev/null +++ b/tests/multifor/Makefile @@ -0,0 +1,37 @@ +# Makefile to build class 'multifor' for Pure Data. +# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build +# settings and rules. + +# library name +lib.name = multifor + +# input source file (class name == source file basename) +class.sources = multiforA.c + +# additional classes +define forLinux + class.sources += multiforB.c +endef +define forDarwin + class.sources += multiforB.c +endef +define forWindows + class.sources += multiforB.c +endef + +# all extra files to be included in binary distribution of the library +datafiles = multifor-help.pd multifor-meta.pd + +# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +PDLIBBUILDER_DIR=../.. +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder + +# simplistic tests whether all expected files have been produced/installed +buildcheck: all + test -e multiforA.$(extension) + test -e multiforB.$(extension) +installcheck: install + test -e $(installpath)/multiforA.$(extension) + test -e $(installpath)/multiforB.$(extension) + test -e $(installpath)/multifor-help.pd + test -e $(installpath)/multifor-meta.pd diff --git a/tests/multifor/multifor-help.pd b/tests/multifor/multifor-help.pd new file mode 100644 index 0000000..05d9e93 --- /dev/null +++ b/tests/multifor/multifor-help.pd @@ -0,0 +1,7 @@ +#N canvas 335 160 450 300 12; +#X msg 143 93 7; +#X obj 143 125 multiforA; +#X obj 223 125 multiforB; +#X msg 223 93 12; +#X connect 0 0 1 0; +#X connect 3 0 2 0; diff --git a/tests/multifor/multifor-meta.pd b/tests/multifor/multifor-meta.pd new file mode 100644 index 0000000..2c696e3 --- /dev/null +++ b/tests/multifor/multifor-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 "multifor" external.; +#X text 10 30 NAME multifor; +#X restore 10 10 pd META; diff --git a/tests/multifor/multiforA.c b/tests/multifor/multiforA.c new file mode 100644 index 0000000..c52f68c --- /dev/null +++ b/tests/multifor/multiforA.c @@ -0,0 +1,13 @@ +#include +t_class*multiforA_class; +static void multiforA_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*multiforA_new(void) { + return pd_new(multiforA_class); +} +void multiforA_setup(void) { + post("%s", __FUNCTION__); + multiforA_class = class_new(gensym("multiforA"), multiforA_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multiforA_class, multiforA_float); +} diff --git a/tests/multifor/multiforB.c b/tests/multifor/multiforB.c new file mode 100644 index 0000000..74618ea --- /dev/null +++ b/tests/multifor/multiforB.c @@ -0,0 +1,13 @@ +#include +t_class*multiforB_class; +static void multiforB_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); +} +static void*multiforB_new(void) { + return pd_new(multiforB_class); +} +void multiforB_setup(void) { + post("%s", __FUNCTION__); + multiforB_class = class_new(gensym("multiforB"), multiforB_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multiforB_class, multiforB_float); +} From 3b3b5d283949be29d914e7eae1794ac93577b42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 15:45:01 +0100 Subject: [PATCH 11/39] a library that uses shared resources --- tests/multishared/Makefile | 31 +++++++++++++++++++++++++++ tests/multishared/multishared-help.pd | 7 ++++++ tests/multishared/multishared-meta.pd | 9 ++++++++ tests/multishared/multishared.h | 3 +++ tests/multishared/multisharedA.c | 14 ++++++++++++ tests/multishared/multisharedB.c | 14 ++++++++++++ tests/multishared/shared.c | 5 +++++ 7 files changed, 83 insertions(+) create mode 100644 tests/multishared/Makefile create mode 100644 tests/multishared/multishared-help.pd create mode 100644 tests/multishared/multishared-meta.pd create mode 100644 tests/multishared/multishared.h create mode 100644 tests/multishared/multisharedA.c create mode 100644 tests/multishared/multisharedB.c create mode 100644 tests/multishared/shared.c diff --git a/tests/multishared/Makefile b/tests/multishared/Makefile new file mode 100644 index 0000000..745f3a8 --- /dev/null +++ b/tests/multishared/Makefile @@ -0,0 +1,31 @@ +# Makefile to build class 'multishared' for Pure Data. +# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build +# settings and rules. + +# library name +lib.name = multishared + +# common functions +shared.sources = shared.c + +# input source file (class name == source file basename) +class.sources = multisharedA.c multisharedB.c + +# all extra files to be included in binary distribution of the library +datafiles = multishared-help.pd multishared-meta.pd + +# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +PDLIBBUILDER_DIR=../.. +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder + +# simplistic tests whether all expected files have been produced/installed +buildcheck: all + test -e lib$(lib.name).$(shared.extension) + test -e multisharedA.$(extension) + test -e multisharedB.$(extension) +installcheck: install + test -e $(installpath)/lib$(lib.name).$(shared.extension) + test -e $(installpath)/multisharedA.$(extension) + test -e $(installpath)/multisharedB.$(extension) + test -e $(installpath)/multishared-help.pd + test -e $(installpath)/multishared-meta.pd diff --git a/tests/multishared/multishared-help.pd b/tests/multishared/multishared-help.pd new file mode 100644 index 0000000..da18aed --- /dev/null +++ b/tests/multishared/multishared-help.pd @@ -0,0 +1,7 @@ +#N canvas 335 160 450 300 12; +#X msg 143 93 7; +#X obj 143 125 multisharedA; +#X obj 223 125 multisharedB; +#X msg 223 93 12; +#X connect 0 0 1 0; +#X connect 3 0 2 0; diff --git a/tests/multishared/multishared-meta.pd b/tests/multishared/multishared-meta.pd new file mode 100644 index 0000000..088f750 --- /dev/null +++ b/tests/multishared/multishared-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 "multishared" external.; +#X text 10 30 NAME multishared; +#X restore 10 10 pd META; diff --git a/tests/multishared/multishared.h b/tests/multishared/multishared.h new file mode 100644 index 0000000..2e7712a --- /dev/null +++ b/tests/multishared/multishared.h @@ -0,0 +1,3 @@ +#include + +void multishared_foo(t_float f); diff --git a/tests/multishared/multisharedA.c b/tests/multishared/multisharedA.c new file mode 100644 index 0000000..9e8ae57 --- /dev/null +++ b/tests/multishared/multisharedA.c @@ -0,0 +1,14 @@ +#include "multishared.h" +t_class*multisharedA_class; +static void multisharedA_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); + multishared_foo(f1); +} +static void*multisharedA_new(void) { + return pd_new(multisharedA_class); +} +void multisharedA_setup(void) { + post("%s", __FUNCTION__); + multisharedA_class = class_new(gensym("multisharedA"), multisharedA_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multisharedA_class, multisharedA_float); +} diff --git a/tests/multishared/multisharedB.c b/tests/multishared/multisharedB.c new file mode 100644 index 0000000..ca7b669 --- /dev/null +++ b/tests/multishared/multisharedB.c @@ -0,0 +1,14 @@ +#include "multishared.h" +t_class*multisharedB_class; +static void multisharedB_float(t_object*x, t_float f1) { + pd_error(x, "%s got %f", __FUNCTION__, f1); + multishared_foo(f1); +} +static void*multisharedB_new(void) { + return pd_new(multisharedB_class); +} +void multisharedB_setup(void) { + post("%s", __FUNCTION__); + multisharedB_class = class_new(gensym("multisharedB"), multisharedB_new, 0, sizeof(t_object), 0, A_NULL); + class_addfloat(multisharedB_class, multisharedB_float); +} diff --git a/tests/multishared/shared.c b/tests/multishared/shared.c new file mode 100644 index 0000000..47284a2 --- /dev/null +++ b/tests/multishared/shared.c @@ -0,0 +1,5 @@ +#include "multishared.h" + +void multishared_foo(t_float f) { + post("%s(%f)", __FUNCTION__, f); +} From ae74bda944d07ea54a063b38e3d6d1cb5e1295c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 20:36:53 +0100 Subject: [PATCH 12/39] fixed typos/omissions/leftovers/... thanks @lucarda --- tests/multilib/multilib-help.pd | 2 ++ tests/multilib/multilib.c | 2 +- tests/single/single-help.pd | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/multilib/multilib-help.pd b/tests/multilib/multilib-help.pd index caaf6d9..fc3931d 100644 --- a/tests/multilib/multilib-help.pd +++ b/tests/multilib/multilib-help.pd @@ -1,7 +1,9 @@ #N canvas 335 160 450 300 12; +#X declare -lib multilib; #X msg 143 93 7; #X obj 143 125 multilibA; #X obj 223 125 multilibB; #X msg 223 93 12; +#X obj 136 47 declare -lib multilib; #X connect 0 0 1 0; #X connect 3 0 2 0; diff --git a/tests/multilib/multilib.c b/tests/multilib/multilib.c index 4799e85..82d0eac 100644 --- a/tests/multilib/multilib.c +++ b/tests/multilib/multilib.c @@ -2,7 +2,7 @@ void multilibA_setup(void); void multilibB_setup(void); -void multlib_setup(void) { +void multilib_setup(void) { multilibA_setup(); multilibB_setup(); } diff --git a/tests/single/single-help.pd b/tests/single/single-help.pd index f7f922d..1d74e5c 100644 --- a/tests/single/single-help.pd +++ b/tests/single/single-help.pd @@ -1,4 +1,4 @@ #N canvas 335 160 450 300 12; -#X obj 143 125 test1; +#X obj 143 125 single; #X msg 143 93 7; #X connect 1 0 0 0; From 00dc51cc11cbaf2d199ab795f738936a75950d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 21:30:10 +0100 Subject: [PATCH 13/39] Added READMEs to the test-cases --- tests/multifor/README.md | 9 +++++++++ tests/multilib/README.md | 8 ++++++++ tests/multiple/README.md | 8 ++++++++ tests/multishared/README.md | 9 +++++++++ tests/single/README.md | 8 ++++++++ 5 files changed, 42 insertions(+) create mode 100644 tests/multifor/README.md create mode 100644 tests/multilib/README.md create mode 100644 tests/multiple/README.md create mode 100644 tests/multishared/README.md create mode 100644 tests/single/README.md diff --git a/tests/multifor/README.md b/tests/multifor/README.md new file mode 100644 index 0000000..6b336c7 --- /dev/null +++ b/tests/multifor/README.md @@ -0,0 +1,9 @@ +multifor +======== + +minimal pd-lib-builder project that shows how to compile +a library that contains multiple C-files that are compiled into +multiple binaries each containing a different Pd-objectclass. +some of the objectclasses are only compiled on specific platforms. + +this is a special case of the one-object-per-binary library structure. diff --git a/tests/multilib/README.md b/tests/multilib/README.md new file mode 100644 index 0000000..4a80535 --- /dev/null +++ b/tests/multilib/README.md @@ -0,0 +1,8 @@ +multilib +======== + +minimal pd-lib-builder project that shows how to compile +a library that contains multiple C-files that are compiled into +a single binary containing different Pd-objectclasses. + +this is the general case of the single-binary library structure. diff --git a/tests/multiple/README.md b/tests/multiple/README.md new file mode 100644 index 0000000..04c8c97 --- /dev/null +++ b/tests/multiple/README.md @@ -0,0 +1,8 @@ +multiple +======== + +minimal pd-lib-builder project that shows how to compile +a library that contains multiple C-files that are compiled into +multiple binaries each containing a different Pd-objectclass. + +this is the general case of the one-object-per-binary library structure. diff --git a/tests/multishared/README.md b/tests/multishared/README.md new file mode 100644 index 0000000..85bc79b --- /dev/null +++ b/tests/multishared/README.md @@ -0,0 +1,9 @@ +multishared +=========== + +minimal pd-lib-builder project that shows how to compile +a library that contains multiple C-files that are compiled into +multiple binaries each containing a different Pd-objectclass. +a local shared library is used for common components. + +this is an extended case of the one-object-per-binary library structure. diff --git a/tests/single/README.md b/tests/single/README.md new file mode 100644 index 0000000..c752acb --- /dev/null +++ b/tests/single/README.md @@ -0,0 +1,8 @@ +single +====== + +minimal pd-lib-builder project that shows how to compile +a library that contains a single C-file that is compiled into +a single binary containing a single Pd-objectclass. + +this is a degenerate case of the one-object-per-binary library structure. From 12c0d1cc87fd0371e6a9ed3dad173e790d030d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 4 Mar 2020 23:06:29 +0100 Subject: [PATCH 14/39] simplified master-test Makefile with pd-lib-builder magic --- tests/Makefile | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 6eeab1a..0d82d64 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,23 +1,12 @@ # recursively build all example projects in the subdirectories -projects := $(filter-out _%, $(dir $(wildcard */Makefile))) -all: $(projects:%=%-build) -buildcheck: $(projects:%=%-buildcheck) -install: $(projects:%=%-install) -installcheck: $(projects:%=%-installcheck) -clean: $(projects:%=%-clean) +makefiledirs := $(filter-out _%, $(dir $(wildcard */Makefile))) + +PDLIBBUILDER_DIR = ../ +include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder + +buildcheck installcheck: $(makefiledirs) projects: - @echo $(projects) - -%-build: %/Makefile - $(MAKE) -C $( Date: Thu, 5 Mar 2020 09:59:59 +0100 Subject: [PATCH 15/39] fix description of how to include the Makefile.pdlibbuilder in real-world projects --- tests/_template_/Makefile | 4 +++- tests/multifor/Makefile | 4 +++- tests/multilib/Makefile | 4 +++- tests/multiple/Makefile | 4 +++- tests/multishared/Makefile | 4 +++- tests/single/Makefile | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/_template_/Makefile b/tests/_template_/Makefile index d0bb5bd..2afaac3 100644 --- a/tests/_template_/Makefile +++ b/tests/_template_/Makefile @@ -11,6 +11,8 @@ class.sources = _template_.c # all extra files to be included in binary distribution of the library datafiles = _template_-help.pd _template_-meta.pd -# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +# include Makefile.pdlibbuilder +# (for real-world projects see the "Project Management" section +# in tips-tricks.md) PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/multifor/Makefile b/tests/multifor/Makefile index 3f44d67..48950f2 100644 --- a/tests/multifor/Makefile +++ b/tests/multifor/Makefile @@ -22,7 +22,9 @@ endef # all extra files to be included in binary distribution of the library datafiles = multifor-help.pd multifor-meta.pd -# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +# include Makefile.pdlibbuilder +# (for real-world projects see the "Project Management" section +# in tips-tricks.md) PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/multilib/Makefile b/tests/multilib/Makefile index e34227c..00f20dc 100644 --- a/tests/multilib/Makefile +++ b/tests/multilib/Makefile @@ -16,7 +16,9 @@ lib.setup.sources = $(lib.name).c # all extra files to be included in binary distribution of the library datafiles = multilib-help.pd multilib-meta.pd -# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +# include Makefile.pdlibbuilder +# (for real-world projects see the "Project Management" section +# in tips-tricks.md) PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/multiple/Makefile b/tests/multiple/Makefile index 2e045c0..eac1412 100644 --- a/tests/multiple/Makefile +++ b/tests/multiple/Makefile @@ -11,7 +11,9 @@ class.sources = multipleA.c multipleB.c # all extra files to be included in binary distribution of the library datafiles = multiple-help.pd multiple-meta.pd -# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +# include Makefile.pdlibbuilder +# (for real-world projects see the "Project Management" section +# in tips-tricks.md) PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/multishared/Makefile b/tests/multishared/Makefile index 745f3a8..59eb807 100644 --- a/tests/multishared/Makefile +++ b/tests/multishared/Makefile @@ -14,7 +14,9 @@ class.sources = multisharedA.c multisharedB.c # all extra files to be included in binary distribution of the library datafiles = multishared-help.pd multishared-meta.pd -# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +# include Makefile.pdlibbuilder +# (for real-world projects see the "Project Management" section +# in tips-tricks.md) PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder diff --git a/tests/single/Makefile b/tests/single/Makefile index 8ae70f7..0d36005 100644 --- a/tests/single/Makefile +++ b/tests/single/Makefile @@ -11,7 +11,9 @@ class.sources = single.c # all extra files to be included in binary distribution of the library datafiles = single-help.pd single-meta.pd -# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' +# include Makefile.pdlibbuilder +# (for real-world projects see the "Project Management" section +# in tips-tricks.md) PDLIBBUILDER_DIR=../.. include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder From c52b97e770c65e64c53e9e8df839c6e1310c2b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 5 Mar 2020 10:05:02 +0100 Subject: [PATCH 16/39] buildcheck/installcheck targets for the _template_ project --- tests/_template_/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/_template_/Makefile b/tests/_template_/Makefile index 2afaac3..ea5fd4f 100644 --- a/tests/_template_/Makefile +++ b/tests/_template_/Makefile @@ -16,3 +16,9 @@ datafiles = _template_-help.pd _template_-meta.pd # 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 _template_.$(extension) +installcheck: install + test -e $(installpath)/_template_.$(extension) From b975a90c55711db1fcfd317ac285431a9dfc18f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 5 Mar 2020 11:25:32 +0100 Subject: [PATCH 17/39] C++ example project --- tests/multiplexx/Makefile | 28 ++++++++++++++++++++++++++++ tests/multiplexx/README.md | 8 ++++++++ tests/multiplexx/multiplexx-help.pd | 7 +++++++ tests/multiplexx/multiplexx-meta.pd | 9 +++++++++ tests/multiplexx/multiplexxA.cpp | 21 +++++++++++++++++++++ tests/multiplexx/multiplexxB.c | 13 +++++++++++++ 6 files changed, 86 insertions(+) create mode 100644 tests/multiplexx/Makefile create mode 100644 tests/multiplexx/README.md create mode 100644 tests/multiplexx/multiplexx-help.pd create mode 100644 tests/multiplexx/multiplexx-meta.pd create mode 100644 tests/multiplexx/multiplexxA.cpp create mode 100644 tests/multiplexx/multiplexxB.c diff --git a/tests/multiplexx/Makefile b/tests/multiplexx/Makefile new file mode 100644 index 0000000..7438f0a --- /dev/null +++ b/tests/multiplexx/Makefile @@ -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 diff --git a/tests/multiplexx/README.md b/tests/multiplexx/README.md new file mode 100644 index 0000000..82aab9b --- /dev/null +++ b/tests/multiplexx/README.md @@ -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. diff --git a/tests/multiplexx/multiplexx-help.pd b/tests/multiplexx/multiplexx-help.pd new file mode 100644 index 0000000..b715d1a --- /dev/null +++ b/tests/multiplexx/multiplexx-help.pd @@ -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; diff --git a/tests/multiplexx/multiplexx-meta.pd b/tests/multiplexx/multiplexx-meta.pd new file mode 100644 index 0000000..10132c9 --- /dev/null +++ b/tests/multiplexx/multiplexx-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 "multiplexx" external.; +#X text 10 30 NAME multiplexx; +#X restore 10 10 pd META; diff --git a/tests/multiplexx/multiplexxA.cpp b/tests/multiplexx/multiplexxA.cpp new file mode 100644 index 0000000..6ee490e --- /dev/null +++ b/tests/multiplexx/multiplexxA.cpp @@ -0,0 +1,21 @@ +#include +#include +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); +} + + diff --git a/tests/multiplexx/multiplexxB.c b/tests/multiplexx/multiplexxB.c new file mode 100644 index 0000000..41cd95a --- /dev/null +++ b/tests/multiplexx/multiplexxB.c @@ -0,0 +1,13 @@ +#include +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); +} From a10a5b50addd655ab8cfe1e0a9c75a6aa3cdd11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 5 Mar 2020 12:15:04 +0100 Subject: [PATCH 18/39] simple 'runcheck' target that tries to open all .pd patches --- tests/Makefile | 3 ++ tests/test-patches.sh | 70 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100755 tests/test-patches.sh diff --git a/tests/Makefile b/tests/Makefile index 0d82d64..dfc84ce 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -8,5 +8,8 @@ include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder buildcheck installcheck: $(makefiledirs) +runcheck: + PDBINDIR=$(PDBINDIR) ./test-patches.sh $(makefiledirs:%=%/*.pd) + projects: @echo $(makefiledirs) diff --git a/tests/test-patches.sh b/tests/test-patches.sh new file mode 100755 index 0000000..0d80177 --- /dev/null +++ b/tests/test-patches.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +## simple script to open patches via Pd, and check for errors +## - each patch is opened separately +## - if an error is encountered, the Pd-printout is displayed +## (else it is suppressed) +## - if any of the patches encountered an error, the script will +## exit with a non-0 code + +if [ "x${PD}" = "x" ]; then + if [ "x${PDBINDIR}" != "x" ]; then + for exe in pd.com pd pd.exe; do + if [ -x "${PDBINDIR}/${exe}" ]; then + PD="${PDBINDIR}/${exe}" + break + fi + done + if [ "x${PD}" = "x" ]; then + echo "WARNING: couldn't find a usable Pd in '${PDBINDIR}'" 1>&2 + fi + fi +fi +if [ "x${PD}" = "x" ]; then + PD=pd +fi +echo "using Pd: ${PD}" + +failed=0 +failed_tests="" +succeeded=0 + +open1patch() { + logfile=$(mktemp) + local patch=$1 + local patchdir=${patch%%/*} + local patchfile=${patch#*/} + patchfile=${patchfile#/} + #echo "INFO: running ${patchfile} in ${patchdir}" + cd "${patchdir}" && \ + ${PD} -batch -nrt -noprefs -nostdpath -open "${patchfile}" -send "pd quit" \ + >"${logfile}" 2>&1 + ret=$? + if grep "error: ... couldn't create" "${logfile}" >/dev/null; then + ret=1 + fi + if [ "x${ret}" != "x0" ]; then + echo "" + cat "${logfile}" + echo "FAILED[$ret]: ${patch}" + else + echo "SUCCEEDED: ${patch}" + fi + rm "${logfile}" + return $ret +} + +for p in "${@}"; do + if (open1patch "${p}"); then + succeeded=$((succeeded+1)) + else + failed=$((failed+1)) + failed_tests="${failed_tests} ${p}" + fi +done + +echo "" +echo "SUCCESS: ${succeeded}" +echo "FAILURE: ${failed}" +test ${failed} -eq 0 || echo "FAILS :${failed_tests}" +test ${failed} -eq 0 From a6975e9104e020bcef3c701a9c11b87642fa11c0 Mon Sep 17 00:00:00 2001 From: katjav Date: Sun, 8 Mar 2020 11:25:43 +0100 Subject: [PATCH 19/39] Reorder makefile sections (evaluate file names after target platform) This solves the issue where platform-dependent class inclusion could not work (#61). Also it seems a more logical order of evaluation in general because binary file extensions are platform- dependent. --- Makefile.pdlibbuilder | 142 +++++++++++++++++++++--------------------- 1 file changed, 70 insertions(+), 72 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 7d6c11c..2f0c536 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -369,78 +369,6 @@ externalsdir ?= .. Makefile.pdlibbuilder = true -################################################################################ -### variables: library name and version ######################################## -################################################################################ - - -# strip possibles spaces from lib.name, they mess up calculated file names -lib.name := $(strip $(lib.name)) - -# if meta file exists, check library version -metafile := $(wildcard $(lib.name)-meta.pd) - -ifdef metafile - lib.version := $(shell sed -n \ - 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' \ - $(metafile)) -endif - - -################################################################################ -### variables: files ########################################################### -################################################################################ - - -#=== sources =================================================================== - - -# (re)define .class.sources using file names in class.sources - -define add-class-source -$(notdir $(basename $v)).class.sources += $v -endef - -$(foreach v, $(class.sources), $(eval $(add-class-source))) - -# derive class names from .class.sources variables -sourcevariables := $(filter %.class.sources, $(.VARIABLES)) -classes := $(basename $(basename $(sourcevariables))) - -# accumulate all source files specified in makefile -classes.sources := $(sort $(foreach v, $(sourcevariables), $($v))) -all.sources := $(classes.sources) $(lib.setup.sources) \ - $(shared.sources) $(common.sources) - - -#=== object files ============================================================== - - -# construct object filenames from all C and C++ source file names -classes.objects := $(addsuffix .o, $(basename $(classes.sources))) -common.objects := $(addsuffix .o, $(basename $(common.sources))) -shared.objects := $(addsuffix .o, $(basename $(shared.sources))) -lib.setup.objects := $(addsuffix .o, $(basename $(lib.setup.sources))) -all.objects = $(classes.objects) $(common.objects) $(shared.objects) \ - $(lib.setup.objects) - - -#=== executables =============================================================== - - -# use recursive variables here because executable extension is not yet known - -# construct class executable names from class names -classes.executables = $(addsuffix .$(extension), $(classes)) - -# construct shared lib executable name if shared sources are defined -ifdef shared.sources - shared.lib = lib$(lib.name).$(shared.extension) -else - shared.lib = -endif - - ################################################################################ ### target platform detection ################################################## ################################################################################ @@ -733,6 +661,76 @@ cxx.ldflags := $(cxx.ldflags) $(ldflags) $(LDFLAGS) cxx.ldlibs := $(cxx.ldlibs) $(ldlibs) +################################################################################ +### variables: library name and version ######################################## +################################################################################ + + +# strip possibles spaces from lib.name, they mess up calculated file names +lib.name := $(strip $(lib.name)) + +# if meta file exists, check library version +metafile := $(wildcard $(lib.name)-meta.pd) + +ifdef metafile + lib.version := $(shell sed -n \ + 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' \ + $(metafile)) +endif + + +################################################################################ +### variables: files ########################################################### +################################################################################ + + +#=== sources =================================================================== + + +# (re)define .class.sources using file names in class.sources + +define add-class-source +$(notdir $(basename $v)).class.sources += $v +endef + +$(foreach v, $(class.sources), $(eval $(add-class-source))) + +# derive class names from .class.sources variables +sourcevariables := $(filter %.class.sources, $(.VARIABLES)) +classes := $(basename $(basename $(sourcevariables))) + +# accumulate all source files specified in makefile +classes.sources := $(sort $(foreach v, $(sourcevariables), $($v))) +all.sources := $(classes.sources) $(lib.setup.sources) \ + $(shared.sources) $(common.sources) + + +#=== object files ============================================================== + + +# construct object filenames from all C and C++ source file names +classes.objects := $(addsuffix .o, $(basename $(classes.sources))) +common.objects := $(addsuffix .o, $(basename $(common.sources))) +shared.objects := $(addsuffix .o, $(basename $(shared.sources))) +lib.setup.objects := $(addsuffix .o, $(basename $(lib.setup.sources))) +all.objects = $(classes.objects) $(common.objects) $(shared.objects) \ + $(lib.setup.objects) + + +#=== executables =============================================================== + + +# construct class executable names from class names +classes.executables := $(addsuffix .$(extension), $(classes)) + +# construct shared lib executable name if shared sources are defined +ifdef shared.sources + shared.lib := lib$(lib.name).$(shared.extension) +else + shared.lib := +endif + + ################################################################################ ### variables: tools ########################################################### ################################################################################ From e2cf0bdce3738846376842e44a13d6ddc14b4bec Mon Sep 17 00:00:00 2001 From: katjav Date: Sun, 8 Mar 2020 20:14:19 +0100 Subject: [PATCH 20/39] Facilitate multiple platform co-installation of shared lib This resolves issue #58 and replaces pull request #59. --- Makefile.pdlibbuilder | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 2f0c536..3cd379f 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -723,9 +723,15 @@ all.objects = $(classes.objects) $(common.objects) $(shared.objects) \ # construct class executable names from class names classes.executables := $(addsuffix .$(extension), $(classes)) -# construct shared lib executable name if shared sources are defined +# Construct shared lib executable name if shared sources are defined. If +# extension and shared extension are not identical, use both to facilitate co- +# installation for different platforms, like .m_i386.dll and .m_amd64.dll. ifdef shared.sources - shared.lib := lib$(lib.name).$(shared.extension) + ifeq ($(extension), $(shared.extension)) + shared.lib = lib$(lib.name).$(shared.extension) + else + shared.lib = lib$(lib.name).$(extension).$(shared.extension) + endif else shared.lib := endif @@ -915,13 +921,13 @@ endif define link-shared $(compile-$1) \ $(shared.ldflags) \ - -o lib$(lib.name).$(shared.extension) $(shared.objects) \ + -o $(shared.lib) $(shared.objects) \ $($1.ldlibs) $(shared.ldlibs) endef # rule for linking objects in shared executable # build recipe is in macro 'link-shared' -lib$(lib.name).$(shared.extension): $(shared.objects) +$(shared.lib): $(shared.objects) $(info ++++ info: linking objects in shared lib $@) $(if $(filter %.cc %.cpp, $(shared.sources)), \ $(call link-shared,cxx), \ From f148feecff0a9e20a5edd644072b16f4f4481a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sun, 8 Mar 2020 22:10:52 +0100 Subject: [PATCH 21/39] drop double-/ as path-delimiter --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index dfc84ce..53b261c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -9,7 +9,7 @@ include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder buildcheck installcheck: $(makefiledirs) runcheck: - PDBINDIR=$(PDBINDIR) ./test-patches.sh $(makefiledirs:%=%/*.pd) + PDBINDIR=$(PDBINDIR) ./test-patches.sh $(makefiledirs:%=%*.pd) projects: @echo $(makefiledirs) From 9b1ba69e7e730314aa475e1e48da7d95d9809af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sun, 8 Mar 2020 22:19:03 +0100 Subject: [PATCH 22/39] take multi-arch extensions for shared-libraries into account when testing --- tests/multishared/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/multishared/Makefile b/tests/multishared/Makefile index 59eb807..9ccb169 100644 --- a/tests/multishared/Makefile +++ b/tests/multishared/Makefile @@ -22,11 +22,19 @@ include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder # simplistic tests whether all expected files have been produced/installed buildcheck: all +ifeq ($(shared.extension), $(extension)) test -e lib$(lib.name).$(shared.extension) +else + test -e lib$(lib.name).$(extension).$(shared.extension) +endif test -e multisharedA.$(extension) test -e multisharedB.$(extension) installcheck: install +ifeq ($(shared.extension), $(extension)) test -e $(installpath)/lib$(lib.name).$(shared.extension) +else + test -e $(installpath)/lib$(lib.name).$(extension).$(shared.extension) +endif test -e $(installpath)/multisharedA.$(extension) test -e $(installpath)/multisharedB.$(extension) test -e $(installpath)/multishared-help.pd From b96e3692e0ab5504a11ed8e32c0e7ec33158609a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Mon, 9 Mar 2020 10:52:41 +0100 Subject: [PATCH 23/39] delete empty lines before EOL --- tests/multiplexx/multiplexxA.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/multiplexx/multiplexxA.cpp b/tests/multiplexx/multiplexxA.cpp index 6ee490e..e18b2f1 100644 --- a/tests/multiplexx/multiplexxA.cpp +++ b/tests/multiplexx/multiplexxA.cpp @@ -17,5 +17,3 @@ void multiplexxA_setup(void) { multiplexxA_class = class_new(gensym("multiplexxA"), multiplexxA_new, 0, sizeof(t_object), 0, A_NULL); class_addfloat(multiplexxA_class, multiplexxA_float); } - - 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 24/39] 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; From 3f45bcc553a3d40ff49bba623267e1e7d2aeffbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 10 Mar 2020 11:59:25 +0100 Subject: [PATCH 25/39] remove accidentally in/excluded stuff --- tests/subdir/Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/subdir/Makefile b/tests/subdir/Makefile index 044f736..c857b70 100644 --- a/tests/subdir/Makefile +++ b/tests/subdir/Makefile @@ -17,11 +17,9 @@ datafiles = subdir-help.pd subdir-meta.pd 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) +buildcheck: all + test -e subdir.$(extension) +installcheck: install + test -e $(installpath)/subdir.$(extension) From 3eb4832aafab591a0a425d186efe1a72ef71f00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 10 Mar 2020 12:18:43 +0100 Subject: [PATCH 26/39] Also test for tilde-object --- tests/subdir/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/subdir/Makefile b/tests/subdir/Makefile index c857b70..ac68c2a 100644 --- a/tests/subdir/Makefile +++ b/tests/subdir/Makefile @@ -21,5 +21,7 @@ include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder # simplistic tests whether all expected files have been produced/installed buildcheck: all test -e subdir.$(extension) + test -e subdir~.$(extension) installcheck: install test -e $(installpath)/subdir.$(extension) + test -e $(installpath)/subdir~.$(extension) From e6cff665a3a30a967c72c382c6fe92bcdedd7b44 Mon Sep 17 00:00:00 2001 From: katjav Date: Wed, 11 Mar 2020 18:39:46 +0100 Subject: [PATCH 27/39] Defer expansion of variable shared.ldflags Fixes issue #64 ("shared.ldflags broken when building with helper-library"), a regression introduced with commit a6975e91 ("Reorder makefile sections"). Name of shared.lib was no longer expanded after reordering sections. --- Makefile.pdlibbuilder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 3cd379f..40160bc 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -493,7 +493,7 @@ ifeq ($(system), Linux) cxx.ldflags := -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags cxx.ldlibs := -lc -lm -lstdc++ shared.extension = so - shared.ldflags := -rdynamic -fPIC -shared -Wl,-soname,$(shared.lib) + shared.ldflags = -rdynamic -fPIC -shared -Wl,-soname,$(shared.lib) endif @@ -648,7 +648,7 @@ depcheck.flags := $(cpp.flags) $(cflags) LDFLAGS := $(arch.ld.flags) # now add the same ld flags to shared dynamic lib -shared.ldflags := $(shared.ldflags) $(LDFLAGS) +shared.ldflags += $(LDFLAGS) # accumulated flags for C compiler / linker c.flags := $(cpp.flags) $(c.flags) $(cflags) $(CFLAGS) From 5c2e137f7a7a03f4007494954ccb3e23753e7807 Mon Sep 17 00:00:00 2001 From: katjav Date: Thu, 15 Dec 2022 16:35:20 +0100 Subject: [PATCH 28/39] Fix broken armv6l platform detection (issue #71) --- Makefile.pdlibbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 40160bc..166be52 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -451,7 +451,7 @@ target.arch := $(firstword $(target.triplet)) # $ gcc -Q --help=target # ARMv6: Raspberry Pi 1st gen, not detectable from target.arch -ifeq ($(shell uname), armv6l) +ifeq ($(shell uname -m), armv6l) arch.c.flags = -march=armv6 -mfpu=vfp -mfloat-abi=hard # ARMv7: Beagle, Udoo, RPi2 etc. From 891fe2bafa5569b2edf7706a744823795a049254 Mon Sep 17 00:00:00 2001 From: danomatika Date: Tue, 30 May 2023 16:13:02 +0200 Subject: [PATCH 29/39] tips: format consistency, correct indentation for sh cmd --- tips-tricks.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tips-tricks.md b/tips-tricks.md index e8a02a2..0a216b0 100644 --- a/tips-tricks.md +++ b/tips-tricks.md @@ -3,7 +3,7 @@ pd-lib-builder cheatsheet # Creating special builds -## building for non-native platform +## Building for non-native platform Using pd-lib-builder >=0.6.0 we can define variable `PLATFORM` to specify a target triplet for cross-compilation. Assuming a W32 package for Pd is unzipped @@ -11,7 +11,7 @@ into path `${PDWIN32}`, to build for Windows 32 bit: make PLATFORM=i686-w64-mingw32 PDDIR="${PDWIN32}" -#### older pd-lib-builder versions +#### Older pd-lib-builder versions Using pd-lib-builder < 0.6.0, in the absence of variable `PLATFORM`, you would instead override variables `system`, `target.arch`, `CC` and / or `CXX`, @@ -19,7 +19,7 @@ instead override variables `system`, `target.arch`, `CC` and / or `CXX`, make system=Windows target.arch=i686 CC=i686-w64-mingw32-gcc STRIP=i686-w64-mingw32-strip PDDIR="${PDWIN32}" -#### toolchains +#### Toolchains To build for non-native OS and/or architecture you need a cross toolchain. On Linux such toolchains are relatively easy to get. For example Debian Buster @@ -34,7 +34,7 @@ for a given platform to get the whole toolchain): Cross toolchains for OSX/MacOS are not generally distributed. Project `osxcross` from Thomas Poechtraeger can create them for Linux. -## building double-precision externals +## Building double-precision externals At the time of writing (2018-02) there is no official Pd that supports double-precision numbers yet. @@ -43,24 +43,21 @@ easily build your externals for 64-bit numbers: make CPPFLAGS="-DPD_FLOATSIZE=64" -## building externals for W64 (64-bit Windows) +## Building externals for W64 (64-bit Windows) At the time of writing (2018-02) there is no official Pd that supports W64 yet. However, if you do get hold of an experimental W64 Pd, you can easily build your externals for this environment with - make CPPFLAGS="-DPD_LONGINTTYPE=__int64" CC=x86_64-w64-mingw32-gcc - + make CPPFLAGS="-DPD_LONGINTTYPE=__int64" CC=x86_64-w64-mingw32-gcc To build a double-precision external for W64, use something like: - make CPPFLAGS="-DPD_LONGINTTYPE=__int64 -DPD_FLOATSIZE=64" CC=x86_64-w64-mingw32-gcc - + make CPPFLAGS="-DPD_LONGINTTYPE=__int64 -DPD_FLOATSIZE=64" CC=x86_64-w64-mingw32-gcc ## TODO universal binaries on OSX - # Project management In general it is advised to put the `Makefile.pdlibbuilder` into a separate @@ -98,6 +95,7 @@ In short, `git subtree` is the better `git submodule`. So here's how to do it: #### Initial setup/check-out + This will create a `pd-lib-builder/` directory containing the full history of the pd-lib-builder repository up to its release `v0.5.0` @@ -109,6 +107,7 @@ This will automatically merge the `pd-lib-builder/` history into your current branch, so everything is ready to go. #### Cloning your repository with the subtree + Nothing special, really. Just clone your repository as always: @@ -117,6 +116,7 @@ git clone https://git.example.org/pd/superbonk~.git ~~~ #### Updating the subtree + Time passes and sooner or later you will find, that there is a shiny new pd-lib-builder with plenty of bugfixes and new features. To update your local copy to pd-lib-builder's current `master`, simply run: @@ -126,6 +126,7 @@ git subtree pull --prefix pd-lib-builder/ https://github.com/pure-data/pd-lib-bu ~~~ #### Pulling the updated subtree into existing clones + Again, nothing special. Just pull as always: @@ -133,8 +134,8 @@ Just pull as always: git pull ~~~ - #### Further reading + More on the power of `git subtree` can be found online - https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844 - https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree @@ -142,8 +143,8 @@ More on the power of `git subtree` can be found online ### ~~`git submodule`~~ [DISCOURAGED] - #### Initial setup/check-out + To add a new submodule to your repository, just run `git submodule add` and commit the changes: @@ -170,6 +171,7 @@ git submodule update ~~~ #### Updating the submodule + Submodules are usually fixed to a given commit in their repository. To update the `pd-lib-builder` submodule to the current `master` do something like: @@ -184,6 +186,7 @@ git commit pd-lib-builder -m "Updated pd-lib-builder to current master" ~~~ #### Pulling the updated submodule into existing clones + After you have pushed the submodule updates in your repository, other clones of the repository can be updated as follows: @@ -213,6 +216,7 @@ git submodule update ~~~ #### Drawbacks + `git submodule` has a number of drawbacks: - it requires special commands to synchronize the submodules, in addition to synching your repository. @@ -228,4 +232,3 @@ git submodule update In general, I would suggest to **avoid** `git submodule`, and instead use the better `git subtree` (above). - From 85b7a71d69e0a699d8c9d2631cb3dc29038c207c Mon Sep 17 00:00:00 2001 From: danomatika Date: Tue, 30 May 2023 16:21:51 +0200 Subject: [PATCH 30/39] tips: filled out macO universal build info (basics) --- tips-tricks.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tips-tricks.md b/tips-tricks.md index 0a216b0..aa132c2 100644 --- a/tips-tricks.md +++ b/tips-tricks.md @@ -56,7 +56,32 @@ To build a double-precision external for W64, use something like: make CPPFLAGS="-DPD_LONGINTTYPE=__int64 -DPD_FLOATSIZE=64" CC=x86_64-w64-mingw32-gcc -## TODO universal binaries on OSX +## Universal binaries on macOS + +The compiler, by default, builds for the native architecture of the build +machine. To make a "universal" multi-arch build, specify the desired +archtectures on the command line using the "arch" pd-lib-builder Makefile +variable. + +For example, to build a "fat" external for both 64-bit Intel and Arm (Apple +Silicon): + + make arch="x86_64 arm64" + +If the build is successful, the compiled architectures in the built external can +be confirmed via the `file` command: + +~~~sh +% file vbap.pd_darwin +vbap.pd_darwin: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64:Mach-O 64-bit bundle arm64] +vbap.pd_darwin (for architecture x86_64): Mach-O 64-bit bundle x86_64 +vbap.pd_darwin (for architecture arm64): Mach-O 64-bit bundle arm64 +~~~ + +Note: The available architectures depend on which macOS version & command line +tools/Xcode combination the build system has. For example, any newer macOS +10.15+ will support both x86_64 (Intel 64-bit) and arm64 (Apple Silicon) while +OSX 10.6 - macOS 10.14 can build for x86_64 and i386 (Intel 32-bit). # Project management From cba03bac01a276d3928b333fc92df93de84756e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 24 Nov 2020 10:51:45 +0100 Subject: [PATCH 31/39] make path to Makefile.pdlibbuilder settable in the example i *really* want to encourage people to use a settable path. it makes packaging a *lot* easier if it is possible to use an upgraded Makefile.pdlibbuilder --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 234d469..41b37fd 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ Makefile.pdlibbuilder at the end of the Makefile. Like so: datafiles = myclass1-help.pd myclass2-help.pd README.txt LICENSE.txt - include Makefile.pdlibbuilder + PDLIBBUILDER_DIR=. + include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder For files in class.sources it is assumed that class name == source file From 82c778b4cfd65b189c961df98d8b4acc1955a15a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 28 Jun 2023 11:10:07 +0200 Subject: [PATCH 32/39] support building multiple flavours without intermediate 'clean' - object-files now encode the extension in their filename (e.g. helloworld.pd_linux.o) this uses the new $(objects.extension) variable - avoid duplicate extensions for shared libraries --- Makefile.pdlibbuilder | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 166be52..4c1fabf 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -683,6 +683,7 @@ endif ### variables: files ########################################################### ################################################################################ +object.extension = $(extension).o #=== sources =================================================================== @@ -709,10 +710,10 @@ all.sources := $(classes.sources) $(lib.setup.sources) \ # construct object filenames from all C and C++ source file names -classes.objects := $(addsuffix .o, $(basename $(classes.sources))) -common.objects := $(addsuffix .o, $(basename $(common.sources))) -shared.objects := $(addsuffix .o, $(basename $(shared.sources))) -lib.setup.objects := $(addsuffix .o, $(basename $(lib.setup.sources))) +classes.objects := $(addsuffix .$(object.extension), $(basename $(classes.sources))) +common.objects := $(addsuffix .$(object.extension), $(basename $(common.sources))) +shared.objects := $(addsuffix .$(object.extension), $(basename $(shared.sources))) +lib.setup.objects := $(addsuffix .$(object.extension), $(basename $(lib.setup.sources))) all.objects = $(classes.objects) $(common.objects) $(shared.objects) \ $(lib.setup.objects) @@ -723,12 +724,13 @@ all.objects = $(classes.objects) $(common.objects) $(shared.objects) \ # construct class executable names from class names classes.executables := $(addsuffix .$(extension), $(classes)) -# Construct shared lib executable name if shared sources are defined. If -# extension and shared extension are not identical, use both to facilitate co- -# installation for different platforms, like .m_i386.dll and .m_amd64.dll. +# Construct shared lib executable name if shared sources are defined. +# If extension does not end with shared extension, use both to facilitate co- +# installation for different platforms, like .m_i386.dll and .linux-amd64-32.so ifdef shared.sources - ifeq ($(extension), $(shared.extension)) - shared.lib = lib$(lib.name).$(shared.extension) + ifneq ($(filter %.$(shared.extension), .$(extension)), ) + # $(extension) already ends with $(shared.extension), no need to duplicate it + shared.lib = lib$(lib.name).$(extension) else shared.lib = lib$(lib.name).$(extension).$(shared.extension) endif @@ -874,8 +876,8 @@ define link-class $(compile-$1) \ $($1.ldflags) $($2.class.ldflags) \ -o $2.$(extension) \ - $(addsuffix .o, $(basename $($2.class.sources))) \ - $(addsuffix .o, $(basename $(common.sources))) \ + $(addsuffix .$(object.extension), $(basename $($2.class.sources))) \ + $(addsuffix .$(object.extension), $(basename $(common.sources))) \ $($1.ldlibs) $($2.class.ldlibs) $(shared.lib) endef @@ -949,13 +951,13 @@ endef # Three rules to create .o files. These are double colon 'terminal' rules, # meaning they are the last in a rules chain. -%.o:: %.c +%.$(object.extension):: %.c $(call make-object-file,c) -%.o:: %.cc +%.$(object.extension):: %.cc $(call make-object-file,cxx) -%.o:: %.cpp +%.$(object.extension):: %.cpp $(call make-object-file,cxx) @@ -974,8 +976,8 @@ endef # declare explicit prerequisites rule like 'class.extension: object1.o object2.o' # argument $v is class basename define declare-class-executable-target -$v.$(extension): $(addsuffix .o, $(basename $($v.class.sources))) \ - $(addsuffix .o, $(basename $(common.sources))) +$v.$(extension): $(addsuffix .$(object.extension), $(basename $($v.class.sources))) \ + $(addsuffix .$(object.extension), $(basename $(common.sources))) endef # evaluate explicit prerequisite rules for all classes @@ -1005,7 +1007,7 @@ endif # argument $1 is input source file(s) # dir is explicitly added because option -MM strips it by default define declare-object-target -$(dir $1)$(filter %.o: %.h, $(shell $(CPP) $(depcheck.flags) -MM $1)) $(MAKEFILE_LIST) +$(dir $1)$(patsubst %.o:,%.$(object.extension):,$(filter %.o: %.h, $(shell $(CPP) $(depcheck.flags) -MM $1))) $(MAKEFILE_LIST) endef # evaluate implicit prerequisite rules when rebuilding everything From a54f4e4e207d7756fea3b4ddc7a8a3ea3e9fdb89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 28 Jun 2023 12:35:22 +0200 Subject: [PATCH 33/39] add 'floatsize' variable for building double-precision externals --- Makefile.pdlibbuilder | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 4c1fabf..32c9543 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -442,6 +442,14 @@ target.arch := $(firstword $(target.triplet)) ### variables per platform ##################################################### ################################################################################ +#=== flags per floatsize == ==================================================== +floatsize = 32 +ifneq ($(filter-out 32,$(floatsize)),) + floatsize.flags = -DPD_FLOATSIZE=$(floatsize) +else + floatsize.flags = +endif + #=== flags per architecture ==================================================== @@ -584,14 +592,14 @@ ifeq ($(system), Windows) extension = dll c.flags := c.ldflags := -static-libgcc -shared \ - -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" + -Wl,--enable-auto-import "$(PDBINDIR)/pd$(filter-out 32,$(floatsize)).dll" c.ldlibs := cxx.flags := -fcheck-new cxx.ldflags := -static-libgcc -static-libstdc++ -shared \ - -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" + -Wl,--enable-auto-import "$(PDBINDIR)/pd$(filter-out 32,$(floatsize)).dll" cxx.ldlibs := shared.extension = dll - shared.ldflags := -static-libgcc -shared "$(PDBINDIR)/pd.dll" + shared.ldflags := -static-libgcc -shared "$(PDBINDIR)/pd$(filter-out 32,$(floatsize)).dll" stripflags = --strip-all endif @@ -639,7 +647,7 @@ endif CFLAGS = $(warn.flags) $(optimization.flags) $(arch.c.flags) # preprocessor flags -cpp.flags := -DPD -I "$(PDINCLUDEDIR)" $(cpp.flags) $(CPPFLAGS) +cpp.flags := -DPD -I "$(PDINCLUDEDIR)" $(floatsize.flags) $(cpp.flags) $(CPPFLAGS) # flags for dependency checking (cflags from makefile may define -I options) depcheck.flags := $(cpp.flags) $(cflags) @@ -792,7 +800,7 @@ endif # store path to pd.dll; if not found, ls will give a useful error ifeq ($(system), Windows) - pddll := $(shell ls "$(PDBINDIR)/pd.dll") + pddll := $(shell ls "$(PDBINDIR)/pd$(filter-out 32,$(floatsize)).dll") endif # when making target all, check if m_pd.h is found and print info about it From 4b6743cda5cfd6d80a946dc2671e8c6a72241d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 28 Jun 2023 12:35:37 +0200 Subject: [PATCH 34/39] document 'extension' and 'floatsize' variables --- Makefile.pdlibbuilder | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 32c9543..1f7a6e3 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -102,6 +102,8 @@ version = 0.6.0 # Optional user variables for make command line or environment: # # - PLATFORM +# - extension +# - floatsize # # Deprecated path variables: # @@ -205,6 +207,19 @@ version = 0.6.0 # will then be autodefined accordingly. In most cases no other variables need to # be overridden. # +# extension: +# Extension for the external to use. Example: m_amd64 +# A sane default is picked, but it is useful if you want to provide +# co-installable externals for multiple platforms (for the same operating +# systems) +# +# floatsize: +# the size of the t_float in bits. Example: 32 +# t_float are usually single precision (32bit), which is the default. +# For double precision use floatsize=64 +# When building double precision externals, you will want to set the extension +# as well, e.g. extension=windows-amd64-64.dll (--.) +# # CPPFLAGS: # Preprocessor flags which are not strictly required for building. # From 6f302802754d2c90e16fd2fa90853966cd096df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 6 Jul 2023 10:14:53 +0200 Subject: [PATCH 35/39] Drop section about building externals for W64 Pd has supported Win64 for quite some time, there's nothing special anymore --- tips-tricks.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tips-tricks.md b/tips-tricks.md index aa132c2..7c7c59b 100644 --- a/tips-tricks.md +++ b/tips-tricks.md @@ -43,19 +43,6 @@ easily build your externals for 64-bit numbers: make CPPFLAGS="-DPD_FLOATSIZE=64" -## Building externals for W64 (64-bit Windows) - -At the time of writing (2018-02) there is no official Pd that supports -W64 yet. -However, if you do get hold of an experimental W64 Pd, you can -easily build your externals for this environment with - - make CPPFLAGS="-DPD_LONGINTTYPE=__int64" CC=x86_64-w64-mingw32-gcc - -To build a double-precision external for W64, use something like: - - make CPPFLAGS="-DPD_LONGINTTYPE=__int64 -DPD_FLOATSIZE=64" CC=x86_64-w64-mingw32-gcc - ## Universal binaries on macOS The compiler, by default, builds for the native architecture of the build From aaab76aa9a81539a55df3850d04c3ef71a33f0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 6 Jul 2023 10:19:22 +0200 Subject: [PATCH 36/39] Update documentation on building double-precision externals --- tips-tricks.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tips-tricks.md b/tips-tricks.md index 7c7c59b..2c5bd3d 100644 --- a/tips-tricks.md +++ b/tips-tricks.md @@ -34,15 +34,6 @@ for a given platform to get the whole toolchain): Cross toolchains for OSX/MacOS are not generally distributed. Project `osxcross` from Thomas Poechtraeger can create them for Linux. -## Building double-precision externals - -At the time of writing (2018-02) there is no official Pd that supports -double-precision numbers yet. -However, if you do get hold of an experimental double-precision Pd, you can -easily build your externals for 64-bit numbers: - - make CPPFLAGS="-DPD_FLOATSIZE=64" - ## Universal binaries on macOS The compiler, by default, builds for the native architecture of the build @@ -70,6 +61,26 @@ tools/Xcode combination the build system has. For example, any newer macOS 10.15+ will support both x86_64 (Intel 64-bit) and arm64 (Apple Silicon) while OSX 10.6 - macOS 10.14 can build for x86_64 and i386 (Intel 32-bit). +## Building double-precision externals + +At the time of writing (2023-07-06) there is no official Pd that supports +double-precision numbers yet. +However, if you do get hold of an experimental double-precision Pd, you can +easily build your externals for 64-bit numbers, by passing `floatsize=64` +as an argument to `make`. +Starting with Pd>=0.54, double precision externals use different extensions +from traditional (single-precision) externals. +The extension consists of the OS ("linux", "darwin", "windows"), the CPU +architecture ("amd64" (x86_64), "i386" (x86), "arm64",...) and the floatsize +in bits ("64" for double-precision), followed by the system's native extension +for dynamic libraries (".dll" on Windows, ".so" on macOS/Linux/un*xes). +As of pd-lib-builder==0.7.0, you have to manually pass this extension: + + make floatsize=64 extension=windows-amd64-64.so + make floatsize=64 extension=linux-arm64-64.so + make floatsize=64 extension=darwin-fat-64.so arch="x86_64 arm64" + + # Project management In general it is advised to put the `Makefile.pdlibbuilder` into a separate From 4484e7a38da8f3c80871e7e83ae8aa85eaa3784d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 6 Jul 2023 10:21:48 +0200 Subject: [PATCH 37/39] Update CHANGELOG --- CHANGELOG.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5bdfce6..c432148 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,13 @@ Changelog for Makefile.pdlibbuilder. +v0.7.0, dated 2023-07-06 +- build double-precision externals with the 'floatsize' variable +- allow building multiple flavours of an external side-by-side (#78) +- facilitate multiple platform co-installation of shared lib (#58) +- fix use of shared.ldflags with helper-library (#64) +- fix broken armv6l platform detection (#71) +- improve documentation + v0.6.0, dated 2019-12-21 - detect target platform (OS and architecture) rather than build platform (#55) - introduce optional user variable 'PLATFORM' for cross compilation From f76ac409a20b2276b744a814e9c1ee269f57c45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 6 Jul 2023 10:22:33 +0200 Subject: [PATCH 38/39] Release v0.7.0 --- Makefile.pdlibbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 1f7a6e3..38a1220 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -1,5 +1,5 @@ # Makefile.pdlibbuilder dated 2019-12-21 -version = 0.6.0 +version = 0.7.0 # Helper makefile for Pure Data external libraries. # Written by Katja Vetter March-June 2015 for the public domain. No warranties. From 77525265694bac50ed94c5ef62ebbae680c72ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 6 Jul 2023 10:50:52 +0200 Subject: [PATCH 39/39] tips-and-tricks: windows extension is '.dll' --- tips-tricks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tips-tricks.md b/tips-tricks.md index 2c5bd3d..1835687 100644 --- a/tips-tricks.md +++ b/tips-tricks.md @@ -76,7 +76,7 @@ in bits ("64" for double-precision), followed by the system's native extension for dynamic libraries (".dll" on Windows, ".so" on macOS/Linux/un*xes). As of pd-lib-builder==0.7.0, you have to manually pass this extension: - make floatsize=64 extension=windows-amd64-64.so + make floatsize=64 extension=windows-amd64-64.dll make floatsize=64 extension=linux-arm64-64.so make floatsize=64 extension=darwin-fat-64.so arch="x86_64 arm64"