Archived
1
Fork 0

Properly copy data on macOS

This also fixes cfg init failing on macOS
This commit is contained in:
Joshua Goins 2022-02-22 09:34:00 -05:00
parent 5d0f629ca7
commit 7f479b0e0b
3 changed files with 14 additions and 10 deletions

View file

@ -68,8 +68,6 @@ engine::engine(const int argc, char* argv[]) {
quit(); quit();
}); });
console::load_cfg(prism::app_domain / "render_options.cfg");
for(int i = 0; i < argc; i++) for(int i = 0; i < argc; i++)
command_line_arguments.emplace_back(argv[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()) { if(platform::supports_feature(PlatformFeature::Windowing) && ::engine->get_app()->is_multimodal()) {
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
} }
console::load_cfg(prism::app_domain / "render_options.cfg");
} }
prism::app* engine::get_app() const { prism::app* engine::get_app() const {

View file

@ -58,11 +58,17 @@ function(add_platform_commands target)
endif() endif()
if(NOT SKIP_DATA) if(NOT SKIP_DATA)
if(ENABLE_MACOS)
add_custom_target(${target}_copy_assets
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/example/data/ $<TARGET_FILE_DIR:${target}>/../Resources/data
)
else()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/data) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/data)
add_custom_target(${target}_copy_assets add_custom_target(${target}_copy_assets
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/example/data/ ${CMAKE_BINARY_DIR}/bin/data COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/example/data/ ${CMAKE_BINARY_DIR}/bin/data
) )
endif()
add_dependencies(${target} ${target}_copy_assets) add_dependencies(${target} ${target}_copy_assets)
endif() endif()
endfunction() endfunction()

View file

@ -463,18 +463,16 @@ int main(int argc, char* argv[]) {
backend.init_func(); backend.init_func();
} }
app = new @APP_CLASS@();
engine->set_app(app);
GFXCreateInfo info = {}; GFXCreateInfo info = {};
if(gfx_interface->initialize(info)) { if(gfx_interface->initialize(info)) {
engine->set_gfx(gfx_interface); engine->set_gfx(gfx_interface);
} else { } else {
return -1; return -1;
} }
app = new @APP_CLASS@();
app_main(engine); app_main(engine);
engine->set_app(app);
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();