-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSConstruct
More file actions
53 lines (42 loc) · 1.54 KB
/
SConstruct
File metadata and controls
53 lines (42 loc) · 1.54 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
#!/usr/bin/env python
from SCons import __version__ as scons_raw_version
import os
import sys
ext_name = "dbus"
# Load the environment from godot-cpp
godot_cpp_path = "godot-cpp"
if 'GODOT_CPP_PATH' in os.environ:
godot_cpp_path = os.environ['GODOT_CPP_PATH']
env = SConscript(godot_cpp_path + "/SConstruct")
# For the reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
# - CXXFLAGS are for C++-specific compilation flags
# - CPPFLAGS are for pre-processor flags
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")
# Include dependency libraries for dbus
if 'PKG_CONFIG_PATH' in os.environ:
env['ENV']['PKG_CONFIG_PATH'] = os.environ['PKG_CONFIG_PATH']
env.ParseConfig("pkg-config dbus-1 --cflags --libs")
# Generating the compilation DB (`compile_commands.json`) requires SCons 4.0.0 or later.
scons_ver = env._get_major_minor_revision(scons_raw_version)
if scons_ver < (4, 0, 0):
print(
"The `compiledb=yes` option requires SCons 4.0 or later, but your version is %s."
% scons_raw_version
)
Exit(255)
env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase())
# Build the shared library
library = env.SharedLibrary(
"addons/{}/bin/lib{}{}{}".format(
ext_name, ext_name, env["suffix"], env["SHLIBSUFFIX"]
),
source=sources,
)
Default(library)