Win编译iTask
<p>Windows10/11 编译 iTask 步骤:</p>
<p>系统:Windows10/11 home/pro均可
软件:VS2019</p>
<p>库文件路径:D:\Black\client-secret-app\secret\Libraries
breakpad
ffmpeg
lzma
mozjpeg
openal-soft
openssl_1_1_1
opus
patches
qt_5_15_1
Qt-5.15.1
tg_owt
zlib</p>
<p>3方软件目录:D:\Black\client-secret-app\ThirdParty
安装后包含的目录如下:
CMake
gyp
jom
msys64
NASM
Ninja
nuget (独立)
patches
Python27
Strawberry
yasm</p>
<p>备注:</p>
<p>官方文档:
<a href="https://github.com/telegramdesktop/tdesktop/blob/v2.4.9/docs/building-msvc.md">https://github.com/telegramdesktop/tdesktop/blob/v2.4.9/docs/building-msvc.md</a></p>
<p>整理后的脚本内容:</p>
<pre><code class="language-bash">echo set PATH
SET PATH=%cd%\ThirdParty\Strawberry\perl\bin;%cd%\ThirdParty\Python27;%cd%\ThirdParty\NASM;%cd%\ThirdParty\jom;%cd%\ThirdParty\cmake\bin;%cd%\ThirdParty\yasm;%cd%\ThirdParty\gyp;%cd%\ThirdParty\nuget;%PATH%
cd ThirdParty
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout e052c49
cd ../
git clone https://chromium.googlesource.com/external/gyp
cd gyp
git checkout 9f2a7bb1
git apply ../patches/gyp.diff
cd ..\..
mkdir Libraries
cd Libraries
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout e052c49
cd ..
git clone https://github.com/desktop-app/lzma.git
cd lzma\C\Util\LzmaLib
msbuild LzmaLib.sln /property:Configuration=Debug /property:Platform="x86"
msbuild LzmaLib.sln /property:Configuration=Release /property:Platform="x86"
cd ..\..\..\..
git clone https://github.com/openssl/openssl.git openssl_1_1_1
cd openssl_1_1_1
git checkout OpenSSL_1_1_1-stable
perl Configure no-shared no-tests debug-VC-WIN32
nmake
mkdir out32.dbg
move libcrypto.lib out32.dbg
move libssl.lib out32.dbg
move ossl_static.pdb out32.dbg\ossl_static
nmake clean
move out32.dbg\ossl_static out32.dbg\ossl_static.pdb
perl Configure no-shared no-tests VC-WIN32
nmake
mkdir out32
move libcrypto.lib out32
move libssl.lib out32
move ossl_static.pdb out32
cd ..
git clone https://github.com/desktop-app/zlib.git
cd zlib\contrib\vstudio\vc14
msbuild zlibstat.vcxproj /property:Configuration=Debug /property:Platform="x86"
msbuild zlibstat.vcxproj /property:Configuration=ReleaseWithoutAsm /property:Platform="x86"
cd ..\..\..\..
git clone -b v4.0.1-rc2 https://github.com/mozilla/mozjpeg.git
cd mozjpeg
cmake . ^
-G "Visual Studio 16 2019" ^
-A Win32 ^
-DWITH_JPEG8=ON ^
-DPNG_SUPPORTED=OFF
cmake --build . --config Debug
cmake --build . --config Release
cd ..
git clone https://github.com/kcat/openal-soft.git
cd openal-soft
git checkout openal-soft-1.21.0
cd build
cmake .. ^
-G "Visual Studio 16 2019" ^
-A Win32 ^
-D LIBTYPE:STRING=STATIC ^
-D FORCE_STATIC_VCRT=ON
msbuild OpenAL.vcxproj /property:Configuration=Debug
msbuild OpenAL.vcxproj /property:Configuration=RelWithDebInfo
cd ..\..
git clone https://github.com/google/breakpad
cd breakpad
git checkout a1dbcdcb43
git apply ../patches/breakpad.diff
cd src
git clone https://github.com/google/googletest testing
cd client\windows
gyp --no-circular-check breakpad_client.gyp --format=ninja
cd ..\..
ninja -C out/Debug common crash_generation_client exception_handler
ninja -C out/Release common crash_generation_client exception_handler
cd tools\windows\dump_syms
gyp dump_syms.gyp
msbuild dump_syms.vcxproj /property:Configuration=Release
cd ..\..\..\..\..
git clone https://github.com/telegramdesktop/opus.git
cd opus
git checkout tdesktop
cd win32\VS2015
msbuild opus.sln /property:Configuration=Debug /property:Platform="Win32"
msbuild opus.sln /property:Configuration=Release /property:Platform="Win32"
cd ..\..\..\..
SET PATH_BACKUP_=%PATH%
SET PATH=%cd%\ThirdParty\msys64\usr\bin;%PATH%
cd Libraries
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
git checkout release/4.2
set CHERE_INVOKING=enabled_from_arguments
set MSYS2_PATH_TYPE=inherit
bash --login ../patches/build_ffmpeg_win.sh
SET PATH=%PATH_BACKUP_%
cd ..
SET LibrariesPath=%cd%
git clone git://code.qt.io/qt/qt5.git qt_5_15_1
cd qt_5_15_1
perl init-repository --module-subset=qtbase,qtimageformats,qtwebsockets
git checkout v5.15.1
git submodule update qtbase qtimageformats qtwebsockets
cd qtbase
for /r %i in (..\..\patches\qtbase_5_15_1\*) do git apply %i
cd ..
configure ^
-prefix "%LibrariesPath%\Qt-5.15.1" ^
-debug-and-release ^
-force-debug-info ^
-opensource ^
-confirm-license ^
-static ^
-static-runtime ^
-no-opengl ^
-openssl-linked ^
-I "%LibrariesPath%\openssl_1_1_1\include" ^
OPENSSL_LIBS_DEBUG="%LibrariesPath%\openssl_1_1_1\out32.dbg\libssl.lib %LibrariesPath%\openssl_1_1_1\out32.dbg\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" ^
OPENSSL_LIBS_RELEASE="%LibrariesPath%\openssl_1_1_1\out32\libssl.lib %LibrariesPath%\openssl_1_1_1\out32\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" ^
-I "%LibrariesPath%\mozjpeg" ^
LIBJPEG_LIBS_DEBUG="%LibrariesPath%\mozjpeg\Debug\jpeg-static.lib" ^
LIBJPEG_LIBS_RELEASE="%LibrariesPath%\mozjpeg\Release\jpeg-static.lib" ^
-mp ^
-nomake examples ^
-nomake tests ^
-platform win32-msvc
jom -j16
jom -j8 install
cd ..
git clone --recursive https://github.com/desktop-app/tg_owt.git
cd tg_owt
mkdir out
cd out
mkdir Debug
cd Debug
cmake -G Ninja ^
-DCMAKE_BUILD_TYPE=Debug ^
-DTG_OWT_SPECIAL_TARGET=win ^
-DTG_OWT_LIBJPEG_INCLUDE_PATH=%cd%/../../../mozjpeg ^
-DTG_OWT_OPENSSL_INCLUDE_PATH=%cd%/../../../openssl_1_1_1/include ^
-DTG_OWT_OPUS_INCLUDE_PATH=%cd%/../../../opus/include ^
-DTG_OWT_FFMPEG_INCLUDE_PATH=%cd%/../../../ffmpeg ../..
ninja
cd ..
mkdir Release
cd Release
cmake -G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
-DTG_OWT_SPECIAL_TARGET=win ^
-DTG_OWT_LIBJPEG_INCLUDE_PATH=%cd%/../../../mozjpeg ^
-DTG_OWT_OPENSSL_INCLUDE_PATH=%cd%/../../../openssl_1_1_1/include ^
-DTG_OWT_OPUS_INCLUDE_PATH=%cd%/../../../opus/include ^
-DTG_OWT_FFMPEG_INCLUDE_PATH=%cd%/../../../ffmpeg ../..
ninja
cd ../../../../../
cd tdesktop/Telegram
configure.bat -D TDESKTOP_API_ID=17349 -D TDESKTOP_API_HASH=344583e45741c457fe1862106095a5eb -D DESKTOP_APP_USE_PACKAGED=OFF -D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF -D DESKTOP_APP_SPECIAL_TARGET=win
configure.bat x64 -D TDESKTOP_API_ID=17349 -D TDESKTOP_API_HASH=344583e45741c457fe1862106095a5eb -D DESKTOP_APP_USE_PACKAGED=OFF -D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF
pase</code></pre>
<p>nuget下载地址:
<a href="https://dist.nuget.org/win-x86-commandline/v6.1.0/nuget.exe">https://dist.nuget.org/win-x86-commandline/v6.1.0/nuget.exe</a></p>
<p>附最终环境变量:
set path=D:\Black\client-secret-app\ThirdParty\Strawberry\perl\bin;D:\Black\client-secret-app\ThirdParty\Python27;D:\Black\client-secret-app\ThirdParty\NASM;D:\Black\client-secret-app\ThirdParty\jom;D:\Black\client-secret-app\ThirdParty\cmake\bin;D:\Black\client-secret-app\ThirdParty\yasm;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\IntelliCode\CLI;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\devinit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;D:\Black\client-secret-app\ThirdParty\Strawberry\c\bin;D:\Black\client-secret-app\ThirdParty\Strawberry\perl\site\bin;D:\Black\client-secret-app\ThirdParty\Strawberry\perl\bin;D:\Black\client-secret-app\ThirdParty\CMake\bin;C:\Program Files\Git\cmd;D:\Black\client-secret-app\ThirdParty\gyp;D:\Black\client-secret-app\ThirdParty\Ninja;C:\Users\sgw\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VC\Linux\bin\ConnectionManagerExe;D:\Black\client-secret-app\ThirdParty\nuget</p>