近来项目有需求下载telegram小飞机的源码修改,编译。这个是c++的项目,界面使用qt框架搭建的。属于开源的项目,所以可以拿来修改自己使用,搜索啊,安装git,注册那些就不说了,不会的去查资料,下面说干就开始干吧。
1、先去github上面找到仓库地址:https://github.com/telegramdesktop/tdesktop
2、浏览可以了解一些说明,最底下有一个构建说明,打开win-64bit,打开后是一个构建步骤说明,按他官方的步骤进行
3、一般按他的步骤说明进行即可,但是做为一个世界级的项目,不可能是那么简单,不是一下就会成功构建的,所以在此点出一些特别重要点,本人进行了3天时间才完成,其中各种摸索和查资料
4、第一个重要点,vs2022的win sdk版本一定要按他的要求版本安装,一般vs正常安装后可以再次升级,升级他的sdk版本
5、第二,准备一个优秀的科学上网工具,懂的都懂吧?因为git毕竟是一个开放的仓库,有一些地址必须要科学上网才能down下来。
6、第三,杀毒软件,现在一般都是强制型的360杀毒或者其他杀毒软件等,一律关闭,我选折的关闭省事,或者设置白名单也行。因为在down和bat期间是一个递归的过程,自动进行写入文件操作,经常性的调用exe文件处理等,所以不关掉杀毒软件会导致经常性弹窗允许和exe执行失败!
7、多试多看,整个过程通过命令执行会clone一大堆的第三方库到你的文件路径中,命令窗口会自动打印,执行过程中只有等待,如有某一步出错后,查找修改后再试!
mkdir Libraries cd Libraries git clone https://github.com/Microsoft/Range-V3-VS2015 range-v3 git clone https://github.com/telegramdesktop/lzma.git cd lzma\C\Util\LzmaLib msbuild LzmaLib.sln /property:Configuration=Debug msbuild LzmaLib.sln /property:Configuration=Release cd ..\..\..\.. git clone https://github.com/openssl/openssl.git cd openssl git checkout OpenSSL_1_0_1-stable perl Configure no-shared --prefix=%cd%\Release --openssldir=%cd%\Release VC-WIN32 ms\do_ms nmake -f ms\nt.mak nmake -f ms\nt.mak install xcopy tmp32\lib.pdb Release\lib\ nmake -f ms\nt.mak clean perl Configure no-shared --prefix=%cd%\Debug --openssldir=%cd%\Debug debug-VC-WIN32 ms\do_ms nmake -f ms\nt.mak nmake -f ms\nt.mak install xcopy tmp32.dbg\lib.pdb Debug\lib\ cd .. git clone https://github.com/telegramdesktop/zlib.git cd zlib git checkout tdesktop cd contrib\vstudio\vc14 msbuild zlibstat.vcxproj /property:Configuration=Debug msbuild zlibstat.vcxproj /property:Configuration=ReleaseWithoutAsm cd ..\..\..\.. git clone git://repo.or.cz/openal-soft.git cd openal-soft git checkout 18bb46163af cd build cmake -G "Visual Studio 15 2017" -D LIBTYPE:STRING=STATIC -D FORCE_STATIC_VCRT:STRING=ON .. msbuild OpenAL32.vcxproj /property:Configuration=Debug msbuild OpenAL32.vcxproj /property:Configuration=Release cd ..\.. git clone https://github.com/google/breakpad cd breakpad git checkout a1dbcdcb43 git apply ../../tdesktop/Telegram/Patches/breakpad.diff cd src git clone https://github.com/google/googletest testing cd client\windows set GYP_MSVS_VERSION=2017 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 ..\.. 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/3.4 set CHERE_INVOKING=enabled_from_arguments set MSYS2_PATH_TYPE=inherit bash --login ../../tdesktop/Telegram/Patches/build_ffmpeg_win.sh SET PATH=%PATH_BACKUP_% cd .. git clone git://code.qt.io/qt/qt5.git qt5_6_2 cd qt5_6_2 perl init-repository --module-subset=qtbase,qtimageformats git checkout v5.6.2 cd qtimageformats git checkout v5.6.2 cd ..\qtbase git checkout v5.6.2 git apply ../../../tdesktop/Telegram/Patches/qtbase_5_6_2.diff cd .. configure -debug-and-release -force-debug-info -opensource -confirm-license -static -I "%cd%\..\openssl\Release\include" -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="%cd%\..\openssl\Debug\lib\ssleay32.lib %cd%\..\openssl\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="%cd%\..\openssl\Release\lib\ssleay32.lib %cd%\..\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015 jom -j4 jom -j4 install cd ..8、最后打开out输出文件夹,用.sln方案打开解决方案后,编译,生成输出到out的debug中telegram.exe程序,注意登陆也要科学上网!
以上就是文章的全部内容了,祝你也编译顺利成功!
发表评论