Add a build parameter controlling whether or not to build the example programs, defau...
[platform/upstream/armcl.git] / SConstruct
1 # Copyright (c) 2016, 2017 ARM Limited.
2 #
3 # SPDX-License-Identifier: MIT
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to
7 # deal in the Software without restriction, including without limitation the
8 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 # sell copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included in all
13 # copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 # SOFTWARE.
22
23 import os
24
25 vars = Variables("scons")
26 vars.AddVariables(
27     BoolVariable("debug", "Debug", False),
28     BoolVariable("asserts", "Enable asserts (this flag is forced to 1 for debug=1)", False),
29     EnumVariable("arch", "Target Architecture", "armv7a", allowed_values=("armv7a", "arm64-v8a", "arm64-v8.2-a", "x86_32", "x86_64")),
30     EnumVariable("os", "Target OS", "linux", allowed_values=("linux", "android", "bare_metal")),
31     EnumVariable("build", "Build type", "cross_compile", allowed_values=("native", "cross_compile")),
32     BoolVariable("examples", "Build example programs", False),
33     BoolVariable("Werror", "Enable/disable the -Werror compilation flag", True),
34     BoolVariable("opencl", "Enable OpenCL support", True),
35     BoolVariable("neon", "Enable Neon support", False),
36     BoolVariable("embed_kernels", "Embed OpenCL kernels in library binary", False),
37     BoolVariable("set_soname", "Set the library's soname and shlibversion (requires SCons 2.4 or above)", False),
38     BoolVariable("openmp", "Enable OpenMP backend", False),
39     BoolVariable("cppthreads", "Enable C++11 threads backend", True),
40     PathVariable("build_dir", "Specify sub-folder for the build", ".", PathVariable.PathIsDirCreate),
41     ("extra_cxx_flags", "Extra CXX flags to be appended to the build command", "")
42 )
43
44 env = Environment(platform='posix', variables = vars, ENV = os.environ)
45
46 Help(vars.GenerateHelpText(env))
47
48 Export('vars')
49 Export('env')
50
51 if not GetOption("help"):
52     SConscript('sconscript', variant_dir='#build/%s/arm_compute' % env['build_dir'], duplicate=0)