Migrating to Linux

This commit is contained in:
Thorben Höhne 2025-02-17 22:31:17 +01:00
parent c65b1c8139
commit 14f3339eee
75 changed files with 125 additions and 71 deletions

View File

@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.15...3.30)
project(DevPlayground)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../Engine/Source/Runtime ${CMAKE_BINARY_DIR}/Engine)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}../Engine/Source/Runtime)
add_executable(DevPlayground
DevPlayground.cpp
)
add_compile_definitions(P_LINUX_BUILD)
add_compile_definitions(P_DEBUG)
target_link_libraries(DevPlayground PRIVATE PhanesCore)

View File

@ -1,6 +1,5 @@
#define P_USE_NAMESPACE_ALIAS
#include "Phanes.h"
class DevPlayground : public PApp::PhanesProject

View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.15...3.30)
project(PhanesRuntime)
add_subdirectory(Core)

View File

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.15...3.30)
project(PhanesCore)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(Logging/CMakeLists.txt)
include(StartingPoint/CMakeLists.txt)
add_library(PhanesCore STATIC
Core.h
${Logging}
${StartingPoint}
)
target_precompile_headers(PhanesCore PUBLIC
${LoggingPCH}
${StartingPointPCH}
)
add_compile_definitions(P_LINUX_BUILD)
add_compile_definitions(P_DEBUG)
target_include_directories(PhanesCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)

View File

@ -26,9 +26,17 @@
#define FORCEINLINE __forceinline
#elif defined(P_UNIX_BUILD)
#elif defined(P_LINUX_BUILD)
#error Only Windows is supported at the moment.
#ifdef P_DEBUG
#define P_DEBUGBREAK __builtin_trap();
#else
#define P_DEBUGBREAK
#endif
#elif defined(P_ARM_BUILD)
@ -43,7 +51,6 @@
namespace Phanes
{
// Alias for shared_ptr
template<typename T>
using Ref = std::shared_ptr<T>;
@ -65,5 +72,4 @@ namespace Phanes
{
return std::make_unique<T>(std::forward<Args>(args)...);
}
}

View File

@ -2,16 +2,11 @@
// --- Logging -------------------------------------
#include "Core/public/Logging/Logging.h"
#include "Core/Logging/Logging.h"
// --- Starting point ------------------------------
#include "Core/public/StartingPoint/StartingPoint.h"
#include "Core/public/StartingPoint/EntryPoint.h"
// --- OSAL ----------------------------------------
#include "Core/public/HAL/PlatformTypes.h"
#include "Core/StartingPoint/StartingPoint.h"
#include "Core/StartingPoint/EntryPoint.h"
#ifdef P_USE_NAMESPACE_ALIAS

View File

@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.15...3.30)
project(PhanesLogging)
set(Logging
Logging/Logging.h
Logging/private/Logging.cpp
)
set(LoggingPCH
Logging/LoggingPCH.h
)

View File

@ -1,22 +1,18 @@
#pragma once
#include "PhanesEnginePCH.h"
#include "Core/Logging/LoggingPCH.h"
#include "Core/Core.h"
#ifndef P_DEBUG
#pragma warning(disable : 4251) // Disable STL dll export warning
#endif
namespace Phanes::Core::Logging
{
static std::shared_ptr<spdlog::logger> _PEngineLogger;
static std::shared_ptr<spdlog::logger> _PAppLogger;
static Phanes::Ref<spdlog::logger> _PEngineLogger;
static Phanes::Ref<spdlog::logger> _PAppLogger;
PHANES_CORE void Init();
void Init();
PHANES_CORE inline std::shared_ptr<spdlog::logger>& PEngineLogger() { return _PEngineLogger; };
PHANES_CORE inline std::shared_ptr<spdlog::logger>& PAppLogger() { return _PAppLogger; };
inline std::shared_ptr<spdlog::logger>& PEngineLogger() { return _PEngineLogger; };
inline std::shared_ptr<spdlog::logger>& PAppLogger() { return _PAppLogger; };
}

View File

@ -0,0 +1,3 @@
# // spdlog
# include <spdlog/sinks/stdout_color_sinks.h>
# include <spdlog/spdlog.h>

View File

@ -1,6 +1,4 @@
#include "PhanesEnginePCH.h"
#include "Core/public/Logging/Logging.h"
#include "Core/Logging/Logging.h"
void Phanes::Core::Logging::Init()
{

View File

@ -471,7 +471,7 @@ namespace Phanes::Core::Math {
/// <summary>
/// Gets componentwise max of both vectors.
/// </summary>
/// <typeparam name="T">Type of vector</typeparam>
/// <typeparam name="T">Type of vector</typeparam> * @note z does not hold the component, but is a reference two the second item in the components array. The varibale exists wholly for convenience.
/// <typeparam name="A">Vector is aligned?</typeparam>
/// <param name="v1">Vector one</param>
/// <param name="v2">Vector two</param>

View File

@ -4,11 +4,11 @@
#define P_FLT_INAC 0.00001f // float inaccuracy (1*10^-5);
#define P_FLT_INAC_SMALL 0.000001f // small float inaccuracy (1*10^-6);
#define P_180_PI 57.29577951308232 // (double) 180°/pi;
#define P_180_PI_FLT 57.29577951308232f // (float) 180°/pi;
#define P_180_PI 57.29577951308232 // (double) 180<EFBFBD>/pi;
#define P_180_PI_FLT 57.29577951308232f // (float) 180<EFBFBD>/pi;
#define P_PI_180 0.0174532925199432 // double pi/180°
#define P_PI_180_FLT 0.0174532925199432f // (float) pi/180°
#define P_PI_180 0.0174532925199432 // double pi/180<EFBFBD>
#define P_PI_180_FLT 0.0174532925199432f // (float) pi/180<EFBFBD>
#define P_PI 3.1415926535897932 // PI
#define P_PI_FLT 3.1415926535897932f // PI
@ -48,7 +48,7 @@ namespace Phanes::Core::Math {
*/
template<typename T>
inline T Max(T x, T y)
constexpr T Max(T x, T y)
{
return (x > y) ? x : y;
}
@ -64,7 +64,7 @@ namespace Phanes::Core::Math {
*/
template<typename T>
inline T Min(T x, T y)
constexpr T Min(T x, T y)
{
return (x < y) ? x : y;
}

View File

@ -480,7 +480,7 @@ namespace Phanes::Core::Math {
*/
template<RealType T, bool S>
TMatrix3<T, S> TransposeV(TMatrix3<T, S>& m1);
TMatrix3<T, S>& TransposeV(TMatrix3<T, S>& m1);
// =============== //

View File

@ -10,7 +10,7 @@
namespace Phanes::Core::Math
{
template<RealType T, bool S>
TMatrix3<T, S> TransposeV(TMatrix3<T, S>& m)
TMatrix3<T, S>& TransposeV(TMatrix3<T, S>& m)
{
Detail::compute_mat3_transpose<T, S>::map(m, m);
return m;
@ -26,7 +26,7 @@ namespace Phanes::Core::Math
}
template<RealType T, bool S>
TMatrix3<T, S> operator*= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2)
TMatrix3<T, S>& operator*= (TMatrix3<T, S>& m1, const TMatrix3<T, S>& m2)
{
TMatrix3<T, S> r;
Detail::compute_mat3_mul<T, S>::map(r, m1, m2);

View File

@ -23,7 +23,7 @@ namespace Phanes::Core::Math
}
template<RealType T, bool S>
TMatrix4<T, S> TransposeV(TMatrix4<T, S>& a)
TMatrix4<T, S>& TransposeV(TMatrix4<T, S>& a)
{
Detail::compute_mat4_transpose<T, S>::map(a, a);
return a;
@ -44,7 +44,7 @@ namespace Phanes::Core::Math
}
template<RealType T, bool S>
TMatrix4<T, S> operator*= (TMatrix4<T, S>& m1, const TMatrix4<T, S>& m2)
TMatrix4<T, S>& operator*= (TMatrix4<T, S>& m1, const TMatrix4<T, S>& m2)
{
TMatrix4<T, S> r;
Detail::compute_mat4_mul<T, S>::map(r, m1, m2);

View File

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.15...3.30)
project(StartingPoint)
set(StartingPoint
StartingPoint/EntryPoint.h
StartingPoint/StartingPoint.h
StartingPoint/private/StartingPoint.cpp
)
set(StartingPointPCH
StartingPoint/StartingPointPCH.h
)

View File

@ -1,7 +1,7 @@
#pragma once
// Entry point for Phanes game
#if defined(P_WIN_BUILD)
#if defined(P_LINUX_BUILD)
extern Phanes::Core::Application::PhanesProject* Phanes::Core::Application::CreatePhanesGame();

View File

@ -1,12 +1,13 @@
#pragma once
#include "StartingPointPCH.h"
#include "Core/Core.h"
// Entrypoint class for any Phanes game.
namespace Phanes::Core::Application
{
class PHANES_CORE PhanesProject
class PhanesProject
{
private:
@ -27,7 +28,7 @@ namespace Phanes::Core::Application
* Getter for project name;
*/
FORCEINLINE std::string GetName();
std::string GetName();
};

View File

@ -0,0 +1,6 @@
#pragma once
#include <string>
#include <iostream>
#include <thread>
#include <chrono>

View File

@ -1,19 +1,9 @@
#include "PhanesEnginePCH.h"
#define P_USE_NAMESPACE_ALIAS
#define P_TEST
#include "Core/public/StartingPoint/StartingPoint.h"
#include "Core/StartingPoint/StartingPoint.h"
static void IdleMsg()
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 12);
std::cout << "\n\nWelcome to PhanesEngine!" << std::endl << std::endl;
SetConsoleTextAttribute(hConsole, 15);
std::this_thread::sleep_for(std::chrono::seconds(5));
std::cout << "It's silent..." << std::endl << std::endl;

View File

@ -24,12 +24,3 @@
# include <windows.h>
#
# endif
#
#
#
# // spdlog
# include <spdlog/sinks/stdout_color_sinks.h>
# include <spdlog/spdlog.h>
#
# // Local PCH
# include "Core/public/Math/MathPCH.h"

View File

@ -1,4 +0,0 @@
cmake_minimum_required(2.8)
project(MathTestFPU)

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn" version="1.8.1.7" targetFramework="native" />
</packages>