@@ -5,15 +5,6 @@ import sys
55from methods import print_error
66
77
8- def normalize_path (val , env ):
9- return val if os .path .isabs (val ) else os .path .join (env .Dir ("#" ).abspath , val )
10-
11-
12- def validate_parent_dir (key , val , env ):
13- if not os .path .isdir (normalize_path (os .path .dirname (val ), env )):
14- raise UserError ("'%s' is not a directory: %s" % (key , os .path .dirname (val )))
15-
16-
178libname = "EXTENSION-NAME"
189projectdir = "demo"
1910
@@ -23,33 +14,11 @@ customs = ["custom.py"]
2314customs = [os .path .abspath (path ) for path in customs ]
2415
2516opts = Variables (customs , ARGUMENTS )
26- opts .Add (
27- BoolVariable (
28- key = "compiledb" ,
29- help = "Generate compilation DB (`compile_commands.json`) for external tools" ,
30- default = localEnv .get ("compiledb" , False ),
31- )
32- )
33- opts .Add (
34- PathVariable (
35- key = "compiledb_file" ,
36- help = "Path to a custom `compile_commands.json` file" ,
37- default = localEnv .get ("compiledb_file" , "compile_commands.json" ),
38- validator = validate_parent_dir ,
39- )
40- )
4117opts .Update (localEnv )
4218
4319Help (opts .GenerateHelpText (localEnv ))
4420
4521env = localEnv .Clone ()
46- env ["compiledb" ] = False
47-
48- env .Tool ("compilation_db" )
49- compilation_db = env .CompilationDatabase (
50- normalize_path (localEnv ["compiledb_file" ], localEnv )
51- )
52- env .Alias ("compiledb" , compilation_db )
5322
5423submodule_initialized = False
5524dir_name = 'godot-cpp'
@@ -92,6 +61,4 @@ library = env.SharedLibrary(
9261copy = env .InstallAs ("{}/bin/{}/{}lib{}" .format (projectdir , env ["platform" ], filepath , file ), library )
9362
9463default_args = [library , copy ]
95- if localEnv .get ("compiledb" , False ):
96- default_args += [compilation_db ]
9764Default (* default_args )
0 commit comments