diff --git a/build/windows/store/Assets/gen-tile.py.in b/build/windows/store/Assets/gen-tile.py.in new file mode 100644 index 0000000000..41f175577a --- /dev/null +++ b/build/windows/store/Assets/gen-tile.py.in @@ -0,0 +1,29 @@ +import os +import sys + +input_path = '@INPUT@' +output_path = '@OUTPUT@' +procedure = Gimp.get_pdb().lookup_procedure("file-svg-load") +config = procedure.create_config() +config.set_property("file", Gio.file_new_for_path(input_path)) +config.set_property("width", @LOGO_DIM@) +config.set_property("height", @LOGO_DIM@) +Gimp.Procedure.run(procedure, config) +v = Gimp.Procedure.run(procedure, config) + +if v.index(0) != Gimp.PDBStatusType.SUCCESS: + sys.exit(os.EX_SOFTWARE) + +image = v.index(1) +image.resize(@IMG_WIDTH@, @IMG_HEIGHT@, (@IMG_WIDTH@-@LOGO_DIM@)/2, (@IMG_HEIGHT@-@LOGO_DIM@)/2) + +procedure = Gimp.get_pdb().lookup_procedure("file-png-save") +config = procedure.create_config() +drawables = image.list_selected_drawables() +# Needed otherwise it doesn't save the proper size because of bug #8855. +drawables[0].resize_to_image_size() +config.set_property("image", image) +config.set_property("num-drawables", len(drawables)) +config.set_property("drawables", Gimp.ObjectArray.new(Gimp.Drawable, drawables, False)) +config.set_property("file", Gio.file_new_for_path(output_path)) +Gimp.Procedure.run(procedure, config) diff --git a/build/windows/store/Assets/meson.build b/build/windows/store/Assets/meson.build new file mode 100644 index 0000000000..ed8f084693 --- /dev/null +++ b/build/windows/store/Assets/meson.build @@ -0,0 +1,250 @@ +scales = [ + '100', + '125', + '150', + '200', + '400', +] + +sizes = [ + '16', + '20', + '24', + '30', + '32', + '36', + '40', + '48', + '60', + '64', + '72', + '80', + '96', + '128', + '256', +] + + +# UNIVERSAL ICONS (INTRODUCED SINCE WINDOWS 8) +wilber_path = meson.project_source_root() / 'gimp-data/images/logo/' + 'gimp-logo' + '.svg' + +## Generate AppList (aka Square44x44Logo) icon +foreach scale : scales + if scale == '100' + icon_name = 'AppList.png' + else + icon_name = 'AppList.scale-' + scale + '.png' + endif + scale_int = scale.to_int() + size = 44 * scale_int / 100 + size_str = size.to_string() + custom_target(icon_name, + input : [ wilber_path ], + output: [ icon_name ], + command: [ + colorsvg2png, '@INPUT@', '@OUTPUT@', size_str, + ], + build_by_default: true, + ) +endforeach + +foreach size : sizes + icon_name = 'AppList.targetsize-' + size + '.png' + custom_target(icon_name, + input : [ wilber_path ], + output: [ icon_name ], + command: [ + colorsvg2png, '@INPUT@', '@OUTPUT@', size, + ], + build_by_default: true, + ) + + icon_name = 'AppList.targetsize-' + size + '_altform-unplated.png' + custom_target(icon_name, + input : [ wilber_path ], + output: [ icon_name ], + command: [ + colorsvg2png, '@INPUT@', '@OUTPUT@', size, + ], + build_by_default: true, + ) + + icon_name = 'AppList.targetsize-' + size + '_altform-lightunplated.png' + custom_target(icon_name, + input : [ wilber_path ], + output: [ icon_name ], + command: [ + colorsvg2png, '@INPUT@', '@OUTPUT@', size, + ], + build_by_default: true, + ) +endforeach + + +## Generate StoreLogo icon +foreach scale : scales +if scale == '100' + icon_name = 'StoreLogo.png' + else + icon_name = 'StoreLogo.scale-' + scale + '.png' + endif + scale_int = scale.to_int() + size = 50 * scale_int / 100 + size_str = size.to_string() + custom_target(icon_name, + input : [ wilber_path ], + output: [ icon_name ], + command: [ + colorsvg2png, '@INPUT@', '@OUTPUT@', size_str, + ], + build_by_default: true, + ) +endforeach + + +# LIMBO ICONS (DISCONTINUED IN WINDOWS 11 BUT MICROSOFT OBLIES DEVS TO SHIP) +wilber_path = meson.project_source_root() / 'gimp-data/images/logo/' + 'gimp-logo-shadow' + '.svg' + +## Generate MedTile (aka Square150x150Logo) icon +## (The wilber size should be 32% of the icon height) +foreach scale : scales + icon_name = 'MedTile.scale-' + scale + '.png' + + scale_int = scale.to_int() + size = 150 * scale_int / 100 + size_str = size.to_string() + + dim_size = 48 * scale_int / 100 + dim_str = dim_size.to_string() + + gen_tile_conf = configuration_data() + gen_tile_conf.set('INPUT', wilber_path) + gen_tile_conf.set('OUTPUT', meson.current_build_dir() / icon_name) + gen_tile_conf.set('IMG_WIDTH', size_str) + gen_tile_conf.set('IMG_HEIGHT', size_str) + gen_tile_conf.set('LOGO_DIM', dim_str) + gen_medtile_py = configure_file(input : 'gen-tile.py.in', + output : 'gen-medtile-' + scale + '.py', + configuration : gen_tile_conf) + + med_tile = custom_target(icon_name, + input : [ gen_medtile_py ], + depend_files: [ wilber_path ], + output: [ icon_name ], + command: [ gimp_exe, '-nidfs', + '--batch-interpreter', 'python-fu-eval', + '-b', '-', '--quit'], + feed: true, + build_by_default: true, + env: gimp_run_env) +endforeach + + +# LEGACY ICONS (DISCONTINUED IN WINDOWS 11) + +## Generate SmallTile (aka Square71x71Logo) icon +## (The wilber size should be 50% of the icon height) +foreach scale : scales + icon_name = 'SmallTile.scale-' + scale + '.png' + + scale_int = scale.to_int() + size = 71 * scale_int / 100 + size_str = size.to_string() + + dim_size = 36 * scale_int / 100 + dim_str = dim_size.to_string() + + gen_tile_conf = configuration_data() + gen_tile_conf.set('INPUT', wilber_path) + gen_tile_conf.set('OUTPUT', meson.current_build_dir() / icon_name) + gen_tile_conf.set('IMG_WIDTH', size_str) + gen_tile_conf.set('IMG_HEIGHT', size_str) + gen_tile_conf.set('LOGO_DIM', dim_str) + gen_smalltile_py = configure_file(input : 'gen-tile.py.in', + output : 'gen-smalltile-' + scale + '.py', + configuration : gen_tile_conf) + + small_tile = custom_target(icon_name, + input : [ gen_smalltile_py ], + depend_files: [ wilber_path ], + output: [ icon_name ], + command: [ gimp_exe, '-nidfs', + '--batch-interpreter', 'python-fu-eval', + '-b', '-', '--quit'], + feed: true, + build_by_default: true, + env: gimp_run_env) +endforeach + + +## Generate LargeTile (aka Square310x310Logo) icon +## (The wilber size should be 34% of the icon height) +foreach scale : scales + icon_name = 'LargeTile.scale-' + scale + '.png' + + scale_int = scale.to_int() + size = 310 * scale_int / 100 + size_str = size.to_string() + + dim_size = 105 * scale_int / 100 + dim_str = dim_size.to_string() + + gen_tile_conf = configuration_data() + gen_tile_conf.set('INPUT', wilber_path) + gen_tile_conf.set('OUTPUT', meson.current_build_dir() / icon_name) + gen_tile_conf.set('IMG_WIDTH', size_str) + gen_tile_conf.set('IMG_HEIGHT', size_str) + gen_tile_conf.set('LOGO_DIM', dim_str) + gen_largetile_py = configure_file(input : 'gen-tile.py.in', + output : 'gen-largetile-' + scale + '.py', + configuration : gen_tile_conf) + + large_tile = custom_target(icon_name, + input : [ gen_largetile_py ], + depend_files: [ wilber_path ], + output: [ icon_name ], + command: [ gimp_exe, '-nidfs', + '--batch-interpreter', 'python-fu-eval', + '-b', '-', '--quit'], + feed: true, + build_by_default: true, + env: gimp_run_env) +endforeach + + +## Generate WideTile (aka Wide310x150Logo) icon +## (The wilber size should be 32% of the icon height) +foreach scale : scales + icon_name = 'WideTile.scale-' + scale + '.png' + + scale_int = scale.to_int() + w_size = 310 * scale_int / 100 + w_size_str = w_size.to_string() + + h_size = 150 * scale_int / 100 + h_size_str = h_size.to_string() + + dim_size = 48 * scale_int / 100 + dim_str = dim_size.to_string() + + gen_tile_conf = configuration_data() + gen_tile_conf.set('INPUT', wilber_path) + gen_tile_conf.set('OUTPUT', meson.current_build_dir() / icon_name) + gen_tile_conf.set('IMG_WIDTH', w_size_str) + gen_tile_conf.set('IMG_HEIGHT', h_size_str) + gen_tile_conf.set('LOGO_DIM', dim_str) + gen_widetile_py = configure_file(input : 'gen-tile.py.in', + output : 'gen-widetile-' + scale + '.py', + configuration : gen_tile_conf) + + wide_tile = custom_target(icon_name, + input : [ gen_widetile_py ], + depend_files: [ wilber_path ], + output: [ icon_name ], + command: [ gimp_exe, '-nidfs', + '--batch-interpreter', 'python-fu-eval', + '-b', '-', '--quit'], + feed: true, + build_by_default: true, + env: gimp_run_env) +endforeach diff --git a/meson.build b/meson.build index 87bdca5550..4a1a21a165 100644 --- a/meson.build +++ b/meson.build @@ -1958,12 +1958,17 @@ subdir('libgimp/tests') subdir('docs') subdir('devel-docs') -# Windows installer +# Inno Windows installer if get_option('windows-installer') subdir('po-windows-installer') subdir('build/windows/installer/lang') endif +# Microsoft Store icons for .msixupload and/or .msixbundle +if get_option('ms-store') + subdir('build/windows/store/Assets') +endif + pkgconfig.generate(libgimp, filebase: 'gimp-' + gimp_api_version, name: prettyname, diff --git a/meson_options.txt b/meson_options.txt index f8968898b4..93ca46534d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,7 +4,8 @@ option('enable-console-bin',type: 'boolean', value: true, description: 'Build option('win32-debug-console',type:'boolean', value: true, description: 'Open a console when starting the program') option('enable-multiproc', type: 'boolean', value: true, description: 'Support for multiple processors') option('profiling', type: 'boolean', value: false, description: 'Enable profiling') -option('windows-installer', type: 'boolean', value: false, description: 'Generate files needed for the Windows installer') +option('windows-installer', type: 'boolean', value: false, description: 'Generate files needed for the Inno Windows installer') +option('ms-store', type: 'boolean', value: false, description: 'Generate files needed for the Microsoft Store .msixupload and/or .msixbundle') option('relocatable-bundle', type: 'combo', value: 'platform-default', description: 'build with resources considered bundled under the same prefix',