-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConstruct
More file actions
79 lines (61 loc) · 2.08 KB
/
SConstruct
File metadata and controls
79 lines (61 loc) · 2.08 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
import os, sys
from external.cppscript.godot_cppscript import create_cppscript_target, GlobRecursive
# Customize this values depending on your project
library_name = 'scripts'
SRC_DIR = 'src'
GEN_DIR = '.gen'
env = SConscript('external/godot-cpp/SConstruct').Clone()
sources = GlobRecursive(SRC_DIR, '*.cpp')
env.Append(CXXFLAGS='-fdiagnostics-color=always')
###############################
# godot-cppscript creation
# Get header files (.hpp only)
scripts = GlobRecursive(SRC_DIR, '*.hpp')
# Create target, returns generated .cpp files list
generated = create_cppscript_target(
env, # SCons env, env.Clone() for different projects
scripts, # Header files to parse
# CppScript config
{
# Name of header to be included to enable cppscript
# (Prefer name unique to your project)
'header_name' : 'cppscript.h',
# Path to C++ header files
'header_dir' : SRC_DIR,
# Path to generated object files
'gen_dir' : GEN_DIR,
# Generate bindings to public methods automatically
# or require GMETHOD() before methods
'auto_methods' : True,
# Optional
## C++ defines (TOOLS_ENABLED, DEBUG_METHODS etc.)
## Enable, if you conditionally enable classes/members
## based on definitions
'compile_defs' : env['CPPDEFINES'],
#
## Include paths
## (Try to avoid godot-cpp headers paths,
## it slows parsing drastically)
#'include_paths' : env['CPPPATH']
}
)
# Include headers path (if not done already)
env.Append(CPPPATH=SRC_DIR)
###############################
if env["platform"] == "macos":
library = env.SharedLibrary(
"bin/lib{}.{}.{}.framework/lib{}.{}.{}".format(
library_name, env["platform"], env["target"], library_name, env["platform"], env["target"]
),
source=sources + generated, # Add generated source files to target
)
else:
library = env.SharedLibrary(
"bin/lib{}{}{}".format(library_name, env["suffix"], env["SHLIBSUFFIX"]),
source=sources + generated, # Add generated source files to target
)
###############################
# Rebuild after headers change
env.Depends(library[0].sources, generated)
###############################
Default(library)