mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-22 18:28:52 -05:00
Fix issues with asset guarantees. Remove unnecessary bloat in SpecProject CMakeLists
This commit is contained in:
parent
897827ffb5
commit
0cfeeabe54
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <filesystem>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Specter {
|
|||
struct ApplicationArgs
|
||||
{
|
||||
std::string name = "";
|
||||
std::string runtimePath = "";
|
||||
std::filesystem::path runtimePath = "";
|
||||
};
|
||||
|
||||
class Application
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <filesystem>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user