godot_tools_build.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Build GodotTools solution
  2. import os
  3. from SCons.Script import Dir
  4. def build_godot_tools(source, target, env):
  5. # source and target elements are of type SCons.Node.FS.File, hence why we convert them to str
  6. module_dir = env["module_dir"]
  7. solution_path = os.path.join(module_dir, "editor/GodotTools/GodotTools.sln")
  8. build_config = "Debug" if env["target"] == "debug" else "Release"
  9. from .solution_builder import build_solution
  10. extra_msbuild_args = ["/p:GodotPlatform=" + env["platform"]]
  11. build_solution(env, solution_path, build_config, extra_msbuild_args)
  12. # No need to copy targets. The GodotTools csproj takes care of copying them.
  13. def build(env_mono, api_sln_cmd):
  14. assert env_mono["tools"]
  15. output_dir = Dir("#bin").abspath
  16. editor_tools_dir = os.path.join(output_dir, "GodotSharp", "Tools")
  17. target_filenames = ["GodotTools.dll"]
  18. if env_mono["target"] == "debug":
  19. target_filenames += ["GodotTools.pdb"]
  20. targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
  21. cmd = env_mono.CommandNoCache(targets, api_sln_cmd, build_godot_tools, module_dir=os.getcwd())
  22. env_mono.AlwaysBuild(cmd)