forked from marcecj/stream_looper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConstruct
More file actions
128 lines (98 loc) · 3.45 KB
/
SConstruct
File metadata and controls
128 lines (98 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
valid_faust_arches = (
"sndfile",
"pa-qt",
"pa-gtk",
"jack-qt",
"jack-gtk",
"puredata",
)
env_vars = Variables()
env_vars.AddVariables(
EnumVariable("FAUST_ARCHITECTURE",
"The FAUST architecture",
"jack-qt", valid_faust_arches),
BoolVariable("osc", "Use Open Sound Control (OSC)", True),
BoolVariable("openmp", "Use OpenMP pragmas", False),
("FAUST_FLAGS", "FAUST compiler flags"),
("CXX", "The C++ compiler")
)
env = Environment(tools=["default", "faust"],
variables=env_vars)
if env["FAUST_ARCHITECTURE"].endswith("qt"):
env.Tool("qt4")
if env["osc"]:
env.Append(
CPPDEFINES = ["OSCCTRL"],
CPPPATH = ["/usr/lib/faust"],
LIBPATH = ["/usr/lib/faust"],
# NOTE: The order matters!
LIBS = ["OSCFaust", "oscpack"],
)
if env["openmp"]:
env.Append(
CCFLAGS = ["-fopenmp"],
FAUST_FLAGS = ["-omp"],
LIBS = ["gomp"],
)
if env["FAUST_ARCHITECTURE"] == "pa-qt":
env.EnableQt4Modules(["QtGui", "QtCore"])
faustqt = env.Moc4("faustqt", "/usr/include/faust/gui/faustqt.h")
env.Append(LIBS = ["portaudio"])
elif env["FAUST_ARCHITECTURE"] == "pa-gtk":
env.MergeFlags(["!pkg-config --cflags-only-I gtk+-2.0"])
env.Append(LIBS = ["portaudio", "gtk-x11-2.0"])
elif env["FAUST_ARCHITECTURE"] == "jack-qt":
env.EnableQt4Modules(["QtGui", "QtCore"])
faustqt = env.Moc4("faustqt", "/usr/include/faust/gui/faustqt.h")
env.Append(LIBS = ["jack"])
elif env["FAUST_ARCHITECTURE"] == "jack-gtk":
# Use pkg-config to get the required include paths (includes some
# unnecessary paths, but what the hell)
env.MergeFlags(["!pkg-config --cflags-only-I gtk+-2.0"])
env.Append(LIBS = ["jack", "gtk-x11-2.0"])
elif env["FAUST_ARCHITECTURE"] == "sndfile":
env.Append(LIBS = ["sndfile"])
env.Append(CPPPATH = [env["FAUST_PATH"],
"/usr/share/include"],
CCFLAGS = ["-O3", "-pedantic", "-march=native",
"-Wall", "-Wextra", "-Wno-unused-parameter"],
CXXFLAGS = ["-std=c++0x"],
LINKFLAGS = ["-Wl,--as-needed"],
FAUST_FLAGS = ["-mdoc", "-vec"],
)
# parallelization flags
if env["CXX"] == "g++" and env["CXXVERSION"] >= "4.5":
env.Append(CCFLAGS=[
"-ftree-vectorize",
# "-ftree-vectorizer-verbose=2",
"-floop-interchange",
"-floop-strip-mine",
"-floop-block",
])
stream_looper_src = [env.Faust("stream_looper.dsp")]
if env["FAUST_ARCHITECTURE"] in ("jack-qt", "pa-qt"):
stream_looper_src.append(faustqt)
if env["FAUST_ARCHITECTURE"] == "puredata":
env.Append(CPPDEFINES = "mydsp=stream_looper")
stream_looper = env.SharedLibrary(
stream_looper_src,
SHLIBPREFIX="",
SHLIBSUFFIX="~.pd_linux"
)
else:
stream_looper = env.Program(stream_looper_src)
doc = env.PDF("stream_looper-mdoc/pdf/stream_looper.pdf",
"stream_looper-mdoc/tex/stream_looper.tex")
env.Alias("stream_looper", stream_looper)
env.Alias("doc", doc)
Default("stream_looper")
env.Clean(stream_looper, "stream_looper-mdoc")
Help(
"""This build system compiles Stream Looper. To compile, use one of the
following build targets:
stream_looper -> compile Stream Looper (default)
The following environment variables can be overridden by passing them *after*
the call to scons, e.g., "scons CC=gcc":
"""
+ env_vars.GenerateHelpText(env)
)