2018-07-17 21:26:39 +03:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
import os
|
|
|
|
import SCons
|
|
|
|
|
|
|
|
opts = Variables()
|
|
|
|
opts.AddVariables(
|
2018-08-30 07:51:44 +03:00
|
|
|
BoolVariable("DEBUG", "Make debug build", 0),
|
2018-07-17 21:26:39 +03:00
|
|
|
BoolVariable("VERBOSE", "Show full build information", 0))
|
|
|
|
|
|
|
|
env = Environment(options = opts,
|
|
|
|
ENV = os.environ)
|
2018-08-30 07:21:31 +03:00
|
|
|
|
|
|
|
env.Tool('clang')
|
|
|
|
|
2018-09-11 01:18:06 +03:00
|
|
|
# Add extra compiler flags from the environment
|
2018-09-12 07:34:21 +03:00
|
|
|
for flag in ["CCFLAGS", "CFLAGS", "CPPFLAGS", "CXXFLAGS", "LINKFLAGS"]:
|
2018-09-11 01:18:06 +03:00
|
|
|
if flag in os.environ:
|
|
|
|
env.Append(**{flag: SCons.Util.CLVar(os.getenv(flag))})
|
2018-07-17 21:26:39 +03:00
|
|
|
|
|
|
|
if env["DEBUG"]:
|
2018-09-11 01:18:06 +03:00
|
|
|
print("DEBUG MODE!")
|
2018-09-24 10:49:59 +03:00
|
|
|
sanitizers = ['-fsanitize=address,undefined', \
|
|
|
|
'-fno-sanitize-recover=undefined,integer,nullability']
|
|
|
|
env.Append(CCFLAGS = ["-g", "-DDEBUG"] + sanitizers,
|
|
|
|
LINKFLAGS = sanitizers)
|
2018-07-17 21:26:39 +03:00
|
|
|
|
2018-09-11 01:18:06 +03:00
|
|
|
env.Append(
|
|
|
|
LIBS = ["mprio", "mpi", "nss3", "nspr4"],
|
2018-07-17 21:26:39 +03:00
|
|
|
LIBPATH = ['#build/prio', "#build/mpi"],
|
2018-09-24 19:34:53 +03:00
|
|
|
CFLAGS = [ "-Wall", "-Werror", "-Wextra", "-O3", "-std=c99", "-Wvla",
|
2018-09-18 00:54:15 +03:00
|
|
|
"-I/usr/include/nspr", "-I/usr/include/nss", "-Impi", "-DDO_PR_CLEANUP"])
|
2018-07-17 21:26:39 +03:00
|
|
|
|
|
|
|
env.Append(CPPPATH = ["#include", "#."])
|
|
|
|
Export('env')
|
|
|
|
|
|
|
|
SConscript('mpi/SConscript', variant_dir='build/mpi')
|
|
|
|
SConscript('pclient/SConscript', variant_dir='build/pclient')
|
|
|
|
SConscript('prio/SConscript', variant_dir='build/prio')
|
|
|
|
SConscript('ptest/SConscript', variant_dir='build/ptest')
|
|
|
|
|