Add input csv files of examples to track list.
[Faustine.git] / interpreter / preprocessor / faust-0.9.47mr3 / tools / faust2appls / faust2jack
1 #!/bin/bash
2
3 OSCDEFS=""
4 #####################################################################
5 # #
6 # Compiles Faust programs to jack-gtk #
7 # (c) Grame, 2009-2011 #
8 # #
9 #####################################################################
10
11 #-------------------------------------------------------------------
12 # Check darwin specifics
13 #
14 if [[ $(uname) == Darwin ]]; then
15 MARCH=""
16 else
17 MARCH="-march=native"
18 fi
19
20 #-------------------------------------------------------------------
21 # Default compilation flags for gcc and icc :
22 #
23 MYGCCFLAGS="-O3 $MARCH -mfpmath=sse -msse -msse2 -msse3 -ffast-math -ftree-vectorize"
24 MYICCFLAGS="-O3 -xHost -ftz -fno-alias -fp-model fast=2"
25
26
27 #-------------------------------------------------------------------
28 # Analyze command arguments :
29 # faust options -> OPTIONS
30 # if -omp : -openmp or -fopenmp -> OPENMP
31 # existing *.dsp files -> FILES
32 #
33
34 # PHASE 1 : Look for -icc option to force use of intel icc (actually icpc)
35 # without having to configure CXX and CXXFLAGS
36 CXX=g++
37 CXXFLAGS=$MYGCCFLAGS
38 for p in $@; do
39 if [ "$p" = -icc ]; then
40 CXX=icpc
41 CXXFLAGS=$MYICCFLAGS
42 fi
43 done
44
45
46 #PHASE 2 : dispatch command arguments
47 for p in $@; do
48 if [ "$p" = -omp ]; then
49 if [[ $CXX == "icpc" ]]; then
50 OMP="-openmp"
51 else
52 OMP="-fopenmp"
53 fi
54 fi
55
56 if [ "$p" = -icc ]; then
57 ignore=" "
58 elif [ $p = "-osc" ]; then
59 OSCDEFS="-I/usr/local/lib/faust/osclib -DOSCCTRL -L/usr/local/lib/faust/osclib -lOSCFaust -loscpack"
60 elif [ ${p:0:1} = "-" ]; then
61 OPTIONS="$OPTIONS $p"
62 elif [[ -e "$p" ]]; then
63 FILES="$FILES $p"
64 else
65 OPTIONS="$OPTIONS $p"
66 fi
67 done
68
69
70
71
72 #-------------------------------------------------------------------
73 # compile the *.dsp files using JACK-GTK on linux
74 #
75 for f in $FILES; do
76
77 # compile faust to c++
78 faust -a jack-gtk.cpp $OPTIONS "$f" -o "$f.cpp"
79
80 # compile c++ to binary
81 (
82 $CXX $CXXFLAGS $OMP -I/usr/local/lib/faust "$f.cpp" `pkg-config --cflags --libs jack gtk+-2.0` $OSCDEFS -o "${f%.dsp}"
83 ) > /dev/null
84 rm "$f.cpp"
85
86 # collect binary file name for FaustWorks
87 BINARIES="$BINARIES${f%.dsp};"
88 done
89
90
91 echo $BINARIES
92
93