@@ -14,6 +14,7 @@ BIN_DIR = "{project_dir}/addons/{extension_name}/bin".format(
14
14
project_dir = PROJECT_DIR ,
15
15
extension_name = EXTENSION_NAME )
16
16
17
+
17
18
# *** Generate version header.
18
19
19
20
print ("Generating SDK version header..." )
@@ -38,112 +39,107 @@ version_header_content = """/* DO NOT EDIT - generated by SConstruct */
38
39
with open ("src/sdk_version.gen.h" , "w" ) as f :
39
40
f .write (version_header_content )
40
41
42
+
41
43
# *** Build godot-cpp.
42
44
43
45
print ("Reading godot-cpp build configuration..." )
44
46
env = SConscript ("modules/godot-cpp/SConstruct" )
45
47
48
+
46
49
# *** Build sentry-native.
47
50
48
- # TODO: macOS needs to use a different SDK.
49
- if env ["platform" ] in ["linux" , "macos" ]:
51
+ if env ["platform" ] in ["linux" , "macos" , "windows" ]:
52
+ env .Append (CPPDEFINES = ["SENTRY_BUILD_STATIC" , "NATIVE_SDK" ])
53
+ env .Append (CPPPATH = ["modules/sentry-native/include" ])
54
+ env .Append (LIBPATH = ["modules/sentry-native/install/lib/" ])
50
55
51
- def build_sentry_native (target , source , env ):
52
- result = subprocess .run (
53
- ["sh" , "scripts/build-sentry-native.sh" ],
54
- check = True ,
56
+ sentry_targets = []
57
+ sentry_sources = ["modules/sentry-native/src/" ]
58
+
59
+ def add_target (lib_name ):
60
+ env .Append (LIBS = [lib_name ])
61
+ if env ["platform" ] == "windows" :
62
+ sentry_targets .append ("modules/sentry-native/install/lib/" + lib_name + ".lib" )
63
+ sentry_targets .append ("modules/sentry-native/install/lib/" + lib_name + ".pdb" )
64
+ else :
65
+ sentry_targets .append ("modules/sentry-native/install/lib/lib" + lib_name + ".a" )
66
+
67
+ add_target ("sentry" )
68
+ add_target ("crashpad_client" )
69
+ add_target ("crashpad_handler_lib" )
70
+ add_target ("crashpad_minidump" )
71
+ add_target ("crashpad_snapshot" )
72
+ add_target ("crashpad_tools" )
73
+ add_target ("crashpad_util" )
74
+ add_target ("mini_chromium" )
75
+
76
+ # Include additional platform-specific libs.
77
+ if env ["platform" ] == "windows" :
78
+ add_target ("crashpad_compat" )
79
+ env .Append (
80
+ LIBS = [
81
+ "winhttp" ,
82
+ "advapi32" ,
83
+ "DbgHelp" ,
84
+ "Version" ,
85
+ ]
55
86
)
56
- return result .returncode
87
+ elif env ["platform" ] == "linux" :
88
+ add_target ("crashpad_compat" )
89
+ env .Append (
90
+ LIBS = [
91
+ "curl" ,
92
+ ]
93
+ )
94
+ elif env ["platform" ] == "macos" :
95
+ env .Append (
96
+ LIBS = [
97
+ "curl" ,
98
+ ]
99
+ )
100
+
101
+ # TODO: macOS needs to use a different SDK.
102
+ if env ["platform" ] == "windows" :
103
+ crashpad_handler_bin = "crashpad_handler.exe"
104
+ build_command = ["powershell" , "scripts/build-sentry-native.ps1" ]
105
+ else :
106
+ crashpad_handler_bin = "crashpad_handler"
107
+ build_command = ["sh" , "scripts/build-sentry-native.sh" ]
57
108
58
- crashpad_handler_target = "{bin}/{platform}/crashpad_handler " .format (
109
+ crashpad_handler_target = "{bin}/{platform}/{handler_bin} " .format (
59
110
bin = BIN_DIR ,
60
- platform = env ["platform" ]
111
+ platform = env ["platform" ],
112
+ handler_bin = crashpad_handler_bin ,
61
113
)
62
- sentry_native = env .Command (
63
- [
64
- "modules/sentry-native/install/lib/libsentry.a" ,
65
- crashpad_handler_target ,
66
- ],
67
- ["modules/sentry-native/src" ],
68
- [
69
- build_sentry_native ,
70
- Copy (
71
- crashpad_handler_target ,
72
- "modules/sentry-native/install/bin/crashpad_handler" ,
73
- ),
74
- ],
75
- )
76
- elif env ["platform" ] == "windows" :
114
+ crashpad_handler_source = "modules/sentry-native/install/bin/" + crashpad_handler_bin
115
+ sentry_targets .append (crashpad_handler_target )
77
116
78
117
def build_sentry_native (target , source , env ):
79
118
result = subprocess .run (
80
- [ "powershell" , "scripts/build-sentry-native.ps1" ] ,
119
+ build_command ,
81
120
check = True ,
82
121
)
83
122
return result .returncode
84
123
85
124
sentry_native = env .Command (
86
- [ "modules/sentry-native/install/lib/sentry.lib" , BIN_DIR + "/windows/crashpad_handler.exe" ] ,
87
- [ "modules/sentry-native/src/" ] ,
125
+ sentry_targets ,
126
+ sentry_sources ,
88
127
[
89
128
build_sentry_native ,
90
- Copy (
91
- BIN_DIR + "/windows/crashpad_handler.exe" ,
92
- "modules/sentry-native/install/bin/crashpad_handler.exe" ,
93
- ),
129
+ Copy (crashpad_handler_target , crashpad_handler_source ),
94
130
],
95
131
)
96
- Depends (sentry_native , "modules/godot-cpp" ) # Force sentry-native to be built sequential to godot-cpp (not in parallel)
97
- Default (sentry_native )
98
- Clean (sentry_native , ["modules/sentry-native/build" , "modules/sentry-native/install" ])
99
132
100
- # Include relative to project source root.
101
- env .Append (CPPPATH = ["src/" ])
133
+ Depends (sentry_native , "modules/godot-cpp" ) # Force sentry-native to be built sequential to godot-cpp (not in parallel)
134
+ Default (sentry_native )
135
+ Clean (sentry_native , ["modules/sentry-native/build" , "modules/sentry-native/install" ])
102
136
103
- # Include sentry-native libs (static).
104
- if env ["platform" ] in ["linux" , "macos" , "windows" ]:
105
- env .Append (CPPDEFINES = ["SENTRY_BUILD_STATIC" , "NATIVE_SDK" ])
106
- env .Append (CPPPATH = ["modules/sentry-native/include" ])
107
- env .Append (LIBPATH = ["modules/sentry-native/install/lib/" ])
108
- env .Append (
109
- LIBS = [
110
- "sentry" ,
111
- "crashpad_client" ,
112
- "crashpad_handler_lib" ,
113
- "crashpad_minidump" ,
114
- "crashpad_snapshot" ,
115
- "crashpad_tools" ,
116
- "crashpad_util" ,
117
- "mini_chromium" ,
118
- ]
119
- )
120
- # Include additional platform-specific libs.
121
- if env ["platform" ] == "windows" :
122
- env .Append (
123
- LIBS = [
124
- "crashpad_compat" ,
125
- "winhttp" ,
126
- "advapi32" ,
127
- "DbgHelp" ,
128
- "Version" ,
129
- ]
130
- )
131
- elif env ["platform" ] == "linux" :
132
- env .Append (
133
- LIBS = [
134
- "crashpad_compat" ,
135
- "curl" ,
136
- ]
137
- )
138
- elif env ["platform" ] == "macos" :
139
- env .Append (
140
- LIBS = [
141
- "curl" ,
142
- ]
143
- )
144
137
145
138
# *** Build GDExtension library.
146
139
140
+ # Include relative to project source root.
141
+ env .Append (CPPPATH = ["src/" ])
142
+
147
143
# Source files to compile.
148
144
sources = Glob ("src/*.cpp" )
149
145
sources += Glob ("src/sentry/*.cpp" )
@@ -178,6 +174,7 @@ else:
178
174
179
175
Default (library )
180
176
177
+
181
178
# *** Deploy extension manifest.
182
179
183
180
manifest = env .Substfile (
@@ -194,6 +191,7 @@ manifest = env.Substfile(
194
191
195
192
Default (manifest )
196
193
194
+
197
195
# *** Create symbolic link from project addons dir to gdUnit4 testing framework submodule.
198
196
199
197
def symlink (target , source , env ):
0 commit comments