godot_tools_build.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. build_solution(env, solution_path, build_config, restore=True)
  11. # No need to copy targets. The GodotTools csproj takes care of copying them.
  12. def build(env_mono, api_sln_cmd):
  13. assert env_mono['tools']
  14. output_dir = Dir('#bin').abspath
  15. editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools')
  16. target_filenames = ['GodotTools.dll']
  17. if env_mono['target'] == 'debug':
  18. target_filenames += ['GodotTools.pdb']
  19. targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
  20. cmd = env_mono.CommandNoCache(targets, api_sln_cmd, build_godot_tools, module_dir=os.getcwd())
  21. env_mono.AlwaysBuild(cmd)