1+ import os
2+ import generate_templates
3+
4+ env = SConscript ("godot-cpp/SConstruct" )
5+ java_home = os .environ ["JAVA_HOME" ]
6+
7+ # Generate templates when building the engine.
8+ generate_templates .generate_header_from_files ("kt/plugins/godot-intellij-plugin/src/main/resources/template" , "src/editor/project/templates.h" )
9+
10+ # Add those directory manually, so we can skip the godot_cpp directory when including headers in C++ files
11+ source_path = [
12+ os .path .join ("godot-cpp" , "include" ,"godot_cpp" ),
13+ os .path .join ("godot-cpp" , "gen" , "include" ,"godot_cpp" )
14+ ]
15+ env .Append (CPPPATH = [env .Dir (d ) for d in source_path ])
16+
17+
18+ # For the reference:
19+ # - CCFLAGS are compilation flags shared between C and C++
20+ # - CFLAGS are for C-specific compilation flags
21+ # - CXXFLAGS are for C++-specific compilation flags
22+ # - CPPFLAGS are for pre-processor flags
23+ # - CPPDEFINES are for pre-processor defines
24+ # - LINKFLAGS are for linking flags
25+
26+ # tweak this if you want to use different folders, or more folders, to store your source code in.
27+ env .Append (CPPPATH = ["src/" ])
28+ sources = [
29+ Glob ("register_types.cpp" ),
30+ Glob ("src/*.cpp" ),
31+ Glob ("src/jni/*.cpp" ),
32+ Glob ("src/binding/*.cpp" ),
33+ Glob ("src/resource_format/*.cpp" ),
34+ Glob ("src/language/*.cpp" ),
35+ Glob ("src/script/*.cpp" ),
36+ Glob ("src/script/language/*.cpp" ),
37+ Glob ("src/jvm_wrapper/*.cpp" ),
38+ Glob ("src/jvm_wrapper/registration/*.cpp" ),
39+ Glob ("src/jvm_wrapper/bridge/*.cpp" ),
40+ Glob ("src/jvm_wrapper/memory/*.cpp" ),
41+ Glob ("src/lifecycle/*.cpp" ),
42+ Glob ("src/lifecycle/platforms/*.cpp" ),
43+ ]
44+
45+ if env ["target" ] in ["editor" , "template_debug" ]:
46+ sources .append (Glob ("src/editor/*.cpp" ))
47+ sources .append (Glob ("src/editor/project/*.cpp" ))
48+ sources .append (Glob ("src/editor/build/*.cpp" ))
49+ sources .append (Glob ("src/editor/dialog/*.cpp" ))
50+ sources .append (Glob ("src/editor/panel/*.cpp" ))
51+
52+ # Android
53+ if env ["platform" ] != "android" :
54+ java_include_dirs = [
55+ java_home + "/include" ,
56+ java_home + "/include/linux" ,
57+ java_home + "/include/win32" ,
58+ java_home + "/include/darwin"
59+ ]
60+ env .Append (CPPPATH = [java_include_dirs ])
61+
62+
63+ if env ["platform" ] == "macos" :
64+ library = env .SharedLibrary (
65+ "bin/godot.jvm.{}.{}.framework/godot.jvm.{}.{}" .format (
66+ env ["platform" ], env ["target" ], env ["platform" ], env ["target" ]
67+ ),
68+ source = sources ,
69+ )
70+ elif env ["platform" ] == "ios" :
71+ if env ["ios_simulator" ]:
72+ library = env .StaticLibrary (
73+ "bin/godot.jvm.{}.{}.simulator.a" .format (env ["platform" ], env ["target" ]),
74+ source = sources ,
75+ )
76+ else :
77+ library = env .StaticLibrary (
78+ "bin/godot.jvm.{}.{}.a" .format (env ["platform" ], env ["target" ]),
79+ source = sources ,
80+ )
81+ else :
82+ library = env .SharedLibrary (
83+ "bin/godot.jvm.{}{}" .format (env ["suffix" ], env ["SHLIBSUFFIX" ]),
84+ source = sources ,
85+ )
0 commit comments