diff --git a/SpecProject/CMakeLists.txt b/SpecProject/CMakeLists.txt index 293b61e..abf8173 100644 --- a/SpecProject/CMakeLists.txt +++ b/SpecProject/CMakeLists.txt @@ -23,28 +23,12 @@ target_sources(SpecProject PRIVATE ./src/SPSInputLayer.h ) -set(THREADS_PREFER_PTHREAD_FLAG On) -find_package(Threads REQUIRED) -target_link_libraries(SpecProject PRIVATE Specter Threads::Threads glad glfw imgui) - -if(APPLE) - target_link_libraries(SpecProject PRIVATE "-framework Cocoa" "-framework CoreVideo" "-framework IOKit" "-framework OpenGL" "-framework Carbon" ${CMAKE_DL_LIBS}) - target_compile_definitions(SpecProject PRIVATE SPEC_APPLE) -elseif(UNIX) - target_link_libraries(SpecProject PRIVATE libGL.so libX11.so ${CMAKE_DL_LIBS}) - target_compile_definitions(SpecProject PRIVATE SPEC_LINUX) -elseif(MSVC) - target_link_libraries(SpecProject PRIVATE opengl32.lib) - target_compile_definitions(SpecProject PRIVATE SPEC_WINDOWS) -endif() - -if(CMAKE_BUILD_TYPE STREQUAL "Release") - target_compile_definitions(SpecProject PRIVATE SPEC_RELEASE) -elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") - target_compile_definitions(SpecProject PRIVATE SPEC_DEBUG) -endif() +target_link_libraries(SpecProject PRIVATE Specter) set_target_properties(SpecProject PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SPECTER_BINARY_DIR}) -#No longer needed, but maybe come back if I don't like the programatic solution -#add_custom_command(TARGET SpecProject POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Assets ${SPECTER_BINARY_DIR}/Assets) +add_custom_command(TARGET SpecProject + POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink + ${CMAKE_CURRENT_SOURCE_DIR}/Assets + ${SPECTER_BINARY_DIR}/Assets +) diff --git a/SpecProject/src/main.cpp b/SpecProject/src/main.cpp index f232c2b..8fa06a0 100644 --- a/SpecProject/src/main.cpp +++ b/SpecProject/src/main.cpp @@ -29,14 +29,11 @@ Specter::Application* Specter::CreateApplication(const ApplicationArgs& args) { int main(int argc, const char** argv) { Specter::Logger::Init(); - SPEC_TRACE("Logger Initialized!"); + SPEC_INFO("Logger Initialized"); Specter::ApplicationArgs args; args.name = "SPS Specter"; - if (std::filesystem::current_path().string().find("SpecProject") != std::string::npos) - args.runtimePath = ""; //Dont modify runtime path, already points to SpecProject - else - args.runtimePath = "../SpecProject"; //Assume we're attempting to run from bin dir? Technically would also work for any new subproject made by same method as SpecProject + args.runtimePath = std::filesystem::current_path(); SPEC_PROFILE_BEGIN_SESSION("Startup", "navprofile_startup.json"); auto app = Specter::CreateApplication(args); diff --git a/Specter/src/Specter.h b/Specter/src/Specter.h index 18387e8..b86977d 100644 --- a/Specter/src/Specter.h +++ b/Specter/src/Specter.h @@ -21,6 +21,7 @@ #include #include #include +#include #include diff --git a/Specter/src/Specter/Core/Application.cpp b/Specter/src/Specter/Core/Application.cpp index 144d41c..8d6dfea 100644 --- a/Specter/src/Specter/Core/Application.cpp +++ b/Specter/src/Specter/Core/Application.cpp @@ -25,9 +25,12 @@ namespace Specter { s_instance = this; - //Set the runtime path so that we can find our assets - if(!m_args.runtimePath.empty()) - std::filesystem::current_path(m_args.runtimePath); + //Check that there is an Assets directory in our runtime + std::filesystem::path assetPath = args.runtimePath / "Assets"; + if(!std::filesystem::exists(assetPath)) + { + SPEC_WARN("No Assets directory detected in runtime path!"); + } SPEC_INFO("Runtime Directory: {0}", std::filesystem::current_path().string()); diff --git a/Specter/src/Specter/Core/Application.h b/Specter/src/Specter/Core/Application.h index 86e43f1..d117fd0 100644 --- a/Specter/src/Specter/Core/Application.h +++ b/Specter/src/Specter/Core/Application.h @@ -28,7 +28,7 @@ namespace Specter { struct ApplicationArgs { std::string name = ""; - std::string runtimePath = ""; + std::filesystem::path runtimePath = ""; }; class Application diff --git a/Specter/src/specpch.h b/Specter/src/specpch.h index 6eb052e..700773a 100644 --- a/Specter/src/specpch.h +++ b/Specter/src/specpch.h @@ -13,6 +13,7 @@ #include #include #include +#include #include