Browse Source

Adding windows atomic-cli platform

Josh Engebretson 10 years ago
parent
commit
7b498be34f

+ 2 - 0
CLI/atomic-cli-windows-data/.gitignore

@@ -0,0 +1,2 @@
+node_modules/*
+data/editor/*

+ 0 - 0
CLI/atomic-cli-windows-data/.npmignore


+ 10 - 0
CLI/atomic-cli-windows-data/data/index.js

@@ -0,0 +1,10 @@
+
+var ATOMICTOOL_BIN = __dirname  + "/editor/AtomicEditor/Applications/CommandLine/AtomicTool.exe";
+var ATOMICEDITOR_DATADIR = __dirname  + "/editor/AtomicEditor";
+var ATOMICEDITOR_APP = __dirname  + "/editor/AtomicEditor/AtomicEditor.exe";
+
+module.exports = {
+  "ATOMICTOOL_BIN" : ATOMICTOOL_BIN,
+  "ATOMICEDITOR_APP" : ATOMICEDITOR_APP,
+  "ATOMICEDITOR_DATADIR" : ATOMICEDITOR_DATADIR
+}

+ 11 - 0
CLI/atomic-cli-windows-data/package.json

@@ -0,0 +1,11 @@
+{
+  "description": "Windows data for atomic-cli-windows package",
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "homepage": "http://www.AtomicGameEngine.com",
+  "files" : ["data"],
+  "main": "./data/index.js",
+  "name": "atomic-cli-windows-data",
+  "version": "0.0.1"
+}

+ 1 - 0
CLI/atomic-cli-windows/.gitignore

@@ -0,0 +1 @@
+node_modules/*

+ 0 - 0
CLI/atomic-cli-windows/.npmignore


+ 5 - 0
CLI/atomic-cli-windows/README.md

@@ -0,0 +1,5 @@
+# Atomic Game Engine - Windows Dependencies
+
+Windows dependencies for the atomic-cli package
+
+![A screenshot of your package](https://f.cloud.github.com/assets/69169/2290250/c35d867a-a017-11e3-86be-cd7c5bf3ff9b.gif)

+ 9 - 0
CLI/atomic-cli-windows/index.js

@@ -0,0 +1,9 @@
+
+atomic_data = require('atomic-cli-windows-data');
+
+module.exports = {
+  "ATOMICTOOL_BIN" : atomic_data.ATOMICTOOL_BIN,
+  "ATOMICEDITOR_APP" : atomic_data.ATOMICEDITOR_APP,
+  "ATOMICEDITOR_DATADIR" : atomic_data.ATOMICEDITOR_DATADIR
+
+}

+ 5 - 1
CLI/atomic-cli/lib/atomiceditor.js

@@ -5,7 +5,11 @@ try {
   var platform_cli = require('atomic-cli-mac');
 }
 catch (e) {
-  console.log(e);
+}
+try {
+  var platform_cli = require('atomic-cli-windows');
+}
+catch (e) {
 }
 
 var atomiceditor = function (flags, opts) {

+ 15 - 4
CLI/atomic-cli/lib/atomictool.js

@@ -9,13 +9,20 @@ try {
   var platform_cli = require('atomic-cli-mac');
 }
 catch (e) {
-  console.log(e);
+}
+try {
+  var platform_cli = require('atomic-cli-windows');
+}
+catch (e) {
 }
 
 var mode = process.env.ATOMIC_GAME_ENGINE_ENV || 'production';
-if (mode == 'dev')
-  platform_cli.ATOMICTOOL_BIN = "/Users/josh/Dev/atomic/AtomicGameEngine-build/Source/AtomicTool/AtomicTool"
-
+if (mode == 'dev') {
+  if (process.platform == 'darwin')
+    platform_cli.ATOMICTOOL_BIN = "/Users/josh/Dev/atomic/AtomicGameEngine-build/Source/AtomicTool/AtomicTool";
+  else
+    platform_cli.ATOMICTOOL_BIN = "C:/Dev/atomic/AtomicGameEngine-build/Source/AtomicTool/AtomicTool.exe";
+}
 // Commands ----------------------
 
 var newProject = function(folder) {
@@ -54,6 +61,10 @@ var run = function (platform, opts) {
               open(path.resolve("Build/Mac-Build/AtomicPlayer.app"));
               break;
 
+          case "windows":
+              var open = require("open");
+              open(path.resolve("Build/Windows-Build/AtomicPlayer.exe"));
+              break;
         }
     };
 

+ 2 - 1
CLI/atomic-cli/package.json

@@ -16,7 +16,8 @@
   "devDependencies" : {
   },
   "optionalDependencies" : {
-    "atomic-cli-mac" : "0.0.3"
+    "atomic-cli-mac" : "0.0.3",
+    "atomic-cli-windows" : "0.0.1"
   },
   "description": "CLI for the Atomic Game Engine",
   "engines": {

+ 124 - 0
Source/ToolCore/Build/BuildWindows.cpp

@@ -0,0 +1,124 @@
+// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
+// Please see LICENSE.md in repository root for license information
+// https://github.com/AtomicGameEngine/AtomicGameEngine
+
+#include <Atomic/IO/FileSystem.h>
+
+#include "../ToolSystem.h"
+#include "../Project/Project.h"
+#include "BuildWindows.h"
+#include "BuildSystem.h"
+
+namespace ToolCore
+{
+
+BuildWindows::BuildWindows(Context * context, Project *project) : BuildBase(context, project)
+{
+
+}
+
+BuildWindows::~BuildWindows()
+{
+
+}
+
+void BuildWindows::Initialize()
+{
+    ToolSystem* tsystem = GetSubsystem<ToolSystem>();
+    Project* project = tsystem->GetProject();
+
+    String dataPath = tsystem->GetDataPath();
+    String projectResources = project->GetResourcePath();
+    String coreDataFolder = dataPath + "CoreData/";
+
+    AddResourceDir(coreDataFolder);
+    AddResourceDir(projectResources);
+
+    BuildResourceEntries();
+
+}
+
+void BuildWindows::Build(const String& buildPath)
+{
+    ToolSystem* tsystem = GetSubsystem<ToolSystem>();
+
+    buildPath_ = AddTrailingSlash(buildPath) + GetBuildSubfolder();
+
+    Initialize();
+
+    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
+
+    FileSystem* fileSystem = GetSubsystem<FileSystem>();
+    if (fileSystem->DirExists(buildPath_))
+        fileSystem->RemoveDir(buildPath_, true);
+
+    String buildSourceDir = tsystem->GetDataPath();
+
+    buildSourceDir += "Deployment/Win64";
+
+    fileSystem->CreateDir(buildPath_);
+    fileSystem->CreateDir(buildPath_ + "/AtomicPlayer_Resources");
+
+    String resourcePackagePath = buildPath_ + "/AtomicPlayer_Resources/AtomicResources.pak";
+    GenerateResourcePackage(resourcePackagePath);
+
+    fileSystem->Copy(buildSourceDir + "/AtomicPlayer.exe", buildPath_ + "/AtomicPlayer.exe");
+    fileSystem->Copy(buildSourceDir + "/D3DCompiler_47.dll", buildPath_ + "/D3DCompiler_47.dll");
+
+    buildSystem->BuildComplete(PLATFORMID_WINDOWS, buildPath_);
+
+}
+
+
+
+/*
+void BuildWindows::Build(const String& buildPath)
+{
+    ToolSystem* tsystem = GetSubsystem<ToolSystem>();
+
+    buildPath_ = AddTrailingSlash(buildPath) + GetBuildSubfolder();
+
+    Initialize();
+
+    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
+
+    FileSystem* fileSystem = GetSubsystem<FileSystem>();
+    if (fileSystem->DirExists(buildPath_))
+        fileSystem->RemoveDir(buildPath_, true);
+
+    String dataPath = tsystem->GetDataPath();
+
+    String appSrcPath = dataPath + "Deployment/MacOS/AtomicPlayer.app";
+
+    fileSystem->CreateDir(buildPath_);
+
+    buildPath_ += "/AtomicPlayer.app";
+
+    fileSystem->CreateDir(buildPath_);
+
+    fileSystem->CreateDir(buildPath_ + "/Contents");
+    fileSystem->CreateDir(buildPath_ + "/Contents/MacOS");
+    fileSystem->CreateDir(buildPath_ + "/Contents/Resources");
+
+    String resourcePackagePath = buildPath_ + "/Contents/Resources/AtomicResources.pak";
+    GenerateResourcePackage(resourcePackagePath);
+
+    fileSystem->Copy(appSrcPath + "/Contents/Resources/Atomic.icns", buildPath_ + "/Contents/Resources/Atomic.icns");
+
+    fileSystem->Copy(appSrcPath + "/Contents/Info.plist", buildPath_ + "/Contents/Info.plist");
+    fileSystem->Copy(appSrcPath + "/Contents/MacOS/AtomicPlayer", buildPath_ + "/Contents/MacOS/AtomicPlayer");
+
+#ifdef ATOMIC_PLATFORM_OSX
+    Vector<String> args;
+    args.Push("+x");
+    args.Push(buildPath_ + "/Contents/MacOS/AtomicPlayer");
+    fileSystem->SystemRun("chmod", args);
+#endif
+
+    buildPath_ = buildPath + "/Mac-Build";
+    buildSystem->BuildComplete(PLATFORMID_MAC, buildPath_);
+
+}
+*/
+
+}

+ 33 - 0
Source/ToolCore/Build/BuildWindows.h

@@ -0,0 +1,33 @@
+// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
+// Please see LICENSE.md in repository root for license information
+// https://github.com/AtomicGameEngine/AtomicGameEngine
+
+#pragma once
+
+#include "BuildBase.h"
+
+namespace ToolCore
+{
+
+class Project;
+
+class BuildWindows : public BuildBase
+{
+    OBJECT(BuildWindows);
+
+public:
+
+    BuildWindows(Context* context, Project* project);
+    virtual ~BuildWindows();
+
+    String GetBuildSubfolder() { return "Windows-Build"; }
+
+    void Build(const String& buildPath);
+
+protected:
+
+    void Initialize();
+
+};
+
+}

+ 1 - 4
Source/ToolCore/Command/BuildCmd.cpp

@@ -65,10 +65,7 @@ void BuildCmd::Run()
 
     Platform* platform = NULL;
 
-    if (buildPlatform_ == "mac")
-        platform = tsystem->GetPlatformByID(PLATFORMID_MAC);    
-    else if (buildPlatform_ == "web")
-        platform = tsystem->GetPlatformByID(PLATFORMID_WEB);
+    platform = tsystem->GetPlatformByName(buildPlatform_);
 
     if (!platform)
     {

+ 24 - 0
Source/ToolCore/Platform/PlatformWindows.cpp

@@ -0,0 +1,24 @@
+
+#include "../Project/Project.h"
+#include "../Build/BuildWindows.h"
+#include "PlatformWindows.h"
+
+namespace ToolCore
+{
+
+PlatformWindows::PlatformWindows(Context* context) : Platform(context)
+{
+
+}
+
+PlatformWindows::~PlatformWindows()
+{
+
+}
+
+BuildBase* PlatformWindows::NewBuild(Project *project)
+{
+    return new BuildWindows(context_, project);
+}
+
+}

+ 25 - 0
Source/ToolCore/Platform/PlatformWindows.h

@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "Platform.h"
+
+namespace ToolCore
+{
+
+class PlatformWindows : public Platform
+{
+    OBJECT(PlatformWindows);
+
+public:
+
+    PlatformWindows(Context* context);
+    virtual ~PlatformWindows();
+
+    String GetName() { return "WINDOWS"; }
+    PlatformID GetPlatformID() { return PLATFORMID_WINDOWS; }
+
+    BuildBase* NewBuild(Project* project);
+
+};
+
+}

+ 2 - 0
Source/ToolCore/ToolSystem.cpp

@@ -5,6 +5,7 @@
 
 #include "Platform/PlatformWeb.h"
 #include "Platform/PlatformMac.h"
+#include "Platform/PlatformWindows.h"
 #include "Net/CurlManager.h"
 #include "License/LicenseSystem.h"
 #include "Build/BuildSystem.h"
@@ -27,6 +28,7 @@ ToolSystem::ToolSystem(Context* context) : Object(context),
     // platform registration
     RegisterPlatform(new PlatformMac(context));
     RegisterPlatform(new PlatformWeb(context));
+    RegisterPlatform(new PlatformWindows(context));
 }
 
 ToolSystem::~ToolSystem()