diff --git a/cmake/resources/app-icon.png b/cmake/resources/app-icon.png new file mode 100644 index 00000000..40161ffe Binary files /dev/null and b/cmake/resources/app-icon.png differ diff --git a/cmake/yup_standalone.cmake b/cmake/yup_standalone.cmake index 8b9ba81d..b6866e58 100644 --- a/cmake/yup_standalone.cmake +++ b/cmake/yup_standalone.cmake @@ -24,7 +24,7 @@ function (yup_standalone_app) set (options "") set (one_value_args # Globals - TARGET_NAME TARGET_VERSION TARGET_CONSOLE TARGET_IDE_GROUP TARGET_APP_ID TARGET_APP_NAMESPACE + TARGET_NAME TARGET_VERSION TARGET_CONSOLE TARGET_IDE_GROUP TARGET_APP_ID TARGET_APP_NAMESPACE TARGET_ICON # Emscripten INITIAL_MEMORY PTHREAD_POOL_SIZE CUSTOM_PLIST CUSTOM_SHELL) set (multi_value_args @@ -40,6 +40,7 @@ function (yup_standalone_app) set (target_console "${YUP_ARG_TARGET_CONSOLE}") set (target_app_id "${YUP_ARG_TARGET_APP_ID}") set (target_app_namespace "${YUP_ARG_TARGET_APP_NAMESPACE}") + set (target_resources "") set (additional_definitions "") set (additional_options "") set (additional_libraries "") @@ -92,30 +93,37 @@ function (yup_standalone_app) if ("${yup_platform}" MATCHES "^(osx|ios)$") if (NOT "${target_console}") _yup_set_default (YUP_ARG_CUSTOM_PLIST "${CMAKE_SOURCE_DIR}/cmake/platforms/${yup_platform}/Info.plist") - _yup_valid_identifier_string ("org.kunitoki.yup.${target_name}" target_gui_identifier) + _yup_valid_identifier_string ("${target_app_namespace}" target_app_namespace) + + _yup_set_default (YUP_ARG_TARGET_ICON "${CMAKE_SOURCE_DIR}/cmake/resources/app-icon.png") + _yup_convert_png_to_icns ("${YUP_ARG_TARGET_ICON}" "${CMAKE_CURRENT_BINARY_DIR}/icons" target_iconset) + get_filename_component (target_iconset_name "${target_iconset}" NAME) + target_sources (${target_name} PRIVATE ${target_iconset}) + list (APPEND target_resources "${target_iconset}") set_target_properties (${target_name} PROPERTIES BUNDLE ON CXX_EXTENSIONS OFF MACOSX_BUNDLE_EXECUTABLE_NAME "${target_name}" - MACOSX_BUNDLE_GUI_IDENTIFIER "${target_gui_identifier}" + MACOSX_BUNDLE_GUI_IDENTIFIER "${target_app_namespace}" MACOSX_BUNDLE_BUNDLE_NAME "${target_name}" MACOSX_BUNDLE_BUNDLE_VERSION "${target_version}" MACOSX_BUNDLE_LONG_VERSION_STRING "${target_version}" MACOSX_BUNDLE_SHORT_VERSION_STRING "${target_version_short}" - #MACOSX_BUNDLE_ICON_FILE "Icon.icns" MACOSX_BUNDLE_INFO_PLIST "${YUP_ARG_CUSTOM_PLIST}" - #RESOURCE "${RESOURCE_FILES}" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${target_gui_identifier}" - #XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" - XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED OFF - XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT dwarf - XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN ON - XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME OFF) + MACOSX_BUNDLE_ICON_FILE "${target_iconset_name}" + RESOURCE "${target_resources}" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${target_gui_identifier}") + endif() set_target_properties (${target_name} PROPERTIES - XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC OFF) + #XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED OFF + XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT dwarf + XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN ON + XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC OFF + XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME OFF) elseif ("${yup_platform}" MATCHES "^(emscripten)$") if (NOT "${target_console}") diff --git a/cmake/yup_utilities.cmake b/cmake/yup_utilities.cmake index 1044113c..b7403940 100644 --- a/cmake/yup_utilities.cmake +++ b/cmake/yup_utilities.cmake @@ -225,9 +225,10 @@ function (_yup_convert_png_to_icns png_path icons_path output_variable) # TODO - check png_path has png extension - add_custom_command( - OUTPUT "${output_iconset_path}" - COMMAND mkdir -p "${temp_iconset_name}" + file (MAKE_DIRECTORY "${temp_iconset_path}") + + execute_process( + COMMAND mkdir -p "${temp_iconset_path}" COMMAND sips -z 16 16 -s format png "${png_path}" --out "${temp_iconset_path}/icon_16x16.png" COMMAND sips -z 32 32 -s format png "${png_path}" --out "${temp_iconset_path}/icon_32x32.png" COMMAND sips -z 32 32 -s format png "${png_path}" --out "${temp_iconset_path}/icon_16x16@2x.png" @@ -238,8 +239,10 @@ function (_yup_convert_png_to_icns png_path icons_path output_variable) COMMAND sips -z 512 512 -s format png "${png_path}" --out "${temp_iconset_path}/icon_256x256@2x.png" COMMAND sips -z 512 512 -s format png "${png_path}" --out "${temp_iconset_path}/icon_512x512.png" COMMAND sips -z 1024 1024 -s format png "${png_path}" --out "${temp_iconset_path}/icon_512x512@2x.png" - COMMAND iconutil -c icns "${temp_iconset_path}" - COMMAND rm -R "${temp_iconset_path}") + COMMAND iconutil -c icns -o "${output_iconset_path}" "${temp_iconset_path}" + ERROR_VARIABLE error_message) + + file (REMOVE_RECURSE "${temp_iconset_path}") set (${output_variable} "${output_iconset_path}" PARENT_SCOPE) endfunction() diff --git a/modules/yup_graphics/native/yup_GraphicsContext_metal.cpp b/modules/yup_graphics/native/yup_GraphicsContext_metal.cpp index 75afaf3b..2aa6ac73 100644 --- a/modules/yup_graphics/native/yup_GraphicsContext_metal.cpp +++ b/modules/yup_graphics/native/yup_GraphicsContext_metal.cpp @@ -67,7 +67,7 @@ class LowLevelRenderContextMetal : public GraphicsContext m_swapchain.framebufferOnly = ! m_fiddleOptions.readableFramebuffer; m_swapchain.pixelFormat = MTLPixelFormatBGRA8Unorm; m_swapchain.contentsScale = dpiScale (window); - m_swapchain.displaySyncEnabled = NO; + m_swapchain.displaySyncEnabled = YES; m_swapchain.maximumDrawableCount = 2; view.layer = m_swapchain;