diff --git a/Arona/CMakeLists.txt b/Arona/CMakeLists.txt index d2335b5..9c08ce5 100644 --- a/Arona/CMakeLists.txt +++ b/Arona/CMakeLists.txt @@ -18,13 +18,26 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) # 添加链接库 target_link_libraries(${PROJECT_NAME} core imgui) add_definitions(-DIMGUI_USER_CONFIG="widget/user_imconfig.h") -#if (WIN32) -# target_sources(${PROJECT_NAME} PRIVATE "manifest.rc") -# set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/MANIFEST:NO") -#endif () -#if (APPLE) -# set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/info.plist) -#endif () -#install( -# TARGETS ${PROJECT_NAME} DESTINATION -# RESOURCE DESTINATION ../bin/resources) + +set(RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources) +file(GLOB RESOURCE_FILES ${RESOURCE_DIR}/*) + +set(RESOURCE_DEST_DIR ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/resources) + +# 添加构建后拷贝命令 +add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${RESOURCE_DEST_DIR} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${RESOURCE_DIR} ${RESOURCE_DEST_DIR} + COMMENT "Copying resource files to build directory" +) + +# 如果你想让资源文件在构建过程中的某个阶段参与依赖关系 +add_custom_target(CopyResources ALL + COMMAND ${CMAKE_COMMAND} -E make_directory ${RESOURCE_DEST_DIR} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${RESOURCE_DIR} ${RESOURCE_DEST_DIR} + COMMENT "Copying resource files to build directory" +) +message(STATUS "Resource files will be copied to ${RESOURCE_DEST_DIR}") + +# 确保可执行文件在拷贝资源文件之后生成 +add_dependencies(${PROJECT_NAME} CopyResources) \ No newline at end of file diff --git a/Arona/resources/GenJyuuGothic-Normal-2.ttf b/Arona/resources/GenJyuuGothic-Normal-2.ttf new file mode 100644 index 0000000..8990e9d Binary files /dev/null and b/Arona/resources/GenJyuuGothic-Normal-2.ttf differ diff --git a/Arona/src/arona_application.cpp b/Arona/src/arona_application.cpp index 6db5041..1885e04 100644 --- a/Arona/src/arona_application.cpp +++ b/Arona/src/arona_application.cpp @@ -46,7 +46,7 @@ void configure_imgui(ImGuiIO& io) { //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, nullptr, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != nullptr); - auto font = io.Fonts->AddFontFromFileTTF("GenJyuuGothic-Normal-2.ttf", 18.f * dpi_scale); + auto font = io.Fonts->AddFontFromFileTTF("resources/GenJyuuGothic-Normal-2.ttf", 18.f * dpi_scale); } void draw_imgui(float delta_time) {