diff --git a/meson.build b/meson.build index db004ef2a..5ba12f0f0 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,11 @@ project('Aegisub', ['c', 'cpp'], license: 'BSD-3-Clause', - meson_version: '>=0.49.0', + meson_version: '>=0.51.0', default_options: ['c_std=c11', 'cpp_std=c++11', 'b_lto=true'], version: '3.2.2') +cmake = import('cmake') + if host_machine.system() == 'windows' version_sh = find_program('tools/version.ps1') else @@ -11,7 +13,7 @@ else endif version_inc = include_directories('.') version_h = custom_target('git_version.h', - command: [version_sh, meson.source_root()], + command: [version_sh, meson.current_build_dir()], build_by_default: true, build_always_stale: true, # has internal check whether target file will be refreshed output: ['git_version.h', 'git_version.xml']) @@ -61,7 +63,8 @@ deps += dependency('libass', version: '>=0.9.7', deps += dependency('boost', version: '>=1.50.0', modules: ['chrono', 'filesystem', 'locale', 'regex', - 'system', 'thread']) + 'system', 'thread'], + static: get_option('default_library') == 'static') if host_machine.system() == 'windows' conf.set('BOOST_USE_WINDOWS_H', '1') endif @@ -71,16 +74,46 @@ deps += dependency('zlib', fallback: ['zlib', 'zlib_dep']) wx_dep = dependency('wxWidgets', version: '>=3.0.0', required: cxx.get_id() != 'msvc', modules: ['std', 'stc', 'gl']) -if not wx_dep.found() # this will only be hit with msvc + +if wx_dep.found() + deps += wx_dep +else # this will only be hit with msvc if get_option('wx_path') != '' deps_inc += include_directories(get_option('wx_path') / 'include' / 'msvc', get_option('wx_path') / 'include') add_project_arguments('-DUNICODE', '-D_UNICODE', language: 'cpp') add_project_arguments('-DwxMSVC_VERSION_AUTO', '-DWXUSINGDLL', language: 'cpp') else - error('wxWidgets not found and no wx_path defined.') + buildShared = 'ON' + if get_option('default_library') == 'static' + buildShared = 'OFF' + endif + + wx = cmake.subproject('wxWidgets', cmake_options: ['-DwxBUILD_INSTALL=OFF', + '-DwxBUILD_PRECOMP=OFF', # otherwise breaks project generation w/ meson + '-DwxBUILD_SHARED=@0@'.format(buildShared), + '-DwxBUILD_MONOLITHIC=ON']) # otherwise breaks project generation w/ meson + deps += [ + wx.dependency('mono'), + wx.dependency('wxzlib'), + wx.dependency('wxpng'), + wx.dependency('wxexpat'), + wx.dependency('wxscintilla') + ] + + if host_machine.system() == 'windows' + if cc.has_header('rpc.h') + deps += cc.find_library('rpcrt4', required: true) + else + error('Missing Windows SDK RPC Library (rpc.h / rpcrt4.lib)') + endif + if cc.has_header('commctrl.h') + deps += cc.find_library('comctl32', required: true) + else + error('Missing Windows SDK Common Controls Library (commctrl.h / comctl32.lib)') + endif + endif endif endif -deps += wx_dep icu_uc_dep = dependency('icu-uc', version: '>=4.8.1.1', required: cxx.get_id() != 'msvc') icu_i18n_dep = dependency('icu-i18n', version: '>=4.8.1.1', required: cxx.get_id() != 'msvc') @@ -135,8 +168,10 @@ if host_machine.system() == 'windows' and not get_option('directsound').disabled if not have_dsound_h and get_option('directsound').enabled() error('DirectSound enabled but dsound.h not found') endif - if dsound_dep.found() and winmm_dep.found() and ole32_dep.found() and have_dsound_h - deps += [dsound_dep, winmm_dep, ole32_dep] + + dxguid_dep = cc.find_library('dxguid', required: true) + if dsound_dep.found() and winmm_dep.found() and ole32_dep.found() and dxguid_dep.found() and have_dsound_h + deps += [dsound_dep, winmm_dep, ole32_dep, dxguid_dep] conf.set('WITH_DIRECTSOUND', '1') dep_avail += 'DirectSound' endif diff --git a/src/include/agi_pre_c.h b/src/include/agi_pre_c.h index 32d70adbc..c4d6924f4 100644 --- a/src/include/agi_pre_c.h +++ b/src/include/agi_pre_c.h @@ -38,98 +38,6 @@ #include #endif -// wxWidgets headers -#include // Leave this first. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #ifdef HAVE_OPENGL_GL_H #include #else diff --git a/src/meson.build b/src/meson.build index e01353ae4..7e5dc7788 100644 --- a/src/meson.build +++ b/src/meson.build @@ -171,6 +171,20 @@ if host_machine.system() == 'darwin' 'osx/retina_helper.mm', 'osx/scintilla_ime.mm', ] +elif host_machine.system() == 'windows' + aegisub_src += [ + 'font_file_lister_gdi.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 + if cc.has_header('usp10.h') + deps += cc.find_library('usp10', required: true) + else + error('Missing Windows SDK Uniscribe Library (usp10.h / usp10.lib)') + endif elif conf.get('WITH_FONTCONFIG') == '1' aegisub_src += 'font_file_lister_fontconfig.cpp' endif @@ -206,4 +220,5 @@ aegisub = executable('aegisub', aegisub_src, version_h, acconf, cpp_pch: aegisub_cpp_pch, c_pch: aegisub_c_pch, install: true, - dependencies: deps) + dependencies: deps, + gui_app: true) diff --git a/src/utils.cpp b/src/utils.cpp index 2416aa7a2..69c53bd1c 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -275,7 +275,7 @@ wxString LocalizedLanguageName(wxString const& lang) { icu::UnicodeString ustr; iculoc.getDisplayName(iculoc, ustr); #ifdef _MSC_VER - return wxString(ustr.getBuffer()); + return wxString((const wchar_t*)ustr.getBuffer()); #else std::string utf8; ustr.toUTF8String(utf8); diff --git a/subprojects/wxWidgets.wrap b/subprojects/wxWidgets.wrap new file mode 100644 index 000000000..a77194055 --- /dev/null +++ b/subprojects/wxWidgets.wrap @@ -0,0 +1,5 @@ +[wrap-git] +directory = wxWidgets +url = https://github.com/wxWidgets/wxWidgets.git +revision = master +clone-recursive = true \ No newline at end of file diff --git a/tools/version.ps1 b/tools/version.ps1 index 03d02dbef..0d61c7176 100644 --- a/tools/version.ps1 +++ b/tools/version.ps1 @@ -1,20 +1,32 @@ #!/usr/bin/env powershell + +param ( + [Parameter(Position = 0, Mandatory = $false)] + [string]$BuildRoot = $null +) + $lastSvnRevision = 6962 $lastSvnHash = '16cd907fe7482cb54a7374cd28b8501f138116be' $defineNumberMatch = [regex] '^#define\s+(\w+)\s+(\d+)$' $defineStringMatch = [regex] "^#define\s+(\w+)\s+[`"']?(.+?)[`"']?$" $semVerMatch = [regex] 'v?(\d+)\.(\d+).(\d+)(?:-(\w+))?' - $repositoryRootPath = Join-Path $PSScriptRoot .. | Resolve-Path if (!(git -C $repositoryRootPath rev-parse --is-inside-work-tree 2>$null)) { throw "$repositoryRootPath is not a git repository" } -$gitVersionHeaderPath = Join-Path $repositoryRootPath 'src' | Join-Path -ChildPath 'include' | Join-Path -ChildPath 'aegisub' ` - | Join-Path -ChildPath 'git_version.h' -$gitVersionXmlPath = Join-Path $repositoryRootPath 'packages' | Join-Path -ChildPath 'win_installer' ` - | Join-Path -ChildPath 'git_version.xml' +if ($BuildRoot -eq $null -or $BuildRoot.Trim() -eq "") { + $BuildRoot = $repositoryRootPath +} + +# support legacy in-tree builds +if ([System.IO.Path]::GetFullPath([System.IO.Path]::Combine((pwd).Path, $BuildRoot)) -eq + [System.IO.Path]::GetFullPath([System.IO.Path]::Combine((pwd).Path, $repositoryRootPath))) { + $BuildRoot = Join-Path $repositoryRootPath 'build' + } +$gitVersionHeaderPath = Join-Path $BuildRoot 'git_version.h' +$gitVersionXmlPath = Join-Path $repositoryRootPath 'build' | Join-Path -ChildPath 'git_version.xml' $version = @{} if (Test-Path $gitVersionHeaderPath) {