forked from AtomicGameEngine/AtomicGameEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildWindows.js
More file actions
155 lines (99 loc) · 4.48 KB
/
BuildWindows.js
File metadata and controls
155 lines (99 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
var fs = require('fs-extra');
var path = require("path");
var host = require("./Host");
var buildTasks = require("./BuildTasks");
var config = require("./BuildConfig");
var atomicRoot = config.atomicRoot;
var buildDir = config.artifactsRoot + "Build/Windows/";
var editorAppFolder = config.editorAppFolder
function copyAtomicNET() {
if (!config["with-atomicnet"])
return;
fs.copySync(atomicRoot + "Artifacts/AtomicNET/" + config["config"],
editorAppFolder + "Resources/ToolData/AtomicNET/" + config["config"]);
fs.copySync(atomicRoot + "Script/AtomicNET/AtomicProject.json",
editorAppFolder + "Resources/ToolData/AtomicNET/Build/Projects/AtomicProject.json");
}
function copyAtomicEditor() {
// Copy the Editor binaries
fs.copySync(buildDir + "Source/AtomicEditor/" + config["config"],
config.artifactsRoot + "AtomicEditor");
// copy AtomicTool
fs.copySync(buildDir + "Source/AtomicTool/" + config["config"] +"/AtomicTool.exe",
editorAppFolder + "AtomicTool.exe");
// We need some resources to run
fs.copySync(atomicRoot + "Resources/CoreData",
editorAppFolder + "Resources/CoreData");
fs.copySync(atomicRoot + "Resources/PlayerData",
editorAppFolder + "Resources/PlayerData");
fs.copySync(atomicRoot + "Data/AtomicEditor",
editorAppFolder + "Resources/ToolData");
fs.copySync(atomicRoot + "Resources/EditorData",
editorAppFolder + "Resources/EditorData");
fs.copySync(atomicRoot + "Artifacts/Build/Resources/EditorData/AtomicEditor/EditorScripts",
editorAppFolder + "Resources/EditorData/AtomicEditor/EditorScripts");
fs.copySync(buildDir + "Source/AtomicPlayer/Application/" + config["config"] +"/AtomicPlayer.exe",
editorAppFolder + "Resources/ToolData/Deployment/Windows/x64/AtomicPlayer.exe");
fs.copySync(buildDir + "Source/AtomicPlayer/Application/" + config["config"] + "/D3DCompiler_47.dll",
editorAppFolder + "Resources/ToolData/Deployment/Windows/x64/D3DCompiler_47.dll");
copyAtomicNET();
}
namespace('build', function() {
// get CMake flags for generator, vsver parameter can be VS2017/VS2015, etc
function getCMakeFlags(vsver) {
var flags = "\"";
// Redistributable editor build
flags += "-DATOMIC_DEV_BUILD=0";
// graphics backend overrides, defaults to D3D11
flags += " -DATOMIC_OPENGL=" + (config["opengl"] ? "ON" : "OFF");
flags += " -DATOMIC_D3D9=" + (config["d3d9"] ? "ON" : "OFF");
flags += "\"";
return flags;
}
task('atomiceditor_phase2', {
async: true
}, function() {
process.chdir(buildDir);
var vsver = (config["vs2017"] ? "VS2017" : "VS2015");
var cmds = [];
cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAtomicEditorPhase2.bat " + config["config"] + " " + vsver);
jake.exec(cmds, function() {
copyAtomicEditor();
if (config.package) {
jake.Task['package:windows_editor'].invoke();
}
complete();
}, {
printStdout: true
});
});
// Builds a standalone Atomic Editor, which can be distributed out of build tree
task('atomiceditor', {
async: true
}, function() {
// Always cleanly create the editor target folder
host.cleanCreateDir(editorAppFolder);
// We clean atomicNET here as otherwise platform binaries would be deleted
var createDirs = [config.artifactsRoot + "AtomicNET/", buildDir, host.getGenScriptRootDir()];
var removeDirs = [config.artifactsRoot + "Build/Android/"];
host.setupDirs(!config.noclean, createDirs, removeDirs);
process.chdir(buildDir);
var vsver = (config["vs2017"] ? "VS2017" : "VS2015");
var cmds = [];
// Generate Atomic solution, AtomicTool binary, and script bindings
cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAtomicEditorPhase1.bat " + config["config"] + " " +
vsver + " " + getCMakeFlags(vsver));
jake.exec(cmds, function() {
var rootTask = jake.Task['build:atomiceditor_phase2'];
buildTasks.installBuildTasks(rootTask);
rootTask.addListener('complete', function () {
console.log("\n\nAtomic Editor built to " + editorAppFolder + "\n\n");
complete();
});
rootTask.invoke();
}, {
printStdout: true,
printStderr: true
});
});
});// end of build namespace