diff --git a/Build/CMake/Modules/AtomicMac.cmake b/Build/CMake/Modules/AtomicMac.cmake index c6e6011fd9..2fd34ce057 100644 --- a/Build/CMake/Modules/AtomicMac.cmake +++ b/Build/CMake/Modules/AtomicMac.cmake @@ -1,5 +1,6 @@ set (JAVASCRIPT_BINDINGS_PLATFORM "MACOSX") +set (ATOMIC_NODE_JAKE Build/Mac/node/node Build/node_modules/jake/bin/cli.js -f Build/Scripts/Bootstrap.js) include (BundleUtilities) include(AtomicDesktop) diff --git a/Build/Scripts/BuildMac.js b/Build/Scripts/BuildMac.js index e69de29bb2..03f62db259 100644 --- a/Build/Scripts/BuildMac.js +++ b/Build/Scripts/BuildMac.js @@ -0,0 +1,106 @@ +var fs = require('fs-extra'); +var path = require("path"); +var host = require("./Host"); +var atomicRoot = host.atomicRoot; + +var buildDir = host.artifactsRoot + "Build/Mac/"; +var editorAppFolder = host.artifactsRoot + "/AtomicEditor/AtomicEditor.app/"; + +namespace('build', function() { + +task('atomiceditor', { + async: true +}, function() { + + // Clean build + var cleanBuild = true; + if (cleanBuild) { + common.cleanCreateDir(buildDir); + common.cleanCreateDir(editorAppFolder); + common.cleanCreateDir(host.getGenScriptRootDir("MACOSX")); + } + + // create the generated script files, so they will be picked up by cmake + host.createGenScriptFiles("MACOSX"); + + process.chdir(buildDir); + + var cmds = []; + + cmds.push("cmake ../../../ -DATOMIC_DEV_BUILD=0 -G Xcode"); + cmds.push("xcodebuild -target GenerateScriptBindings -configuration Release") + cmds.push("xcodebuild -target AtomicEditor -target AtomicPlayer -configuration Release") + + jake.exec(cmds, function() { + + fs.copySync(buildDir + "Source/AtomicEditor/Release/AtomicEditor.app", editorAppFolder); + + var resourceDest = editorAppFolder + "/Contents/Resources/" + + // We need some resources to run + fs.copySync(atomicRoot + "Resources/CoreData", + resourceDest + "CoreData"); + + fs.copySync(atomicRoot + "Resources/PlayerData", + resourceDest + "PlayerData"); + + 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"); + + + console.log("\n\nAtomic Editor build to " + editorAppFolder + "\n\n"); + + complete(); + + }, { + printStdout: true + }); + +}); + +// Generate a XCode Workspace +task('genxcode', { + async: true +}, function() { + + var xcodeRoot = path.resolve(atomicRoot, "") + "-XCode"; + + if (!fs.existsSync(xcodeRoot)) { + jake.mkdirP(xcodeRoot); + } + + // create the generated script files, so they will be picked up by cmake + host.createGenScriptFiles("MACOSX"); + + process.chdir(xcodeRoot); + + var cmds = []; + + cmds.push("cmake ../AtomicGameEngine -DATOMIC_DEV_BUILD=1 -G Xcode"); + cmds.push("xcodebuild -target GenerateScriptBindings -configuration Debug") + + jake.exec(cmds, function() { + + var task = jake.Task['build:genscripts'] + + task.addListener('complete', function () { + console.log("\n\nXCode workspace generated in " + xcodeRoot + "\n\n"); + complete(); + }); + + task.invoke("MACOSX"); + + }, { + printStdout: true + }); + +}); + + +});// end of build namespace diff --git a/Build/Scripts/BuildWindows.js b/Build/Scripts/BuildWindows.js index 970857e6e1..605a028d53 100644 --- a/Build/Scripts/BuildWindows.js +++ b/Build/Scripts/BuildWindows.js @@ -69,7 +69,7 @@ namespace('build', function() { async: true }, function() { - var slnRoot = path.resolve(atomicRoot, "") + "-Build\\"; + var slnRoot = path.resolve(atomicRoot, "") + "-VS2015\\"; if (!fs.existsSync(slnRoot)) { jake.mkdirP(slnRoot); diff --git a/Build/Scripts/Host.js b/Build/Scripts/Host.js index 4ce5a6aa4a..384757a5f1 100644 --- a/Build/Scripts/Host.js +++ b/Build/Scripts/Host.js @@ -5,6 +5,7 @@ if (os.platform() == "win32") { require("./BuildWindows"); } else if (os.platform() == "darwin") { module.exports = require("./HostMac"); + require("./BuildMac"); } require("./BuildCommon"); diff --git a/Build/Scripts/HostMac.js b/Build/Scripts/HostMac.js index 9ff26165ce..1c8ea9fed3 100644 --- a/Build/Scripts/HostMac.js +++ b/Build/Scripts/HostMac.js @@ -1,50 +1,6 @@ -var fs = require('fs-extra'); + common = require("./HostCommon"); // forward exports -var atomicRoot = exports.atomicRoot = common.atomicRoot; -var artifactsRoot = exports.artifactsRoot = common.artifactsRoot; -exports.cleanCreateDir = common.cleanCreateDir; - -var buildDir = common.artifactsRoot + "Build/Mac/"; -var atomicToolBinary = buildDir + "Source/AtomicTool/Debug/AtomicTool"; - -namespace('build', function() { - - task('atomiceditor', { - async: true - }, function() { - - common.cleanCreateDir(buildDir); - - process.chdir(buildDir); - - var bindCmd = atomicToolBinary + " bind \"" + atomicRoot + "\" "; - - var cmds = [ - "cmake ../../../ -DATOMIC_DEV_BUILD=1 -G Xcode", - "xcodebuild -target AtomicTool -configuration Debug", - bindCmd + "Script/Packages/Atomic/ MACOSX", - bindCmd + "Script/Packages/AtomicPlayer/ MACOSX", - bindCmd + "Script/Packages/ToolCore/ MACOSX", - bindCmd + "Script/Packages/Editor/ MACOSX", - bindCmd + "Script/Packages/AtomicNET/ MACOSX", - "cmake ../../../ -DATOMIC_DEV_BUILD=1 -G Xcode", - "xcodebuild -configuration Debug" - ] - - jake.exec(cmds, function() { - - fs.copySync(buildDir + "Source/AtomicEditor/Debug/AtomicEditor.app", artifactsRoot + "Bin/AtomicEditor.app"); - - complete(); - - console.log("AtomicEditor built to: " + artifactsRoot + "Bin/AtomicEditor.app"); - - }, { - printStdout: true - }); - - }); - -}); // end of build namespace +exports = module.exports = common; +exports.atomicTool = exports.artifactsRoot + "Build/AtomicTool/AtomicTool"; diff --git a/Build_AtomicEditor.sh b/Build_AtomicEditor.sh old mode 100644 new mode 100755 diff --git a/CMake_XCode.sh b/CMake_XCode.sh new file mode 100755 index 0000000000..54ad50fcd6 --- /dev/null +++ b/CMake_XCode.sh @@ -0,0 +1,2 @@ +#!/bin/sh +./Build/Mac/node/node ./Build/node_modules/jake/bin/cli.js -f ./Build/Scripts/Bootstrap.js build:genxcode --trace diff --git a/Source/AtomicTool/CMakeLists.txt b/Source/AtomicTool/CMakeLists.txt index b8fe400265..0b46c1abae 100644 --- a/Source/AtomicTool/CMakeLists.txt +++ b/Source/AtomicTool/CMakeLists.txt @@ -26,9 +26,16 @@ add_custom_command( TARGET AtomicTool POST_BUILD ARGS -E make_directory ${CMAKE_SOURCE_DIR}/Artifacts/Build/AtomicTool COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different $ \"${CMAKE_SOURCE_DIR}/Artifacts/Build/AtomicTool/\" - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different \"${D3DCOMPILER_47_DLL}\" \"${CMAKE_SOURCE_DIR}/Artifacts/Build/AtomicTool/D3DCompiler_47.dll\" - COMMENT "Copying AtomicTool to Build Artifacts" ) + COMMAND ${CMAKE_COMMAND} ) + +if (MSVC) + +# Copy the D3D shader compiler +add_custom_command( TARGET AtomicTool POST_BUILD + ARGS -E copy_if_different \"${D3DCOMPILER_47_DLL}\" \"${CMAKE_SOURCE_DIR}/Artifacts/Build/AtomicTool/D3DCompiler_47.dll\" + COMMENT "Copying AtomicTool to Build Artifacts" ) + +endif(MSVC) add_custom_target ( GenerateScriptBindings WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"