diff --git a/CMakeLists.txt b/CMakeLists.txt index e7df6ae72e..e337defd25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ project(Telegram DESCRIPTION "Official Telegram Desktop messenger" HOMEPAGE_URL "https://desktop.telegram.org" ) +set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Telegram) include(cmake/nice_target_sources.cmake) include(cmake/target_link_static_libraries.cmake) diff --git a/Telegram/build/build.bat b/Telegram/build/build.bat index 88b5c4e923..52695311a8 100644 --- a/Telegram/build/build.bat +++ b/Telegram/build/build.bat @@ -48,11 +48,11 @@ echo. set "HomePath=%FullScriptPath%.." set "ResourcesPath=%HomePath%\Resources" -set "SolutionPath=%HomePath%\.." +set "SolutionPath=%HomePath%\..\out" set "UpdateFile=tupdate%AppVersion%" set "SetupFile=tsetup.%AppVersionStrFull%.exe" set "PortableFile=tportable.%AppVersionStrFull%.zip" -set "ReleasePath=%HomePath%\..\out\Release" +set "ReleasePath=%SolutionPath%\Release" set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%" set "SignPath=%HomePath%\..\..\DesktopPrivate\Sign.bat" set "BinaryName=Telegram" @@ -105,25 +105,25 @@ if %AlphaVersion% neq 0 ( cd "%HomePath%" -call gyp\refresh.bat +call configure.bat if %errorlevel% neq 0 goto error cd "%SolutionPath%" -call ninja -C out/Release Telegram +call cmake --build . --config Release --target Telegram if %errorlevel% neq 0 goto error echo. echo Version %AppVersionStrFull% build successfull. Preparing.. echo. -if not exist "%SolutionPath%\..\Libraries\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe" ( +if not exist "%SolutionPath%\..\..\Libraries\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe" ( echo Utility dump_syms not found! exit /b 1 ) echo Dumping debug symbols.. xcopy "%ReleasePath%\%BinaryName%.exe" "%ReleasePath%\%BinaryName%.exe.exe*" -call "%SolutionPath%\..\Libraries\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe" "%ReleasePath%\%BinaryName%.exe.pdb" > "%ReleasePath%\%BinaryName%.exe.sym" +call "%SolutionPath%\..\..\Libraries\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe" "%ReleasePath%\%BinaryName%.exe.pdb" > "%ReleasePath%\%BinaryName%.exe.sym" del "%ReleasePath%\%BinaryName%.exe.exe" echo Done! diff --git a/Telegram/configure.bat b/Telegram/configure.bat new file mode 100644 index 0000000000..3e38d6ee59 --- /dev/null +++ b/Telegram/configure.bat @@ -0,0 +1,12 @@ +@echo OFF + +set "FullScriptPath=%~dp0" + +python %FullScriptPath%configure.py %* +if %errorlevel% neq 0 goto error + +exit /b + +:error +echo FAILED +exit /b 1 diff --git a/Telegram/configure.py b/Telegram/configure.py new file mode 100644 index 0000000000..c97b60e9f1 --- /dev/null +++ b/Telegram/configure.py @@ -0,0 +1,54 @@ +''' +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +''' +import sys, os, re + +sys.dont_write_bytecode = True +scriptPath = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(scriptPath + '/../cmake') +import run_cmake + +executePath = os.getcwd() +def finish(code): + global executePath + os.chdir(executePath) + sys.exit(code) + +def error(message): + print('[ERROR] ' + message) + finish(1) + +if sys.platform == 'win32' and not 'COMSPEC' in os.environ: + error('COMSPEC environment variable is not set.') + +executePath = os.getcwd() +scriptPath = os.path.dirname(os.path.realpath(__file__)) + +arguments = sys.argv[1:] + +officialTarget = '' +officialTargetFile = scriptPath + '/build/target' +if os.path.isfile(officialTargetFile): + with open(officialTargetFile, 'r') as f: + for line in f: + officialTarget = line.strip() + +if officialTarget != '': + officialApiIdFile = scriptPath + '/../../DesktopPrivate/custom_api_id.h' + if not os.path.isfile(officialApiIdFile): + print("[ERROR] DesktopPrivate/custom_api_id.h not found.") + finish(1) + with open(officialApiIdFile, 'r') as f: + for line in f: + apiIdMatch = re.search(r'ApiId\s+=\s+(\d+)', line) + apiHashMatch = re.search(r'ApiHash\s+=\s+"([a-fA-F\d]+)"', line) + if apiIdMatch: + arguments.append('-DTDESKTOP_API_ID=' + apiIdMatch.group(1)) + elif apiHashMatch: + arguments.append('-DTDESKTOP_API_HASH=' + apiHashMatch.group(1)) + +finish(run_cmake.run(os.path.basename(scriptPath), arguments)) diff --git a/Telegram/lib_base b/Telegram/lib_base index 4592f56c23..78690f858f 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit 4592f56c23cb1d35f9528c1cbcaa17cb3188943c +Subproject commit 78690f858fc48b1bc824fd52a7d90a1080b0610e diff --git a/cmake b/cmake index 3182d2d4a7..632ed315b2 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 3182d2d4a7cbfd4290a46ee6baeb3355f5028349 +Subproject commit 632ed315b2054c65954b3d4818b4b5326a0933e8