Skip to content

Commit f0e0986

Browse files
committed
Allow searching LIBRARY_PATH with build_library=no
Instead of assuming the library is already present in bin/ when asking not to build it, allow the linker to search the system for it as well.
1 parent c943beb commit f0e0986

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

tools/godotcpp.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,16 +564,25 @@ def _godot_cpp(env):
564564
library = None
565565
library_name = "libgodot-cpp" + env["suffix"] + env["LIBSUFFIX"]
566566

567+
default_args = []
568+
567569
if env["build_library"]:
568570
library = env.StaticLibrary(target=env.File("bin/%s" % library_name), source=sources)
569571
env.NoCache(library)
570572
default_args = [library]
571573

572-
# Add compiledb if the option is set
573-
if env.get("compiledb", False):
574-
default_args += ["compiledb"]
574+
env.AppendUnique(LIBS=[env.File("bin/%s" % library_name)])
575+
else:
576+
# When not building the library, allow it to be found in other library
577+
# paths on the system. It may have been built previously, so still add
578+
# bin/ to the search path.
579+
env.AppendUnique(LIBPATH=[env.Dir("bin/")])
580+
env.AppendUnique(LIBS=[library_name])
581+
582+
# Add compiledb if the option is set
583+
if env.get("compiledb", False):
584+
default_args += ["compiledb"]
575585

576-
env.Default(*default_args)
586+
env.Default(*default_args)
577587

578-
env.AppendUnique(LIBS=[env.File("bin/%s" % library_name)])
579588
return library

0 commit comments

Comments
 (0)