Update readme, install and license files.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2appls / faust2caqt
1 #!/bin/bash
2
3 #####################################################################
4 # #
5 # Compiles Faust programs to jack-qt #
6 # (c) Grame, 2009 #
7 # #
8 #####################################################################
9 PATH=$PATH:/usr/local/bin
10 FAUST=faust
11
12 OSCINC=""
13 QTDEFS=""
14 OSCLIB=""
15
16
17 #-------------------------------------------------------------------
18 # Analyze command arguments :
19 # faust options -> OPTIONS
20 # if -omp : -openmp or -fopenmp -> OPENMP
21 # existing *.dsp files -> FILES
22 #
23
24 # PHASE 1 : Look for -icc option to force use of intel icc (actually icpc)
25 # without having to configure CXX and CXXFLAGS
26 for p in $@; do
27 if [ "$p" = "-icc" ]; then
28 CXX=icpc
29 CXXFLAGS='-O3 -xT -ftz -fno-alias -fp-model fast=2'
30 fi
31 done
32
33 #PHASE 2 : dispatch command arguments
34 for p in $@; do
35 if [ "$p" = -omp ]; then
36 if [[ $CXX == "icpc" ]]; then
37 OMP="-openmp"
38 else
39 OMP="-fopenmp"
40 fi
41 elif [ "$p" = -icc ]; then
42 ignore=" "
43 elif [ "$p" = "-osc" ]; then
44 OSCINC="INCLUDEPATH+=/usr/local/lib/faust/osclib"
45 QTDEFS="DEFINES += OSCCTRL"
46 OSCLIB="-L/usr/local/lib/faust/osclib -lOSCFaust -loscpack"
47 elif [ ${p:0:1} = "-" ]; then
48 OPTIONS="$OPTIONS $p"
49 elif [[ -e "$p" ]]; then
50 FILES="$FILES $p"
51 else
52 OPTIONS="$OPTIONS $p"
53 fi
54 done
55
56
57
58 #-------------------------------------------------------------------
59 # Check darwin specifics
60 #
61 if [[ $(uname) == Darwin ]]; then
62 SPEC="-spec macx-g++ -Wnone"
63 EXT=".app"
64 fi
65
66 #-------------------------------------------------------------------
67 # compile the *.dsp files
68 #
69 for p in $FILES; do
70
71 CUR=$(pwd)
72 f=$(basename "$p")
73 SRCDIR=$(dirname "$p")
74
75 # creates a temporary dir
76 TDR=$(mktemp -d faust.XXX)
77 TMP="$TDR/${f%.dsp}"
78 mkdir "$TMP"
79
80 # compile faust to c++
81 $FAUST -a ca-qt.cpp $OPTIONS "$SRCDIR/$f" -o "$TMP/${f%.dsp}.cpp"
82
83 # compile c++ to binary
84 (
85 cd "$TMP"
86 qmake -project "INCLUDEPATH+=$CUR" "INCLUDEPATH+=/usr/local/lib/faust/" "$OSCINC" "LIBS+=-framework CoreAudio -framework AudioUnit -framework CoreServices $OSCLIB" "HEADERS+=/usr/local/lib/faust/gui/faustqt.h" "$QTDEFS"
87 qmake $SPEC
88 make
89 ) > /dev/null #2>/dev/null
90
91 rm -rf "$SRCDIR/${f%.dsp}$EXT"
92 cp -r "$TMP/${f%.dsp}$EXT" "$SRCDIR/${f%.dsp}$EXT"
93 rm -rf "$TDR"
94
95 # collect binary file name for FaustGIDE
96 BINARIES="$BINARIES$SRCDIR/${f%.dsp}$EXT;"
97 done
98
99 echo $BINARIES
100
101