diff --git a/hello_imgui_cmake/assets/him_assets_apple_bundle.cmake b/hello_imgui_cmake/assets/him_assets_apple_bundle.cmake index 96144bd6..f6d78056 100644 --- a/hello_imgui_cmake/assets/him_assets_apple_bundle.cmake +++ b/hello_imgui_cmake/assets/him_assets_apple_bundle.cmake @@ -5,7 +5,7 @@ function(hello_imgui_apple_bundle_add_files_from_folder app_name assets_folder l foreach(asset ${assets}) file(RELATIVE_PATH asset_relative ${assets_folder} ${asset}) get_filename_component(asset_dir ${asset_relative} DIRECTORY) - set_source_files_properties ( + set_source_files_properties( ${asset} PROPERTIES MACOSX_PACKAGE_LOCATION ${location_in_bundle}/${asset_dir} diff --git a/hello_imgui_cmake/assets/him_assets_desktop.cmake b/hello_imgui_cmake/assets/him_assets_desktop.cmake index ced2f8fe..8d6da289 100644 --- a/hello_imgui_cmake/assets/him_assets_desktop.cmake +++ b/hello_imgui_cmake/assets/him_assets_desktop.cmake @@ -6,12 +6,14 @@ # - set the debugger working directory to the output directory (for Win32) -function(_do_copy_asset app_name src dst) +function(_do_install_asset app_name src dst) hello_imgui_get_real_output_directory(${app_name} real_output_directory) - FILE(COPY "${src}" DESTINATION "${real_output_directory}/${dst}") - message(VERBOSE "_do_copy_asset=> FILE(COPY ${src} DESTINATION ${real_output_directory}/${dst})") +# # Copy at configure time +# FILE(COPY "${src}" DESTINATION "${real_output_directory}/${dst}") +# message(VERBOSE "_do_copy_asset=> FILE(COPY ${src} DESTINATION ${real_output_directory}/${dst})") + # Copy at install time if (HELLOIMGUI_ADD_APP_WITH_INSTALL) if (IS_DIRECTORY ${src}) install(DIRECTORY "${src}" DESTINATION "${CMAKE_INSTALL_PREFIX}/${dst}") @@ -29,9 +31,23 @@ function(hello_imgui_bundle_assets_from_folder app_name assets_folder) message(VERBOSE "hello_imgui_bundle_assets_from_folder ${app_name} ${assets_folder}") FILE(GLOB children ${assets_folder}/*) foreach(child ${children}) - _do_copy_asset(${app_name} ${child} assets/) + # Will copy install time + _do_install_asset(${app_name} ${child} assets/) endforeach() + # Copy at build time + if (true) + FILE(GLOB_RECURSE children_files_only LIST_DIRECTORIES false RELATIVE ${assets_folder} ${assets_folder}/*) + hello_imgui_get_real_output_directory(${app_name} real_output_directory) + set(dst_folder "${real_output_directory}/assets") + foreach(child ${children_files_only}) + add_custom_command(TARGET ${app_name} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${assets_folder}/${child}" + "${dst_folder}/${child}") + endforeach () + endif() + if (WIN32) # Fix msvc quirk: set the debugger working dir to the exe dir! hello_imgui_get_real_output_directory(${app_name} app_output_dir) diff --git a/src/hello_imgui/hello_imgui_font.cpp b/src/hello_imgui/hello_imgui_font.cpp index a0537ded..0074714a 100644 --- a/src/hello_imgui/hello_imgui_font.cpp +++ b/src/hello_imgui/hello_imgui_font.cpp @@ -185,7 +185,7 @@ namespace HelloImGui { AssetFileData fontData = LoadAssetFileData(fontFilename.c_str()); font = ImGui_SensibleFont::AddFontFromMemoryTTF_2_KeepOwnership( - fontData.data, fontData.dataSize, fontSize, ¶ms.fontConfig, glyphRangesImVector); + fontData.data, (int)fontData.dataSize, fontSize, ¶ms.fontConfig, glyphRangesImVector); FreeAssetFileData(&fontData); } else