From 7f479b0e0bd9dc8672e9062e9eb46b7e0f5ccc22 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 22 Feb 2022 09:34:00 -0500 Subject: [PATCH] Properly copy data on macOS This also fixes cfg init failing on macOS --- engine/core/src/engine.cpp | 4 ++-- platforms/sdl/CMakeLists.txt | 14 ++++++++++---- platforms/sdl/main.cpp.in | 6 ++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/engine/core/src/engine.cpp b/engine/core/src/engine.cpp index 9e658cd..7a593a1 100755 --- a/engine/core/src/engine.cpp +++ b/engine/core/src/engine.cpp @@ -68,8 +68,6 @@ engine::engine(const int argc, char* argv[]) { quit(); }); - console::load_cfg(prism::app_domain / "render_options.cfg"); - for(int i = 0; i < argc; i++) command_line_arguments.emplace_back(argv[i]); @@ -89,6 +87,8 @@ void engine::set_app(prism::app* p_app) { if(platform::supports_feature(PlatformFeature::Windowing) && ::engine->get_app()->is_multimodal()) { ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; } + + console::load_cfg(prism::app_domain / "render_options.cfg"); } prism::app* engine::get_app() const { diff --git a/platforms/sdl/CMakeLists.txt b/platforms/sdl/CMakeLists.txt index fbc39f8..76b44c0 100644 --- a/platforms/sdl/CMakeLists.txt +++ b/platforms/sdl/CMakeLists.txt @@ -58,11 +58,17 @@ function(add_platform_commands target) endif() if(NOT SKIP_DATA) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/data) - - add_custom_target(${target}_copy_assets - COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/example/data/ ${CMAKE_BINARY_DIR}/bin/data + if(ENABLE_MACOS) + add_custom_target(${target}_copy_assets + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/example/data/ $/../Resources/data ) + else() + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/data) + + add_custom_target(${target}_copy_assets + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/example/data/ ${CMAKE_BINARY_DIR}/bin/data + ) + endif() add_dependencies(${target} ${target}_copy_assets) endif() endfunction() diff --git a/platforms/sdl/main.cpp.in b/platforms/sdl/main.cpp.in index 00ec48a..8cc7173 100644 --- a/platforms/sdl/main.cpp.in +++ b/platforms/sdl/main.cpp.in @@ -463,18 +463,16 @@ int main(int argc, char* argv[]) { backend.init_func(); } - app = new @APP_CLASS@(); - engine->set_app(app); - GFXCreateInfo info = {}; - if(gfx_interface->initialize(info)) { engine->set_gfx(gfx_interface); } else { return -1; } + app = new @APP_CLASS@(); app_main(engine); + engine->set_app(app); auto end = std::chrono::high_resolution_clock::now();