BuildWindows.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. var fs = require('fs-extra');
  2. var path = require("path");
  3. var host = require("./Host");
  4. var atomicRoot = host.atomicRoot;
  5. var buildDir = host.artifactsRoot + "Build/Windows/";
  6. var editorAppFolder = host.artifactsRoot + "AtomicEditor/";
  7. namespace('build', function() {
  8. // Builds a standalone Atomic Editor, which can be distributed out of build tree
  9. task('atomiceditor', {
  10. async: true
  11. }, function() {
  12. // Clean build
  13. var cleanBuild = true;
  14. if (cleanBuild) {
  15. common.cleanCreateDir(buildDir);
  16. common.cleanCreateDir(editorAppFolder);
  17. common.cleanCreateDir(host.getGenScriptRootDir("WINDOWS"));
  18. }
  19. // create the generated script files, so they will be picked up by cmake
  20. host.createGenScriptFiles("WINDOWS");
  21. process.chdir(buildDir);
  22. var cmds = [];
  23. // Build the AtomicEditor
  24. cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAtomicEditor.bat");
  25. jake.exec(cmds, function() {
  26. // Copy the Editor binaries
  27. fs.copySync(buildDir + "Source/AtomicEditor/Release/AtomicEditor.exe",
  28. host.artifactsRoot + "AtomicEditor/AtomicEditor.exe");
  29. fs.copySync(buildDir + "Source/AtomicEditor/Release/D3DCompiler_47.dll",
  30. host.artifactsRoot + "AtomicEditor/D3DCompiler_47.dll");
  31. // We need some resources to run
  32. fs.copySync(atomicRoot + "Resources/CoreData",
  33. editorAppFolder + "Resources/CoreData");
  34. fs.copySync(atomicRoot + "Resources/PlayerData",
  35. editorAppFolder + "Resources/PlayerData");
  36. fs.copySync(atomicRoot + "Data/AtomicEditor",
  37. editorAppFolder + "Resources/ToolData");
  38. fs.copySync(atomicRoot + "Resources/EditorData",
  39. editorAppFolder + "Resources/EditorData");
  40. fs.copySync(atomicRoot + "Artifacts/Build/Resources/EditorData/AtomicEditor/EditorScripts",
  41. editorAppFolder + "Resources/EditorData/AtomicEditor/EditorScripts");
  42. fs.copySync(buildDir + "Source/AtomicPlayer/Application/Release/AtomicPlayer.exe",
  43. editorAppFolder + "Resources/ToolData/Deployment/Windows/x64/AtomicPlayer.exe");
  44. fs.copySync(buildDir + "Source/AtomicPlayer/Application/Release/D3DCompiler_47.dll",
  45. editorAppFolder + "Resources/ToolData/Deployment/Windows/x64/D3DCompiler_47.dll");
  46. console.log("Atomic Editor build to ", editorAppFolder);
  47. complete();
  48. }, {
  49. printStdout: true
  50. });
  51. });
  52. // Generate a Visual Studio 2015 solution
  53. task('genvs2015', {
  54. async: true
  55. }, function() {
  56. var slnRoot = path.resolve(atomicRoot, "") + "-VS2015\\";
  57. if (!fs.existsSync(slnRoot)) {
  58. jake.mkdirP(slnRoot);
  59. }
  60. // create the generated script files, so they will be picked up by cmake
  61. host.createGenScriptFiles("WINDOWS");
  62. process.chdir(slnRoot);
  63. var cmds = [];
  64. cmds.push(atomicRoot + "Build/Scripts/Windows/GenerateVS2015.bat");
  65. jake.exec(cmds, function() {
  66. var task = jake.Task['build:genscripts']
  67. task.addListener('complete', function () {
  68. console.log("\n\nVisual Studio Solution generated in ", slnRoot);
  69. complete();
  70. });
  71. task.invoke("WINDOWS");
  72. }, {
  73. printStdout: true
  74. });
  75. });
  76. }); // end of build namespace