Просмотр исходного кода

Reorganization, AtomicTool, adding BuildMac to ToolCore, rake can now build runnable editor which uses pak files instead of raw folders

Josh Engebretson 11 лет назад
Родитель
Сommit
1fb66e4206

+ 11 - 1
Rakefile

@@ -205,7 +205,17 @@ namespace :macosx do
 
     Dir.chdir(CMAKE_MACOSX_BUILD_FOLDER) do
       
-      sh "make -j8 AtomicEditor"
+      sh "make -j8 BuildEditorFiles"
+
+    end
+
+  end
+
+  task :cli => ["macosx:player", "macosx:editor"] do
+
+    Dir.chdir(CMAKE_MACOSX_BUILD_FOLDER) do
+      
+      sh "make -j8 AtomicTool"
 
     end
 

+ 0 - 7
Source/AtomicCLI/CMakeLists.txt

@@ -1,7 +0,0 @@
-set (ATOMIC_CLI_SOURCES CLI.cpp CLI.h)
-
-add_executable(atomic-cli ${ATOMIC_CLI_SOURCES})
-
-target_link_libraries(atomic-cli ${ATOMIC_LINK_LIBRARIES} ToolCore Poco curl)
-
-

+ 8 - 8
Source/AtomicCLI/CLI.cpp → Source/AtomicTool/AtomicTool.cpp

@@ -7,27 +7,27 @@
 
 #include <ToolCore/License/LicenseSystem.h>
 
-#include "CLI.h"
+#include "AtomicTool.h"
 
 using namespace ToolCore;
 
-DEFINE_APPLICATION_MAIN(AtomicCLI::CLI);
+DEFINE_APPLICATION_MAIN(AtomicTool::AtomicTool);
 
-namespace AtomicCLI
+namespace AtomicTool
 {
 
-CLI::CLI(Context* context) :
+AtomicTool::AtomicTool(Context* context) :
     Application(context)
 {
 
 }
 
-CLI::~CLI()
+AtomicTool::~AtomicTool()
 {
 
 }
 
-void CLI::Setup()
+void AtomicTool::Setup()
 {
     const Vector<String>& arguments = GetArguments();
 
@@ -46,7 +46,7 @@ void CLI::Setup()
     engineParameters_["ResourcePaths"] = "";
 }
 
-void CLI::Start()
+void AtomicTool::Start()
 {
     context_->RegisterSubsystem(new ToolSystem(context_));
 
@@ -55,7 +55,7 @@ void CLI::Start()
     // END LICENSE MANAGEMENT
 }
 
-void CLI::Stop()
+void AtomicTool::Stop()
 {
 
 }

+ 5 - 5
Source/AtomicCLI/CLI.h → Source/AtomicTool/AtomicTool.h

@@ -5,17 +5,17 @@
 
 using namespace Atomic;
 
-namespace AtomicCLI
+namespace AtomicTool
 {
 
-class CLI : public Application
+class AtomicTool : public Application
 {
-    OBJECT(CLI);
+    OBJECT(AtomicTool);
 
 public:
 
-    CLI(Context* context);
-    virtual ~CLI();
+    AtomicTool(Context* context);
+    virtual ~AtomicTool();
 
     /// Setup before engine initialization. Verify that a script file has been specified.
     virtual void Setup();

+ 7 - 0
Source/AtomicTool/CMakeLists.txt

@@ -0,0 +1,7 @@
+set (ATOMIC_TOOL_SOURCES AtomicTool.cpp AtomicTool.h)
+
+add_executable(AtomicTool ${ATOMIC_TOOL_SOURCES})
+
+target_link_libraries(AtomicTool ${ATOMIC_LINK_LIBRARIES} ToolCore Poco curl)
+
+

+ 1 - 1
Source/CMakeLists.txt

@@ -6,7 +6,7 @@ add_subdirectory(AtomicPlayer)
 
 if (NOT IOS AND NOT ANDROID AND NOT EMSCRIPTEN)    
 	add_subdirectory(ToolCore)
-	add_subdirectory(AtomicCLI)
+	add_subdirectory(AtomicTool)
     add_subdirectory(AtomicEditor)
     add_subdirectory(Tools)
 endif()

+ 98 - 0
Source/ToolCore/Build/BuildMac.cpp

@@ -0,0 +1,98 @@
+// 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 "BuildMac.h"
+#include "BuildSystem.h"
+
+namespace ToolCore
+{
+
+BuildMac::BuildMac(Context * context) : BuildBase(context)
+{
+
+}
+
+BuildMac::~BuildMac()
+{
+
+}
+
+void BuildMac::Initialize()
+{
+    ToolSystem* tools = GetSubsystem<ToolSystem>();
+    Project* project = tools->GetProject();
+
+    FileSystem* fileSystem = GetSubsystem<FileSystem>();
+
+#ifdef ATOMIC_PLATFORM_WINDOWS
+    String bundleResources = fileSystem->GetProgramDir();
+#else
+    String bundleResources = fileSystem->GetAppBundleResourceFolder();
+#endif
+
+    String projectResources = project->GetResourcePath();
+    String coreDataFolder = bundleResources + "CoreData/";
+
+    AddResourceDir(coreDataFolder);
+    AddResourceDir(projectResources);
+
+    BuildResourceEntries();
+
+}
+
+void BuildMac::Build(const String& buildPath)
+{
+    buildPath_ = buildPath + "/Mac-Build";
+
+    Initialize();
+
+    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
+
+    FileSystem* fileSystem = GetSubsystem<FileSystem>();
+    if (fileSystem->DirExists(buildPath_))
+        fileSystem->RemoveDir(buildPath_, true);
+
+ #ifdef ATOMIC_PLATFORM_WINDOWS
+    String buildSourceDir = fileSystem->GetProgramDir();
+ #else
+    String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
+ #endif
+
+    buildSourceDir += "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(buildSourceDir + "/Contents/Resources/Atomic.icns", buildPath_ + "/Contents/Resources/Atomic.icns");
+
+    fileSystem->Copy(buildSourceDir + "/Contents/Info.plist", buildPath_ + "/Contents/Info.plist");
+    fileSystem->Copy(buildSourceDir + "/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_);
+
+}
+
+}

+ 30 - 0
Source/ToolCore/Build/BuildMac.h

@@ -0,0 +1,30 @@
+// 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 BuildMac : public BuildBase
+{
+    OBJECT(BuildMac);
+
+public:
+
+    BuildMac(Context* context);
+    virtual ~BuildMac();
+
+    void Build(const String& buildPath);
+
+protected:
+
+    void Initialize();
+
+
+};
+
+}

+ 6 - 0
Source/ToolCore/ToolSystem.h

@@ -25,6 +25,9 @@ public:
     bool LoadProject(const String& fullpath);
     Project* GetProject() { return project_; }
 
+    const String& GetDataPath() { return dataPath_; }
+    void SetDataPath(const String& path) { dataPath_ = path; }
+
     // Platforms
     void RegisterPlatform(Platform* platform);
     void SetCurrentPlatform(PlatformID platform);
@@ -32,6 +35,9 @@ public:
 
 private:
 
+    /// Full path to data files
+    String dataPath_;
+
     SharedPtr<Platform> currentPlatform_;
 
     // PlatformID -> platform