Aegisub/src/meson.build

271 lines
7.9 KiB
Meson
Raw Normal View History

subdir('libresrc')
aegisub_src = files(
'MatroskaParser.c',
'aegisublocale.cpp',
'ass_attachment.cpp',
'ass_dialogue.cpp',
'ass_entry.cpp',
'ass_export_filter.cpp',
'ass_exporter.cpp',
'ass_file.cpp',
'ass_karaoke.cpp',
'ass_override.cpp',
'ass_parser.cpp',
'ass_style.cpp',
'ass_style_storage.cpp',
'async_video_provider.cpp',
'audio_box.cpp',
'audio_colorscheme.cpp',
'audio_controller.cpp',
'audio_display.cpp',
'audio_karaoke.cpp',
'audio_marker.cpp',
'audio_player.cpp',
'audio_provider_factory.cpp',
'audio_renderer.cpp',
'audio_renderer_spectrum.cpp',
'audio_renderer_waveform.cpp',
'audio_timing_dialogue.cpp',
'audio_timing_karaoke.cpp',
'auto4_base.cpp',
'auto4_lua.cpp',
'auto4_lua_assfile.cpp',
'auto4_lua_dialog.cpp',
'auto4_lua_progresssink.cpp',
'base_grid.cpp',
'charset_detect.cpp',
'colorspace.cpp',
'colour_button.cpp',
'command/app.cpp',
'command/audio.cpp',
'command/automation.cpp',
'command/command.cpp',
'command/edit.cpp',
'command/grid.cpp',
'command/help.cpp',
'command/keyframe.cpp',
'command/recent.cpp',
'command/subtitle.cpp',
'command/time.cpp',
'command/timecode.cpp',
'command/tool.cpp',
'command/video.cpp',
'command/vis_tool.cpp',
'compat.cpp',
'context.cpp',
'dialog_about.cpp',
'dialog_align.cpp',
'dialog_attachments.cpp',
'dialog_automation.cpp',
'dialog_autosave.cpp',
'dialog_colorpicker.cpp',
'dialog_detached_video.cpp',
'dialog_dummy_video.cpp',
'dialog_export.cpp',
'dialog_export_ebu3264.cpp',
'dialog_fonts_collector.cpp',
'dialog_jumpto.cpp',
'dialog_kara_timing_copy.cpp',
'dialog_log.cpp',
'dialog_paste_over.cpp',
'dialog_progress.cpp',
'dialog_properties.cpp',
'dialog_resample.cpp',
'dialog_search_replace.cpp',
'dialog_selected_choices.cpp',
'dialog_selection.cpp',
'dialog_shift_times.cpp',
'dialog_spellchecker.cpp',
'dialog_style_editor.cpp',
'dialog_style_manager.cpp',
'dialog_styling_assistant.cpp',
'dialog_text_import.cpp',
'dialog_timing_processor.cpp',
'dialog_translation.cpp',
'dialog_version_check.cpp',
'dialog_video_details.cpp',
'dialog_video_properties.cpp',
'export_fixstyle.cpp',
'export_framerate.cpp',
'fft.cpp',
'fold_controller.cpp',
'font_file_lister.cpp',
'frame_main.cpp',
'gl_text.cpp',
'gl_wrap.cpp',
'grid_column.cpp',
'help_button.cpp',
'hotkey.cpp',
'hotkey_data_view_model.cpp',
'image_position_picker.cpp',
'initial_line_state.cpp',
'main.cpp',
'menu.cpp',
'mkv_wrap.cpp',
'pen.cpp',
'persist_location.cpp',
'preferences.cpp',
'preferences_base.cpp',
'project.cpp',
'resolution_resampler.cpp',
'search_replace_engine.cpp',
'selection_controller.cpp',
'spellchecker.cpp',
'spline.cpp',
'spline_curve.cpp',
'string_codec.cpp',
'subs_controller.cpp',
'subs_edit_box.cpp',
'subs_edit_ctrl.cpp',
'subs_preview.cpp',
'subtitle_format.cpp',
'subtitle_format_ass.cpp',
'subtitle_format_ebu3264.cpp',
'subtitle_format_encore.cpp',
'subtitle_format_microdvd.cpp',
'subtitle_format_mkv.cpp',
'subtitle_format_srt.cpp',
'subtitle_format_ssa.cpp',
'subtitle_format_transtation.cpp',
'subtitle_format_ttxt.cpp',
'subtitle_format_txt.cpp',
'subtitles_provider.cpp',
'subtitles_provider_libass.cpp',
'text_file_reader.cpp',
'text_file_writer.cpp',
'text_selection_controller.cpp',
'thesaurus.cpp',
'timeedit_ctrl.cpp',
'toggle_bitmap.cpp',
'toolbar.cpp',
'tooltip_manager.cpp',
'utils.cpp',
'validators.cpp',
'vector2d.cpp',
2023-01-25 23:24:11 +01:00
'vector3d.cpp',
'version.cpp',
'video_box.cpp',
'video_controller.cpp',
'video_display.cpp',
'video_frame.cpp',
'video_out_gl.cpp',
'video_provider_cache.cpp',
'video_provider_dummy.cpp',
'video_provider_manager.cpp',
'video_provider_yuv4mpeg.cpp',
'video_slider.cpp',
'visual_feature.cpp',
'visual_tool.cpp',
'visual_tool_clip.cpp',
'visual_tool_cross.cpp',
'visual_tool_drag.cpp',
2023-01-25 23:24:11 +01:00
'visual_tool_perspective.cpp',
'visual_tool_rotatexy.cpp',
'visual_tool_rotatez.cpp',
'visual_tool_scale.cpp',
'visual_tool_vector_clip.cpp',
)
if host_machine.system() == 'darwin'
aegisub_src += files(
'font_file_lister_coretext.mm',
'osx/osx_utils.mm',
'osx/retina_helper.mm',
'osx/scintilla_ime.mm',
)
elif host_machine.system() == 'windows'
aegisub_src += files(
'avisynth_wrap.cpp',
'crash_writer_minidump.cpp',
'font_file_lister_gdi.cpp',
# 'libass_gdi_fontselect.cpp',
)
if cc.has_header('wingdi.h')
deps += cc.find_library('gdi32', required: true)
else
error('Missing Windows SDK GDI Library (wingdi.h / gdi32.lib)')
endif
Rework Windows font collector (arch1t3cht/Aegisub#107) [src\meson.build] Add DirectWrite has dependency [src\font_file_lister_gdi] Rework GDI FontCollector to use DirectWrite This replaces all the logic of using the Windows registry to obtain the font path by using DirectWrite. The goal is simply to improve the quality of the code. This doesn't change any functionality [src\meson.build] Remove Uniscribe has dependency Uniscribe was only used for the FontCollector. Since we now use DirectWrite, we don't need it anymore. [src\dialog_fonts_collector] Catch exceptions that FontCollector may raise On Windows, the initialization of the FontCollector can raise an exception [src\font_file_lister] Document the exception that GdiFontFileLister can throw [src\font_file_lister_gdi] Correct possible memory leak when an error occur Fix error caused by AddFontResource on Windows 10 or higher [meson.build] Replace add_project_arguments with conf.set for HAVE_DWRITE_3 [src\dialog_fonts_collector] Update message error and optimisation [src\font_file_lister_gdi] Correct documentation typo [src\font_file_lister_gdi] Cosmetic nit - Initialize hfont in one line [src\font_file_lister_gdi] Cosmetic nit - Remove if statements brace [src\font_file_lister_gdi] Replace WCHAR param of normalizeFilePathCase to std::wstring [src\font_file_lister_gdi] Replace WCHAR by std::wstring [src\font_file_lister_gdi] Use IDWriteFontFace::GetSimulations to detect fake_italic/fake_bold See this comment: https://github.com/arch1t3cht/Aegisub/pull/107#issuecomment-1975229652 [src\font_file_lister_gdi] If Win7/8 has Win 10 SDK on compile time, correctly verify if font has character(s) With the Visual Studio 2019 toolchain on Windows 7, it installs the Windows 10 SDK by default. Because of this, ``HAVE_DWRITE_3`` is true, so the ``QueryInterface`` always fails. Now, if the ``QueryInterface`` fails, we try to verify if the font has characters with a Windows Vista SP2 compatible code. [src\font_file_lister_gdi] Support facename that contains only whitespace AND truncated facename Problem 1: Previously, if a user wrote "\fn ", it would return the font Arial, which is not what we want. This is because when we request EnumFontFamiliesEx with whitespace or an empty lfFaceName, it will enumerate all the installed fonts. Solution 1: To resolve this issue, let's implement a solution similar to libass to determine if the selected facename exists: https://github.com/libass/libass/blob/649a7c2e1fc6f4188ea1a89968560715800b883d/libass/ass_directwrite.c#L737-L747 Problem 2: GDI truncates font names to 31 characters. See: https://github.com/libass/libass/issues/459 However, since I changed the method to determine if a facename exists, I ensured that we still support this "feature". To test this, I used the font in: https://github.com/libass/libass/issues/710 [src\font_file_lister_gdi] Add a FIXME comment regarding the utilization of std::wstring over WCHAR [src\font_file_lister_gdi] Add FIXME comment about charset
2024-02-01 02:48:34 +01:00
if cc.has_header('dwrite.h')
deps += cc.find_library('dwrite', required: true)
else
Rework Windows font collector (arch1t3cht/Aegisub#107) [src\meson.build] Add DirectWrite has dependency [src\font_file_lister_gdi] Rework GDI FontCollector to use DirectWrite This replaces all the logic of using the Windows registry to obtain the font path by using DirectWrite. The goal is simply to improve the quality of the code. This doesn't change any functionality [src\meson.build] Remove Uniscribe has dependency Uniscribe was only used for the FontCollector. Since we now use DirectWrite, we don't need it anymore. [src\dialog_fonts_collector] Catch exceptions that FontCollector may raise On Windows, the initialization of the FontCollector can raise an exception [src\font_file_lister] Document the exception that GdiFontFileLister can throw [src\font_file_lister_gdi] Correct possible memory leak when an error occur Fix error caused by AddFontResource on Windows 10 or higher [meson.build] Replace add_project_arguments with conf.set for HAVE_DWRITE_3 [src\dialog_fonts_collector] Update message error and optimisation [src\font_file_lister_gdi] Correct documentation typo [src\font_file_lister_gdi] Cosmetic nit - Initialize hfont in one line [src\font_file_lister_gdi] Cosmetic nit - Remove if statements brace [src\font_file_lister_gdi] Replace WCHAR param of normalizeFilePathCase to std::wstring [src\font_file_lister_gdi] Replace WCHAR by std::wstring [src\font_file_lister_gdi] Use IDWriteFontFace::GetSimulations to detect fake_italic/fake_bold See this comment: https://github.com/arch1t3cht/Aegisub/pull/107#issuecomment-1975229652 [src\font_file_lister_gdi] If Win7/8 has Win 10 SDK on compile time, correctly verify if font has character(s) With the Visual Studio 2019 toolchain on Windows 7, it installs the Windows 10 SDK by default. Because of this, ``HAVE_DWRITE_3`` is true, so the ``QueryInterface`` always fails. Now, if the ``QueryInterface`` fails, we try to verify if the font has characters with a Windows Vista SP2 compatible code. [src\font_file_lister_gdi] Support facename that contains only whitespace AND truncated facename Problem 1: Previously, if a user wrote "\fn ", it would return the font Arial, which is not what we want. This is because when we request EnumFontFamiliesEx with whitespace or an empty lfFaceName, it will enumerate all the installed fonts. Solution 1: To resolve this issue, let's implement a solution similar to libass to determine if the selected facename exists: https://github.com/libass/libass/blob/649a7c2e1fc6f4188ea1a89968560715800b883d/libass/ass_directwrite.c#L737-L747 Problem 2: GDI truncates font names to 31 characters. See: https://github.com/libass/libass/issues/459 However, since I changed the method to determine if a facename exists, I ensured that we still support this "feature". To test this, I used the font in: https://github.com/libass/libass/issues/710 [src\font_file_lister_gdi] Add a FIXME comment regarding the utilization of std::wstring over WCHAR [src\font_file_lister_gdi] Add FIXME comment about charset
2024-02-01 02:48:34 +01:00
error('Missing Windows SDK DirectWrite Library (dwrite.h / dwrite.lib)')
endif
res_inc = include_directories('bitmaps/windows')
res_dep_files = files(
'bitmaps/windows/icon.ico',
'bitmaps/windows/eyedropper.cur',
)
windows = import('windows')
if wx_dep.type_name() != 'not-found' # system wx
raw_wx_windres_args = wx_dep.get_variable(configtool: 'rescomp').split()
wx_windres_args = []
foreach arg: raw_wx_windres_args
if arg != 'windres'
wx_windres_args += arg
endif
endforeach
aegisub_src += windows.compile_resources('res/res.rc',
args: wx_windres_args,
depend_files: res_dep_files,
depends: version_h,
include_directories: [res_inc, version_inc])
else # subproject
wx_inc = wx.include_directories('wxmono')
aegisub_src += windows.compile_resources('res/res.rc',
depend_files: res_dep_files,
depends: version_h,
include_directories: [res_inc, version_inc, wx_inc])
endif
aegisub_src += windows.compile_resources('res/strings.rc')
endif
if host_machine.system() != 'windows'
aegisub_src += files(
'crash_writer.cpp'
)
endif
if conf.has('WITH_FONTCONFIG')
aegisub_src += files('font_file_lister_fontconfig.cpp')
endif
2021-01-30 14:57:39 +01:00
if conf.has('WITH_CSRI')
aegisub_src += files('subtitles_provider_csri.cpp')
2021-01-30 14:57:39 +01:00
endif
opt_src = [
['ALSA', 'audio_player_alsa.cpp'],
['PortAudio', 'audio_player_portaudio.cpp'],
['PulseAudio', 'audio_player_pulse.cpp'],
['OpenAL', 'audio_player_openal.cpp'],
['OSS', 'audio_player_oss.cpp'],
2019-02-17 18:25:57 +01:00
['DirectSound', ['audio_player_dsound.cpp',
'audio_player_dsound2.cpp']],
['XAudio2', 'audio_player_xaudio2.cpp'],
['FFMS2', ['audio_provider_ffmpegsource.cpp',
'video_provider_ffmpegsource.cpp',
'ffmpegsource_common.cpp']],
2022-08-11 02:05:16 +02:00
['BestSource', ['audio_provider_bestsource.cpp',
'video_provider_bestsource.cpp',
'bestsource_common.cpp']],
2022-08-16 15:49:29 +02:00
['VapourSynth', ['vapoursynth_wrap.cpp',
'vapoursynth_common.cpp',
2022-08-16 18:55:59 +02:00
'audio_provider_vs.cpp',
2022-08-16 15:49:29 +02:00
'video_provider_vs.cpp']],
['AviSynth', ['avisynth_wrap.cpp',
'audio_provider_avs.cpp',
'video_provider_avs.cpp']],
['Hunspell', 'spellchecker_hunspell.cpp'],
]
2019-01-30 22:58:31 +01:00
foreach opt: opt_src
if dep_avail.contains(opt[0])
aegisub_src += files(opt[1])
endif
endforeach