Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ if (NOT LAUNCHER_ONLY)
# Editor is here
#
add_subdirectory (Tetragrama)

# Entry point is here
#
add_subdirectory (Obelisk)
endif ()

# Launcher is here
Expand Down Expand Up @@ -105,7 +109,7 @@ add_custom_target (AssembleContent ALL
)

if (NOT LAUNCHER_ONLY)
add_dependencies(AssembleContent zEngineLib tetragrama)
add_dependencies(AssembleContent zEngineLib tetragrama Obelisk)
endif ()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
Expand Down
51 changes: 51 additions & 0 deletions Obelisk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required (VERSION 3.17)

project (Obelisk
VERSION 1.0
DESCRIPTION "Obelisk, The game application entry point"
LANGUAGES CXX
)

set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_STANDARD 20)

set (TARGET_NAME Obelisk)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
add_executable (${TARGET_NAME} WIN32)
else()
add_executable (${TARGET_NAME})
endif()

target_sources(${TARGET_NAME} PUBLIC EntryPoint.cpp)

# We set this debugger directory to find assets and resources file
# after being copied to Debug and Release output directories
#
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(ProjectDir)$(Configuration)")
endif ()

include(${EXTERNAL_DIR}/externals.cmake)

target_include_directories (${TARGET_NAME}
PRIVATE
.
${ENLISTMENT_ROOT}
${ENLISTMENT_ROOT}/ZEngine
)

target_precompile_headers(${TARGET_NAME} PRIVATE pch.h)

target_compile_definitions(${TARGET_NAME}
PRIVATE
NOMINMAX
UNICODE
_UNICODE
)

target_link_libraries(${TARGET_NAME} PRIVATE
zEngineLib
tetragrama
imported::External_obeliskLibs
)
45 changes: 31 additions & 14 deletions Tetragrama/EntryPoint.cpp → Obelisk/EntryPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,54 @@
#include <ZEngine/Core/Memory/MemoryManager.h>
#include <ZEngine/EngineConfiguration.h>
#include <ZEngine/Logging/Logger.h>
#include "Editor.h"
#include <ZEngine/Applications/GameApplication.h>

#include <Tetragrama/Editor.h>

#ifdef ZENGINE_PLATFORM

using namespace ZEngine;
using namespace ZEngine::Logging;
using namespace ZEngine::Core::Memory;
using namespace ZEngine::Applications;

int applicationEntryPoint(int argc, char* argv[])
{
CLI::App app{"ZEngine Editor"};
argv = app.ensure_utf8(argv);

std::string editor_cfg_file{""};
app.add_option("--projectConfigFile", editor_cfg_file, "The project config file");

CLI11_PARSE(app, argc, argv);

MemoryManager manager = {};
MemoryConfiguration config = {.DefaultSize = ZGiga(2u)};
MemoryConfiguration config = {.DefaultSize = ZGiga(3u)};
manager.Initialize(config);
auto arena = &(manager.ArenaAllocator);

LoggerConfiguration logger_cfg = {};
Logger::Initialize(arena, logger_cfg);

auto editor = ZPushStruct(arena, Tetragrama::Editor);
editor->Initialize(arena, editor_cfg_file.c_str());
editor->Run();

editor->Dispose();
GameApplicationPtr app = nullptr;


CLI::App cli{"ObeliskCLI"};
argv = cli.ensure_utf8(argv);

std::string config_file = "";
bool launch_editor = false;
cli.add_option("--projectConfigFile", config_file, "The project config file");
cli.add_option("--launchEditor", launch_editor, "The project config file");

CLI11_PARSE(cli, argc, argv);


if (launch_editor)
{
app = ZPushStructCtor(arena, Tetragrama::Editor);
app->EnableRenderOverlay = true;
}

app->ConfigFile = config_file.c_str();

app->Initialize(arena);
app->Run();
app->Shutdown();

Logger::Dispose();

manager.Shutdowm();
Expand Down
1 change: 1 addition & 0 deletions Obelisk/pch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <pch.h>
18 changes: 18 additions & 0 deletions Obelisk/pch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#include <algorithm>
#include <cctype>
#include <chrono>
#include <cstring>
#include <filesystem>
#include <fstream>
#include <functional>
#include <iostream>
#include <memory>
#include <regex>
#include <span>
#include <stack>
#include <string>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
9 changes: 5 additions & 4 deletions Panzerfaust/Service/EngineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@ public class EngineService : IEngineService
string _enginePath = string.Empty;
string _workingDirectory = string.Empty;

const string _editorAppName = "zEngineEditor";
const string _launcherCLIAppName = "Obelisk";
const string _configJsonFilename = "projectConfig.json";
const string _engineCommandLineArgs = "--projectConfigFile";
const string _projectFileCommandLineArgs = "--projectConfigFile";
const string _editorCommandLineArgs = "--launchEditor 1";

public EngineService()
{
string engineExtension = string.Empty;
#if _WIN32
engineExtension = ".exe";
#endif
_enginePath = Path.Combine(Environment.CurrentDirectory, "Editor", $"{_editorAppName}{engineExtension}");
_enginePath = Path.Combine(Environment.CurrentDirectory, "Editor", $"{_launcherCLIAppName}{engineExtension}");
_workingDirectory = Path.Combine(Environment.CurrentDirectory, "Editor");
}

public async Task StartAsync(string path)
{
List<string> engineArgs = new() { _engineCommandLineArgs, Path.Combine(path, _configJsonFilename) };
List<string> engineArgs = new() { _editorCommandLineArgs, _projectFileCommandLineArgs, Path.Combine(path, _configJsonFilename) };

var processStartInfo = new ProcessStartInfo(_enginePath, string.Join(" ", engineArgs))
{
Expand Down
28 changes: 14 additions & 14 deletions Scripts/PostBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ $ContentsToProcess = @(
Contents = @(
switch ($SystemName) {
"Windows" {
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\$Configurations\Shaders"}
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\$Configurations\Settings"}
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Shaders"}
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Settings"}
}
"Darwin" {
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\$Configurations\Shaders"}
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\$Configurations\Settings"}
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Shaders"}
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Settings"}
}
"Linux" {
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\Shaders"}
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\Settings"}
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\Shaders"}
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\Settings"}
}
Default {
throw 'This system is not supported'
Expand All @@ -79,31 +79,31 @@ $ContentsToProcess = @(
)
},
@{
Name = "Tetragrama"
Name = "Obelisk"
IsDirectory = $true
Contents = @(
switch ($SystemName) {
"Windows" {
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
}
"Darwin" {
switch ($Architectures) {
"osx-x64" {
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
}
"osx-arm64" {
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
}
Default {
throw 'This architecture is not supported'
}
}
}
"Linux" {
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
}
Default {
throw 'This system is not supported'
Expand Down
16 changes: 4 additions & 12 deletions Tetragrama/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ source_group (TREE ${PROJECT_SOURCE_DIR} PREFIX "Source Files" FILES ${HEADER_FI

set (TARGET_NAME tetragrama)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
add_executable (${TARGET_NAME} WIN32)
else()
add_executable (${TARGET_NAME})
endif()
add_library (${TARGET_NAME})

target_sources(${TARGET_NAME} PUBLIC ${HEADER_FILES} ${CPP_FILES})

Expand All @@ -34,7 +30,7 @@ endif ()
include(${EXTERNAL_DIR}/externals.cmake)

target_include_directories (${TARGET_NAME}
PRIVATE
PUBLIC
.
./Components
./Components/Events
Expand All @@ -50,16 +46,12 @@ target_include_directories (${TARGET_NAME}
)

target_precompile_headers(${TARGET_NAME} PRIVATE pch.h)

target_compile_definitions(${TARGET_NAME}
PRIVATE
NOMINMAX
UNICODE
_UNICODE
)

target_link_libraries(${TARGET_NAME} PRIVATE
zEngineLib
imported::External_editorLibs
)

set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "zEngineEditor")
target_link_libraries(${TARGET_NAME} PRIVATE zEngineLib)
Loading
Loading