Skip to content

Commit

Permalink
Adding support for Android C# platform on Atomic Editor binary builds…
Browse files Browse the repository at this point in the history
…: ./Build_AtomicEditor.sh --with-android
  • Loading branch information
JoshEngebretson committed Sep 10, 2016
1 parent 401b3b4 commit 61dc38e
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 191 deletions.
50 changes: 25 additions & 25 deletions Build/Scripts/BuildAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@ var buildDir = host.artifactsRoot + "Build/Android/";

namespace('build', function() {

task('android_native', {
async: true
}, function() {
task('android_native', {
async: true
}, function() {

// Clean build
common.cleanCreateDir(buildDir);
// Clean build
common.cleanCreateDir(buildDir);

process.chdir(buildDir);
process.chdir(buildDir);

var cmds = [];
var cmds = [];

if (os.platform() == "win32") {
cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAndroid.bat");
}
else {
cmds.push("cmake -G \"Unix Makefiles\" -DCMAKE_TOOLCHAIN_FILE=../../../Build/CMake/Toolchains/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release ../../../");
cmds.push("make -j4");
}
if (os.platform() == "win32") {
cmds.push(atomicRoot + "Build/Scripts/Windows/CompileAndroid.bat");
}
else {
cmds.push("cmake -G \"Unix Makefiles\" -DCMAKE_TOOLCHAIN_FILE=../../../Build/CMake/Toolchains/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release ../../../");
cmds.push("make -j4");
}

jake.exec(cmds, function() {
jake.exec(cmds, function() {

var editorAppFolder = host.artifactsRoot + (os.platform() == "win32" ? "AtomicEditor/" : "AtomicEditor/AtomicEditor.app/");
var editorAppFolder = host.artifactsRoot + (os.platform() == "win32" ? "AtomicEditor/" : "AtomicEditor/AtomicEditor.app/");

// Install Deployment
fs.copySync(buildDir + "Source/AtomicPlayer/Application/libAtomicPlayer.so",
editorAppFolder + "Resources/ToolData/Deployment/Android/libs/armeabi-v7a/libAtomicPlayer.so");
// Install Deployment
fs.copySync(buildDir + "Source/AtomicPlayer/Application/libAtomicPlayer.so",
editorAppFolder + "Contents/Resources/ToolData/Deployment/Android/libs/armeabi-v7a/libAtomicPlayer.so");

complete();
complete();

}, {
printStdout: true,
breakOnError : false
});
}, {
printStdout: true,
breakOnError : false
});

});
});

}); // end of build namespace
154 changes: 87 additions & 67 deletions Build/Scripts/BuildMac.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,108 +6,128 @@ var atomicRoot = host.atomicRoot;

var buildDir = host.artifactsRoot + "Build/Mac/";
var editorAppFolder = host.artifactsRoot + "/AtomicEditor/AtomicEditor.app/";
var resourceDest = editorAppFolder + "/Contents/Resources/"

namespace('build', function() {

// Builds a standalone Atomic Editor, which can be distributed out of build tree
task('atomiceditor', {
async: true
}, function() {
// Builds a standalone Atomic Editor, which can be distributed out of build tree
task('atomiceditor', {
async: true
}, function(android) {

// Clean build
var cleanBuild = true;
if (cleanBuild) {
common.cleanCreateDir(buildDir);
common.cleanCreateDir(editorAppFolder);
common.cleanCreateDir(host.getGenScriptRootDir("MACOSX"));
}
android = android == "android" ? true : false;

var buildAtomicNET = spawnSync("which", ["xbuild"]).status == 1 ? false : true;
// Clean build
var cleanBuild = true;
if (cleanBuild) {
common.cleanCreateDir(host.artifactsRoot + "AtomicNET/");
common.cleanCreateDir(buildDir);
common.cleanCreateDir(editorAppFolder);
common.cleanCreateDir(host.getGenScriptRootDir());
}

process.chdir(buildDir);
var buildAtomicNET = spawnSync("which", ["xbuild"]).status == 1 ? false : true;

var cmds = [];
process.chdir(buildDir);

cmds.push("cmake ../../../ -DATOMIC_DEV_BUILD=0 -G Xcode");
cmds.push("xcodebuild -target AtomicEditor -target AtomicPlayer -target AtomicNETNative -configuration Release -parallelizeTargets -jobs 4")
var cmds = [];

if (buildAtomicNET)
cmds.push(host.atomicTool + " net compile " + atomicRoot + "Script/AtomicNET/AtomicNETProject.json MACOSX Release");
cmds.push("cmake ../../../ -DATOMIC_DEV_BUILD=0 -G Xcode");
cmds.push("xcodebuild -target AtomicEditor -target AtomicPlayer -target AtomicNETNative -configuration Release -parallelizeTargets -jobs 4")

jake.exec(cmds, function() {
if (buildAtomicNET)
cmds.push(host.atomicTool + " net compile " + atomicRoot + "Script/AtomicNET/AtomicNETProject.json " + (android ? "ANDROID" : "WINDOWS") + " Release");

fs.copySync(buildDir + "Source/AtomicEditor/Release/AtomicEditor.app", editorAppFolder);
function copyAtomicNET() {

var resourceDest = editorAppFolder + "/Contents/Resources/"
if (!buildAtomicNET)
return;

// We need some resources to run
fs.copySync(atomicRoot + "Resources/CoreData",
resourceDest + "CoreData");
fs.copySync(atomicRoot + "Artifacts/AtomicNET/Release",
resourceDest + "ToolData/AtomicNET/Release");

fs.copySync(atomicRoot + "Resources/PlayerData",
resourceDest + "PlayerData");
fs.copySync(atomicRoot + "Script/AtomicNET/AtomicProject.json",
resourceDest + "ToolData/AtomicNET/Build/Projects/AtomicProject.json");

fs.copySync(atomicRoot + "Data/AtomicEditor",
resourceDest + "ToolData");
}

fs.copySync(atomicRoot + "Resources/EditorData",
resourceDest + "EditorData");

fs.copySync(atomicRoot + "Artifacts/Build/Resources/EditorData/AtomicEditor/EditorScripts",
resourceDest + "EditorData/AtomicEditor/EditorScripts");
jake.exec(cmds, function() {

// copy the mac player binary to deployment
var playerBinary = buildDir + "Source/AtomicPlayer/Application/Release/AtomicPlayer.app/Contents/MacOS/AtomicPlayer";
fs.copySync(buildDir + "Source/AtomicEditor/Release/AtomicEditor.app", editorAppFolder);

fs.copySync(playerBinary,
resourceDest + "ToolData/Deployment/MacOS/AtomicPlayer.app/Contents/MacOS/AtomicPlayer");
// We need some resources to run
fs.copySync(atomicRoot + "Resources/CoreData",
resourceDest + "CoreData");

// AtomicNET
if (buildAtomicNET) {

fs.copySync(atomicRoot + "Artifacts/AtomicNET/Release",
resourceDest + "ToolData/AtomicNET/Release");
fs.copySync(atomicRoot + "Resources/PlayerData",
resourceDest + "PlayerData");

fs.copySync(atomicRoot + "Script/AtomicNET/AtomicProject.json",
resourceDest + "ToolData/AtomicNET/Build/Projects/AtomicProject.json");
}
fs.copySync(atomicRoot + "Data/AtomicEditor",
resourceDest + "ToolData");

console.log("\n\nAtomic Editor build to " + editorAppFolder + "\n\n");
fs.copySync(atomicRoot + "Resources/EditorData",
resourceDest + "EditorData");

complete();
fs.copySync(atomicRoot + "Artifacts/Build/Resources/EditorData/AtomicEditor/EditorScripts",
resourceDest + "EditorData/AtomicEditor/EditorScripts");

}, {
printStdout: true
});
// copy the mac player binary to deployment
var playerBinary = buildDir + "Source/AtomicPlayer/Application/Release/AtomicPlayer.app/Contents/MacOS/AtomicPlayer";

});
fs.copySync(playerBinary, resourceDest + "ToolData/Deployment/MacOS/AtomicPlayer.app/Contents/MacOS/AtomicPlayer");

// Generate a XCode Workspace
task('genxcode', {
async: true
}, function() {
if (android) {

var xcodeRoot = path.resolve(atomicRoot, "") + "-XCode";
var androidNativeTask = jake.Task['build:android_native'];

if (!fs.existsSync(xcodeRoot)) {
jake.mkdirP(xcodeRoot);
}
androidNativeTask.addListener('complete', function () {
copyAtomicNET();
console.log("\n\nAtomic Editor build to " + editorAppFolder + "\n\n");
complete();
});

process.chdir(xcodeRoot);
androidNativeTask.invoke();

var cmds = [];
}
else {
copyAtomicNET();
console.log("\n\nAtomic Editor build to " + editorAppFolder + "\n\n");
complete();
}

cmds.push("cmake ../AtomicGameEngine -DATOMIC_DEV_BUILD=1 -G Xcode");
}, {
printStdout: true
});

jake.exec(cmds, function() {
});

complete();
// Generate a XCode Workspace
task('genxcode', {
async: true
}, function() {

}, {
printStdout: true
});
var xcodeRoot = path.resolve(atomicRoot, "") + "-XCode";

});
if (!fs.existsSync(xcodeRoot)) {
jake.mkdirP(xcodeRoot);
}

process.chdir(xcodeRoot);

var cmds = [];

cmds.push("cmake ../AtomicGameEngine -DATOMIC_DEV_BUILD=1 -G Xcode");

jake.exec(cmds, function() {

complete();

}, {
printStdout: true
});

});


});// end of build namespace
Loading

0 comments on commit 61dc38e

Please sign in to comment.