新增编译后自动拷贝资源到resources文件夹下

This commit is contained in:
Nanako 2024-07-04 18:07:51 +08:00
parent 41f2be714e
commit e784400886
3 changed files with 24 additions and 11 deletions

View File

@ -18,13 +18,26 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
# #
target_link_libraries(${PROJECT_NAME} core imgui) target_link_libraries(${PROJECT_NAME} core imgui)
add_definitions(-DIMGUI_USER_CONFIG="widget/user_imconfig.h") add_definitions(-DIMGUI_USER_CONFIG="widget/user_imconfig.h")
#if (WIN32)
# target_sources(${PROJECT_NAME} PRIVATE "manifest.rc") set(RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
# set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/MANIFEST:NO") file(GLOB RESOURCE_FILES ${RESOURCE_DIR}/*)
#endif ()
#if (APPLE) set(RESOURCE_DEST_DIR ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/resources)
# set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/info.plist)
#endif () #
#install( add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
# TARGETS ${PROJECT_NAME} DESTINATION COMMAND ${CMAKE_COMMAND} -E make_directory ${RESOURCE_DEST_DIR}
# RESOURCE DESTINATION ../bin/resources) 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)

Binary file not shown.

View File

@ -46,7 +46,7 @@ void configure_imgui(ImGuiIO& io) {
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); //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()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, nullptr, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != nullptr); //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) { void draw_imgui(float delta_time) {