diff --git a/apf/examples/Makefile b/apf/examples/Makefile index 19d3a41a..ab8fae65 100644 --- a/apf/examples/Makefile +++ b/apf/examples/Makefile @@ -71,13 +71,18 @@ $(PORTAUDIO_STUFF): LDLIBS += -lportaudio $(FFTW_STUFF): LDLIBS += -lfftw3f -# For Puredata stuff see also package.txt +# For Puredata/Max stuff see also package.txt pd: check_flext_path package.txt $(FLEXTPATH)/build.sh pd gcc .PHONY: pd +max: check_flext_path package.txt + $(FLEXTPATH)/build.sh max gcc + +.PHONY: max + check_flext_path: @test -n '$(FLEXTPATH)' || ( echo \"FLEXTPATH\" is empty! ; false ) @test -d '$(FLEXTPATH)' || \ diff --git a/apf/examples/README b/apf/examples/README index f25ccb20..e51fd6ea 100644 --- a/apf/examples/README +++ b/apf/examples/README @@ -4,7 +4,9 @@ Compilation: make -make pd +make pd FLEXTPATH=/path/to/flext + +make max FLEXTPATH=/path/to/flext make mex diff --git a/flext/Makefile b/flext/Makefile index f67037fd..f4bf6818 100644 --- a/flext/Makefile +++ b/flext/Makefile @@ -8,6 +8,7 @@ EXTERNALS ?= ssr_binaural ssr_nfc_hoa ssr_aap ssr_wfs ssr_vbap PD_TARGETS := $(EXTERNALS:%=%_pd) +MAX_TARGETS := $(EXTERNALS:%=%_max) FLEXTPATH ?= /usr/local/src/flext @@ -15,21 +16,30 @@ all: pd pd: $(PD_TARGETS) +max: $(MAX_TARGETS) + %_pd: %.cpp check_flext_path NAME='$(@:%_pd=%~)' MAIN_SOURCE='$<' $(FLEXTPATH)/build.sh pd gcc +%_max: %.cpp check_flext_path + NAME='$(@:%_max=%~)' MAIN_SOURCE='$<' $(FLEXTPATH)/build.sh max gcc + check_flext_path: @test -n '$(FLEXTPATH)' || ( echo \"FLEXTPATH\" is empty! ; false ) @test -d '$(FLEXTPATH)' || \ ( echo \"$(FLEXTPATH)\" not found! Set FLEXTPATH! ; false ) -clean: $(EXTERNALS:%=%_pd_clean) +clean: $(EXTERNALS:%=%_pd_clean) $(EXTERNALS:%=%_max_clean) %_pd_clean: check_flext_path NAME='$(@:%_pd_clean=%~)' $(FLEXTPATH)/build.sh pd gcc clean @rmdir pd-linux 2> /dev/null || true -.PHONY: all pd clean check_flext_path +%_max_clean: check_flext_path + NAME='$(@:%_max_clean=%~)' $(FLEXTPATH)/build.sh max gcc clean + @rmdir max-darwin 2> /dev/null || true + +.PHONY: all pd max clean check_flext_path # TODO: When adding $(PD_TARGETS) to .PHONY, it ceases to work ... why? diff --git a/flext/README_Max.md b/flext/README_Max.md new file mode 100644 index 00000000..f467a44f --- /dev/null +++ b/flext/README_Max.md @@ -0,0 +1,107 @@ +Note that the linked libraries (libxml2, libsndfile and flext) and the SSR +external have to be compiled with the same compiler and the same C++ standard +library. +In the following instructions GCC is used for everything. + +* Install homebrew like described on http://brew.sh/ + +* Install the GNU compiler GCC + + brew install gcc + +* Get the Max SDK from https://cycling74.com/downloads/sdk/ + Newer versions might not work with flext, so you should choose an old one, + e.g. version 5.x: http://www.cycling74.com/download/MaxSDK-5.1.7.zip + + flext doesn't support 64-bit yet, see https://github.com/grrrr/flext/pull/10 + +* Unpack the Max SDK to e.g. $HOME/Applications + +* Get flext from Github: https://github.com/grrrr/flext + +* Build flext: + Note: MACOSX_DEPLOYMENT_TARGET=10.6 doesn't work with XCode compiler + + cd flext + export CC=gcc-6 CXX=g++-6 + export MACOSX_DEPLOYMENT_TARGET=10.6 + bash build.sh max gcc + + Change MAXSDKPATH in buildsys/config-mac-max-gcc.txt: + + MAXSDKPATH=$(HOME)/Applications/MaxSDK-5.1.7/c74support + #MAXSDKPATH=$(HOME)/Applications/MaxSDK-6.1.4/c74support + #MAXSDKPATH=$(HOME)/Applications/max-sdk-7.1.0/source/c74support + + In the same file, change INSTPATH, INITPATH and HELPPATH: + + INSTPATH=$(HOME)/Documents/Max\ 7/Library + INITPATH=$(HOME)/Documents/Max\ 7/Library + HELPPATH=$(HOME)/Documents/Max\ 7/Library + + Also change FLEXTPREFIX if you don't want it to be installed to /usr/local. + + Keep ARCH=i386, ...? + + Save the file and run again: + + bash build.sh max gcc + + If necessary, edit config.txt, then run yet again: + + bash build.sh max gcc + + Finally, install it with + + sudo bash build.sh max gcc install + + If $FLEXTPREFIX is writable for your user account (like it typically is when + you use Homebrew), you don't need "sudo". + +* Compile and Install SSR dependencies (using GCC): + + export HOMEBREW_CC=gcc-6 HOMEBREW_CXX=g++-6 + export CFLAGS="-arch i386" + brew install -v --build-from-source libxml2 + brew install -v --build-from-source libsndfile + brew install -v --build-from-source fftw + + We have to build it from source to use the right compiler and standard + library, and we have to use "-arch i386" because the Max SDKs are only +available for that architecture. + + + +making the SSR external: + + +export FLEXTPATH=$HOME/git/flext + + + LDFLAGS: -L/usr/local/opt/libxml2/lib + CPPFLAGS: -I/usr/local/opt/libxml2/include + export PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig + export CC=gcc-6 CXX=g++-6 + export MACOSX_DEPLOYMENT_TARGET=10.6 + + + + + + + + +SDK 7.1.0: +could actually be compiled +after uncommenting the following line in flext/source/flbuf.cpp + + ::object_method((t_object *)p,(t_symbol *)sym_dirty); + +but then, when connecting the external and switching on DSP processing: +msp object need to be updated for msp64 + +SDK 7.0.1 with XCode and command line tools: +flex compilation works, many warnings but no errors +make max CXXFLAGS=-stdlib=libc++ +but: clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later) + diff --git a/flext/package.txt b/flext/package.txt index 429fa8db..6be36f61 100644 --- a/flext/package.txt +++ b/flext/package.txt @@ -11,9 +11,15 @@ INCPATH = -I../apf -I../src PKG_CONFIG ?= pkg-config INCPATH += `$(PKG_CONFIG) --cflags libxml-2.0` +#INCPATH += -I$(HOME)/.local/include +#INCPATH += -I$(HOME)/.local/include/libxml2 CXXFLAGS = -std=c++11 +# for XCode clang (not compatible with OSX 10.6): +#CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 -LIBS = -lfftw3f -lsndfile -lxml2 +#LIBS = -lfftw3f -lsndfile -lxml2 +LIBS += `$(PKG_CONFIG) --libs libxml-2.0` +#LIBS += -L$(HOME)/.local/lib # vim:filetype=make