3 #####################################################################
5 # Compiles Faust programs to supercollider #
8 #####################################################################
10 #-------------------------------------------------------------------
11 # Supercollider headers : path to the folder containing :
12 # plugin_interface/, common/ and server/ headers
16 SC0
=$SUPERCOLLIDER_HEADERS
17 SC1
="/usr/local/include/SuperCollider"
18 SC2
="/usr/local/include/supercollider"
19 SC3
="/usr/include/SuperCollider"
20 SC4
="/usr/include/supercollider"
22 # check if directory exists
24 if [ -d $SC0/plugin_interface
]; then
26 elif [ -d $SC1 ]; then
28 elif [ -d $SC2 ]; then
30 elif [ -d $SC3 ]; then
32 elif [ -d $SC4 ]; then
35 echo "Can't find SuperCollider headers"
38 echo Using SC Headers
in $SC
40 INCLUDE
="-I$SC/plugin_interface/ -I$SC/common/ -I$SC/server/"
44 echo "$0 [-d[ebug]] [-icc] [-omp] [-sd] file1.dsp [file2.dsp ...]"
48 #-------------------------------------------------------------------
49 # Analyze command arguments :
50 # faust options -> OPTIONS
51 # if -omp : -openmp or -fopenmp -> OPENMP
52 # if -d or -debug -> F2SC_DEBUG
53 # if -sd or -synthdef -> SYNTHDEF
54 # existing *.dsp files -> FILES
57 # PHASE 1 : Look for -icc option to force use of intel icc (actually icpc)
58 # without having to configure CXX and CXXFLAGS
60 if [ "$p" = -icc ]; then
62 CXXFLAGS
='-O3 -xT -ftz -fno-alias -fp-model fast=2'
66 #PHASE 2 : dispatch command arguments
70 if [ "$p" = -omp ]; then
71 if [[ $CXX == "icpc" ]]; then
78 if [ "$p" = -debug ] ||
[ "$p" = -d ]; then
80 elif [ "$p" = -sd ] ||
[ "$p" = -synthdef ]; then
82 elif [ "$p" = -icc ]; then
84 elif [ ${p:0:1} = "-" ]; then
86 elif [[ -e "$p" ]]; then
89 echo "*** Faust source-file '$p' not found"
94 if [ $F2SC_DEBUG = 1 ]; then
102 if [ "$FILES" = "" ]; then
104 echo "$0 [-d[ebug]] [-icc] [-omp] file1.dsp [file2.dsp ...]"
108 #-------------------------------------------------------------------
109 # Check plateform specifics
111 if [[ $
(uname
) == Darwin
]]; then
113 SCFLAGS
="-DNO_LIBSNDFILE -DSC_DARWIN $DNDEBUG -bundle "
114 elif [[ $
(uname
) == Linux
]]; then
116 SCFLAGS
="-DNO_LIBSNDFILE -DSC_LINUX $DNDEBUG -shared -fPIC"
118 echo "unsupported plateform"
122 #-------------------------------------------------------------------
123 # compile the *.dsp files
129 SRCDIR
=$
(dirname "$p")
131 # creates a temporary dir
132 TDR
=$
(mktemp
-d faust.XXX
)
136 # compile the .dsp file to c++ and xml
137 faust
-xml "$SRCDIR/$f" -o /dev
/null
;
138 mv "$SRCDIR/$f.xml" $TMP/
139 faust
-a supercollider.cpp
$OPTIONS "$SRCDIR/$f" -o "$TMP/${f%.dsp}.cpp"
141 # compile c++ to binary; --prefix should be same as in ../../examples/Makefile.sccompile
144 faust2sc
--prefix=Faust
$SYNTHDEF $f.xml
> "${f%.dsp}.sc" 2>$OUTDEV
145 ${CXX=g++} -O3 $SCFLAGS -I$CUR $INCLUDE $CXXFLAGS $OMP -Dmydsp=${f%.dsp} -o ${f%.dsp}.$EXT ${f%.dsp}.cpp
148 ## move the produced files from tmp to source dir
149 cp "$TMP/${f%.dsp}.$EXT" "$SRCDIR/${f%.dsp}.$EXT"
150 cp "$TMP/${f%.dsp}.sc" "$SRCDIR/${f%.dsp}.sc"
153 if [ $F2SC_DEBUG = 1 ]; then
154 echo "Retaining intermediate products directory '$TDR'"
160 # collects all the files produced
161 BINARIES
="$BINARIES$SRCDIR/${f%.dsp}.$EXT;$SRCDIR/${f%.dsp}.sc;"
165 # return the binaries names