godot_tools_build.py 1.3 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. # Custom build target to make sure output is always copied to the data dir.
  10. extra_build_args = ['/Target=BuildAlwaysCopyToDataDir']
  11. from . solution_builder import build_solution, nuget_restore
  12. nuget_restore(env, solution_path)
  13. build_solution(env, solution_path, build_config, extra_build_args)
  14. # No need to copy targets. The GodotTools csproj takes care of copying them.
  15. def build(env_mono, api_sln_cmd):
  16. assert env_mono['tools']
  17. output_dir = Dir('#bin').abspath
  18. editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools')
  19. target_filenames = ['GodotTools.dll']
  20. if env_mono['target'] == 'debug':
  21. target_filenames += ['GodotTools.pdb']
  22. targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
  23. cmd = env_mono.CommandNoCache(targets, api_sln_cmd, build_godot_tools, module_dir=os.getcwd())
  24. env_mono.AlwaysBuild(cmd)