From c12f97feb7ad10c155ebfdc90681e62a471b69a9 Mon Sep 17 00:00:00 2001 From: Light3039 Date: Thu, 23 Sep 2021 11:20:57 +0330 Subject: [PATCH] Fixed Linux --- .gitmodules | 2 +- CMake/.gitkeep | 0 CMakeLists.txt | 13 ++++++++++--- Dependencies/ShaderConductor | 2 +- Engine/CMakeLists.txt | 12 +++++++----- Engine/src/Engine/Core/Application.h | 3 ++- Engine/src/Engine/Math/Random.cpp | 6 +++--- Mirror/src/EditorLayer.cpp | 2 +- 8 files changed, 25 insertions(+), 15 deletions(-) delete mode 100644 CMake/.gitkeep diff --git a/.gitmodules b/.gitmodules index 28d057a..74f85a1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,4 +15,4 @@ url = https://github.com/skypjack/entt [submodule "Dependencies/ShaderConductor"] path = Dependencies/ShaderConductor - url = https://github.com/microsoft/shaderconductor + url = https://github.com/Light3039/shaderconductor diff --git a/CMake/.gitkeep b/CMake/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/CMakeLists.txt b/CMakeLists.txt index 77c02f8..98d21fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.14) project(Light VERSION 1.0.0) +set(CMAKE_CXX_STANDARD 14) set(SPIRV_CROSS_ENABLE_TESTS OFF) - +set(INSTALL_GTEST OFF) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error") add_subdirectory(Dependencies/ShaderConductor) # <-- this project should not use "cxx_standard 17" # directories @@ -16,8 +18,13 @@ set(ENGINE_DIR ${CMAKE_BINARY_DIR}/../Engine/) set(DEPENDENCIES_DIR ${CMAKE_BINARY_DIR}/../Dependencies/) # projects -set(CMAKE_CXX_STANDARD 17) -add_compile_definitions(LIGHT_PLATFORM_WINDOWS) +set(CMAKE_CXX_STANDARD 20) + +if(WIN32) + add_compile_definitions(LIGHT_PLATFORM_WINDOWS) +elseif(UNIX) + add_compile_definitions(LIGHT_PLATFORM_LINUX) +endif() add_subdirectory(${ENGINE_DIR}/) add_subdirectory(${MIRROR_DIR}/) diff --git a/Dependencies/ShaderConductor b/Dependencies/ShaderConductor index 30a77c7..9420a9b 160000 --- a/Dependencies/ShaderConductor +++ b/Dependencies/ShaderConductor @@ -1 +1 @@ -Subproject commit 30a77c78d24fa08f4fe5fc4428f10dbfc92717a6 +Subproject commit 9420a9b06a059e7def5e5da15e357281f4382015 diff --git a/Engine/CMakeLists.txt b/Engine/CMakeLists.txt index b20f605..85b6836 100644 --- a/Engine/CMakeLists.txt +++ b/Engine/CMakeLists.txt @@ -62,8 +62,10 @@ endif() message(BINARY DIRECTORY IS IN ${CMAKE_BINARY_DIR}) -add_custom_command( - TARGET Engine - POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_BINARY_DIR}/Dependencies/ShaderConductor/Bin/Debug/ShaderConductor.dll - ${CMAKE_BINARY_DIR}/bin/Debug) +if(WIN32) + add_custom_command( + TARGET Engine + POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_BINARY_DIR}/Dependencies/ShaderConductor/Bin/Debug/ShaderConductor.dll + ${CMAKE_BINARY_DIR}/bin/Debug) +endif() \ No newline at end of file diff --git a/Engine/src/Engine/Core/Application.h b/Engine/src/Engine/Core/Application.h index bebe61f..55a4ae1 100644 --- a/Engine/src/Engine/Core/Application.h +++ b/Engine/src/Engine/Core/Application.h @@ -35,7 +35,6 @@ namespace Light { void GameLoop(); // To be defined in client project - friend Application* CreateApplication(); protected: Application(); @@ -46,4 +45,6 @@ namespace Light { void LogDebugData(); }; + Application* CreateApplication(); + } \ No newline at end of file diff --git a/Engine/src/Engine/Math/Random.cpp b/Engine/src/Engine/Math/Random.cpp index aa68abd..1358905 100644 --- a/Engine/src/Engine/Math/Random.cpp +++ b/Engine/src/Engine/Math/Random.cpp @@ -5,7 +5,7 @@ namespace Light { namespace Math { - float Math::Rand(int min, int max, int decimals /* = 0 */) + float Rand(int min, int max, int decimals /* = 0 */) { const int dec = std::pow(10, decimals); min *= dec; @@ -14,7 +14,7 @@ namespace Light { namespace Math { return (min + (rand() % (max)-min)) / (float)dec; } - glm::vec2 Math::RandVec2(int min, int max, int decimals /* = 0 */) + glm::vec2 RandVec2(int min, int max, int decimals /* = 0 */) { const int dec = std::pow(10, decimals); min *= dec; @@ -26,7 +26,7 @@ namespace Light { namespace Math { return glm::vec2(r1, r2); } - glm::vec3 Math::RandVec3(int min, int max, int decimals /* = 0 */) + glm::vec3 RandVec3(int min, int max, int decimals /* = 0 */) { const int dec = std::pow(10, decimals); min *= dec; diff --git a/Mirror/src/EditorLayer.cpp b/Mirror/src/EditorLayer.cpp index a3eba51..6d1fdbe 100644 --- a/Mirror/src/EditorLayer.cpp +++ b/Mirror/src/EditorLayer.cpp @@ -84,7 +84,7 @@ namespace Light { const glm::vec4 tint = glm::vec4(Math::RandVec3(0, 1, 2), 1.0f); - auto& entity = m_Scene->CreateEntity("quad" + std::to_string(i), { translation, scale, rotation }); + auto entity = m_Scene->CreateEntity("quad" + std::to_string(i), { translation, scale, rotation }); entity.AddComponent(texture, tint); } }