The-Powder-Toy/resources/meson.build
Tamás Bálint Misius 7fc3fb4c15
Sort out version info
The idea is to have the following version information included:

 - 1-component save version
   - 2-component under the hood but the minor component shouldn't ever change again
   - see currentVersionMajor in GameSave.cpp
 - 1-component website API version
   - again, currently 2-component because that's what the website code expects
   - see apiVersion in requestmanager/Common.cpp
 - 2-component display version, entirely cosmetic
   - exposed as meson options display_version_major and display_version_minor
   - see APP_VERSION in Config.template.h
 - 1-component business logic version aka build number
   - exposed as meson option build_num
   - see APP_VERSION in Config.template.h
 - variant id aka mod id, tightly coupled with the build number
   - exposed as meson option mod_id
   - see MOD_ID in Config.template.h
 - display and business logic versions repeated for the upstream
   - exposed as meson options upstream_version_major, upstream_version_minor, and upstream_build_num
   - we'll have to update these alongside display_version_major, display_version_minor, and build_num, but mod owners can just merge our changes
   - see UPSTREAM_VERSION in Config.template.h
 - update channel, makes sense in the context of the variant (and yes, this would later enable mod snapshots)
   - currently not exposed as a meson option but derived from meson options snapshot and mod_id
   - see IDENT_RELTYPE in Config.template.h
 - vcs tag aka git commit hash
   - set by build.sh in ghactions workflows
   - see VCS_TAG in VcsTag.tempalte.h

Rather importantly, the save and website API versions are now allowed to change independently of the display version.

These changes also allowed me to remove the ugly sed hacks in build.sh used to provision some manifest files; they are now provisioned by meson.

Also add version info for windows and android.
2023-10-19 12:51:03 +02:00

102 lines
3.6 KiB
Meson

rendered_icons_optionally_from_svg = {
'icon_exe' : { 'png': 'icon_exe.png' , 'svg': 'icon_exe.svg', 'width': '256', 'height': '256' },
'icon_exe_48': { 'png': 'icon_exe_48.png', 'svg': 'icon_exe.svg', 'width': '48', 'height': '48' },
'icon_exe_32': { 'png': 'icon_exe_32.png', 'svg': 'icon_exe.svg', 'width': '32', 'height': '32' },
'icon_exe_16': { 'png': 'icon_exe_16.png', 'svg': 'icon_exe.svg', 'width': '16', 'height': '16' },
'icon_cps' : { 'png': 'icon_cps.png' , 'svg': 'icon_cps.svg', 'width': '256', 'height': '256' },
'icon_cps_48': { 'png': 'icon_cps_48.png', 'svg': 'icon_cps.svg', 'width': '48', 'height': '48' },
'icon_cps_32': { 'png': 'icon_cps_32.png', 'svg': 'icon_cps.svg', 'width': '32', 'height': '32' },
'icon_cps_16': { 'png': 'icon_cps_16.png', 'svg': 'icon_cps.svg', 'width': '16', 'height': '16' },
}
rendered_icons = {}
if render_icons_with_inkscape.allowed()
foreach key, info : rendered_icons_optionally_from_svg
rendered_icons += { key: custom_target(
key + '-from-svg',
output: info['png'],
command: [
inkscape,
'--export-area-page',
'--export-type', 'png',
'--export-filename', '@OUTPUT@',
'--export-width', info['width'],
'--export-height', info['height'],
files(info['svg']),
],
) }
endforeach
else
foreach key, info : rendered_icons_optionally_from_svg
rendered_icons += { key: files('generated_icons/' + info['png']) }
endforeach
endif
if host_platform == 'windows'
make_ico = executable('makeico', sources: 'MakeIco.cpp', native: true)
generated_win_icos = {}
win_icos = {
'icon_exe': [ 'icon_exe', 'icon_exe_48', 'icon_exe_32', 'icon_exe_16' ],
'icon_cps': [ 'icon_cps', 'icon_cps_48', 'icon_cps_32', 'icon_cps_16' ],
}
foreach key, icons : win_icos
command = [
make_ico,
'@OUTPUT@',
]
foreach ikey : icons
command += [ rendered_icons[ikey] ]
endforeach
generated_win_icos += { key: custom_target(
key + '-ico',
output: key + '.ico',
command: command,
) }
endforeach
rc_conf_data = configuration_data()
rc_conf_data.merge_from(conf_data)
rc_conf_data.set('RESOUCE_H', join_paths(meson.current_source_dir(), 'resource.h'))
rc_conf_data.set('WINUTF8_XML', join_paths(meson.current_source_dir(), 'winutf8.xml'))
rc_conf_data.set('ICON_EXE_ICO', join_paths(meson.current_build_dir(), 'icon_exe.ico'))
rc_conf_data.set('ICON_CPS_ICO', join_paths(meson.current_build_dir(), 'icon_cps.ico'))
powder_files += windows_mod.compile_resources(
configure_file(
input: 'powder-res.template.rc',
output: 'powder-res.rc',
configuration: rc_conf_data,
),
depends: [
generated_win_icos['icon_exe'],
generated_win_icos['icon_cps'],
],
depend_files: [
'resource.h',
'winutf8.xml',
],
)
elif host_platform == 'darwin'
configure_file(
input: 'Info.template.plist',
output: 'Info.plist',
configuration: conf_data,
)
elif host_platform == 'linux'
data_files += to_array.process(rendered_icons['icon_exe'], extra_args: 'icon_exe_png')
data_files += to_array.process(rendered_icons['icon_cps'], extra_args: 'icon_cps_png')
data_files += to_array.process('save.xml', extra_args: 'save_xml')
data_files += to_array.process(configure_file(
input: 'powder.template.desktop',
output: 'powder.desktop',
configuration: conf_data,
), extra_args: 'powder_desktop')
configure_file(
input: 'appdata.template.xml',
output: 'appdata.xml',
configuration: conf_data,
)
endif
data_files += to_array.process('save_local.png', extra_args: 'save_local_png')
data_files += to_array.process('save_online.png', extra_args: 'save_online_png')
data_files += to_array.process('font.bz2', extra_args: 'compressed_font_data')