mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-24 09:16:57 +00:00
GYP/Ninja Windows build: codegen done, WinXP done, Release done.
MetaLang, codegen_style and codegen_numbers utilities are now built by GYP targets, rules added for codegen_style and actions added for codegen_numbers and MetaLang. WinXP supported without Windows 7.1A SDK, but with explicitly setting MinimumRequiredVersion=5.01. It works (and that is strange). If you attempt to use MSBuild instead of Ninja you should add the latest Windows SDK include paths to include_dirs, because v140_xp toolset implies the Windows 7.1A SDK (and is ignored by Ninja).
This commit is contained in:
parent
62cab0750b
commit
a4c98e74ce
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,6 +1,8 @@
|
||||
/out/
|
||||
/Debug/
|
||||
/Release/
|
||||
/Deploy/
|
||||
/Telegram/build/target
|
||||
/Telegram/build/msvs/
|
||||
/Telegram/GeneratedFiles/
|
||||
/Telegram/SourceFiles/art/grid.png
|
||||
/Telegram/SourceFiles/art/grid_125x.png
|
||||
@ -15,7 +17,7 @@
|
||||
/Telegram/Resources/art/sprite_125x.png
|
||||
/Telegram/Resources/art/sprite_150x.png
|
||||
/Telegram/*.user
|
||||
*.vcxproj.user
|
||||
*.vcxproj*
|
||||
*.suo
|
||||
*.sdf
|
||||
*.opensdf
|
||||
|
File diff suppressed because it is too large
Load Diff
124
Telegram/gyp/codegen.gyp
Normal file
124
Telegram/gyp/codegen.gyp
Normal file
@ -0,0 +1,124 @@
|
||||
# This file is part of Telegram Desktop,
|
||||
# the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
#
|
||||
# Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# It is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give permission
|
||||
# to link the code of portions of this program with the OpenSSL library.
|
||||
#
|
||||
# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
# Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
{
|
||||
'targets': [{
|
||||
'target_name': 'MetaLang',
|
||||
'variables': {
|
||||
'libs_loc': '../../../Libraries',
|
||||
'src_loc': '../SourceFiles',
|
||||
'gen_loc': '../GeneratedFiles',
|
||||
},
|
||||
'includes': [
|
||||
'common_executable.gypi',
|
||||
'qt.gypi',
|
||||
],
|
||||
|
||||
'include_dirs': [
|
||||
'<(src_loc)',
|
||||
'<(gen_loc)',
|
||||
],
|
||||
'sources': [
|
||||
'<(src_loc)/_other/mlmain.cpp',
|
||||
'<(src_loc)/_other/mlmain.h',
|
||||
'<(src_loc)/_other/genlang.cpp',
|
||||
'<(src_loc)/_other/genlang.h',
|
||||
],
|
||||
}, {
|
||||
'target_name': 'codegen_style',
|
||||
'variables': {
|
||||
'libs_loc': '../../../Libraries',
|
||||
'src_loc': '../SourceFiles',
|
||||
},
|
||||
'includes': [
|
||||
'common_executable.gypi',
|
||||
'qt.gypi',
|
||||
],
|
||||
|
||||
'include_dirs': [
|
||||
'<(src_loc)',
|
||||
],
|
||||
'sources': [
|
||||
'<(src_loc)/codegen/common/basic_tokenized_file.cpp',
|
||||
'<(src_loc)/codegen/common/basic_tokenized_file.h',
|
||||
'<(src_loc)/codegen/common/checked_utf8_string.cpp',
|
||||
'<(src_loc)/codegen/common/checked_utf8_string.h',
|
||||
'<(src_loc)/codegen/common/clean_file.cpp',
|
||||
'<(src_loc)/codegen/common/clean_file.h',
|
||||
'<(src_loc)/codegen/common/clean_file_reader.h',
|
||||
'<(src_loc)/codegen/common/const_utf8_string.h',
|
||||
'<(src_loc)/codegen/common/cpp_file.cpp',
|
||||
'<(src_loc)/codegen/common/cpp_file.h',
|
||||
'<(src_loc)/codegen/common/logging.cpp',
|
||||
'<(src_loc)/codegen/common/logging.h',
|
||||
'<(src_loc)/codegen/style/generator.cpp',
|
||||
'<(src_loc)/codegen/style/generator.h',
|
||||
'<(src_loc)/codegen/style/main.cpp',
|
||||
'<(src_loc)/codegen/style/module.cpp',
|
||||
'<(src_loc)/codegen/style/module.h',
|
||||
'<(src_loc)/codegen/style/options.cpp',
|
||||
'<(src_loc)/codegen/style/options.h',
|
||||
'<(src_loc)/codegen/style/parsed_file.cpp',
|
||||
'<(src_loc)/codegen/style/parsed_file.h',
|
||||
'<(src_loc)/codegen/style/processor.cpp',
|
||||
'<(src_loc)/codegen/style/processor.h',
|
||||
'<(src_loc)/codegen/style/sprite_generator.cpp',
|
||||
'<(src_loc)/codegen/style/sprite_generator.h',
|
||||
'<(src_loc)/codegen/style/structure_types.cpp',
|
||||
'<(src_loc)/codegen/style/structure_types.h',
|
||||
],
|
||||
}, {
|
||||
'target_name': 'codegen_numbers',
|
||||
'variables': {
|
||||
'libs_loc': '../../../Libraries',
|
||||
'src_loc': '../SourceFiles',
|
||||
},
|
||||
'includes': [
|
||||
'common_executable.gypi',
|
||||
'qt.gypi',
|
||||
],
|
||||
|
||||
'include_dirs': [
|
||||
'<(src_loc)',
|
||||
],
|
||||
'sources': [
|
||||
'<(src_loc)/codegen/common/basic_tokenized_file.cpp',
|
||||
'<(src_loc)/codegen/common/basic_tokenized_file.h',
|
||||
'<(src_loc)/codegen/common/checked_utf8_string.cpp',
|
||||
'<(src_loc)/codegen/common/checked_utf8_string.h',
|
||||
'<(src_loc)/codegen/common/clean_file.cpp',
|
||||
'<(src_loc)/codegen/common/clean_file.h',
|
||||
'<(src_loc)/codegen/common/clean_file_reader.h',
|
||||
'<(src_loc)/codegen/common/const_utf8_string.h',
|
||||
'<(src_loc)/codegen/common/cpp_file.cpp',
|
||||
'<(src_loc)/codegen/common/cpp_file.h',
|
||||
'<(src_loc)/codegen/common/logging.cpp',
|
||||
'<(src_loc)/codegen/common/logging.h',
|
||||
'<(src_loc)/codegen/numbers/generator.cpp',
|
||||
'<(src_loc)/codegen/numbers/generator.h',
|
||||
'<(src_loc)/codegen/numbers/main.cpp',
|
||||
'<(src_loc)/codegen/numbers/options.cpp',
|
||||
'<(src_loc)/codegen/numbers/options.h',
|
||||
'<(src_loc)/codegen/numbers/parsed_file.cpp',
|
||||
'<(src_loc)/codegen/numbers/parsed_file.h',
|
||||
'<(src_loc)/codegen/numbers/processor.cpp',
|
||||
'<(src_loc)/codegen/numbers/processor.h',
|
||||
],
|
||||
}],
|
||||
}
|
57
Telegram/gyp/create_env.py
Normal file
57
Telegram/gyp/create_env.py
Normal file
@ -0,0 +1,57 @@
|
||||
'''
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
In addition, as a special exception, the copyright holders give permission
|
||||
to link the code of portions of this program with the OpenSSL library.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
'''
|
||||
import glob
|
||||
import re
|
||||
import os
|
||||
|
||||
# Generate custom environment.x86 for ninja
|
||||
# We use msbuild.log to extract some variables
|
||||
variables = [
|
||||
'TMP',
|
||||
'SYSTEMROOT',
|
||||
'TEMP',
|
||||
'LIB',
|
||||
'LIBPATH',
|
||||
'PATH',
|
||||
'PATHEXT',
|
||||
'INCLUDE',
|
||||
]
|
||||
var_values = {}
|
||||
for var_name in variables:
|
||||
var_values[var_name] = os.environ[var_name]
|
||||
|
||||
next_contains_var = 0
|
||||
with open('msbuild.log') as f:
|
||||
for line in f:
|
||||
if (re.match(r'^\s*Task "SetEnv"\s*$', line)):
|
||||
next_contains_var = 1
|
||||
elif next_contains_var:
|
||||
cleanline = re.sub(r'^\s*|\s*$', '', line)
|
||||
name_value_pair = re.match(r'^([A-Z]+)=(.+)$', cleanline)
|
||||
if name_value_pair:
|
||||
var_values[name_value_pair.group(1)] = name_value_pair.group(2)
|
||||
next_contains_var = 0
|
||||
|
||||
out = open('environment.x86', 'wb')
|
||||
for var_name in variables:
|
||||
out.write(var_name + '=' + var_values[var_name] + '\0')
|
||||
out.write('\0')
|
||||
out.close()
|
@ -118,34 +118,34 @@
|
||||
'rules': [{
|
||||
'rule_name': 'qt_moc',
|
||||
'extension': 'h',
|
||||
'inputs': [
|
||||
],
|
||||
'outputs': [
|
||||
'<(gen_loc)/moc/moc_<(RULE_INPUT_ROOT).cpp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
|
||||
],
|
||||
'action': [
|
||||
'<(qt_loc)/bin/moc.exe',
|
||||
|
||||
# Silence "Note: No relevant classes found. No output generated."
|
||||
'--no-notes',
|
||||
|
||||
'<!@(python -c "for s in \'<@(_defines)\'.split(\' \'): print(\'-D\' + s))',
|
||||
'<!@(python -c "for s in \'<@(_include_dirs)\'.split(\' \'): print(\'-I\' + s))',
|
||||
# '<!@(python -c "for s in \'<@(_include_dirs)\'.split(\' \'): print(\'-I\' + s))',
|
||||
'<(RULE_INPUT_PATH)',
|
||||
'-o', '<(gen_loc)/moc/moc_<(RULE_INPUT_ROOT).cpp',
|
||||
'-o', '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
|
||||
],
|
||||
'message': 'Moc-ing <(RULE_INPUT_ROOT).h..',
|
||||
'process_outputs_as_sources': 1,
|
||||
}, {
|
||||
'rule_name': 'qt_rcc',
|
||||
'extension': 'qrc',
|
||||
'inputs': [
|
||||
],
|
||||
'outputs': [
|
||||
'<(gen_loc)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
|
||||
],
|
||||
'action': [
|
||||
'<(qt_loc)/bin/rcc.exe',
|
||||
'-name', '<(RULE_INPUT_ROOT)',
|
||||
'-no-compress',
|
||||
'<(RULE_INPUT_PATH)',
|
||||
'-o', '<(gen_loc)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
|
||||
'-o', '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
|
||||
],
|
||||
'message': 'Rcc-ing <(RULE_INPUT_ROOT).qrc..',
|
||||
'process_outputs_as_sources': 1,
|
||||
|
@ -3,9 +3,40 @@ setlocal enabledelayedexpansion
|
||||
set "FullScriptPath=%~dp0"
|
||||
set "FullExecPath=%cd%"
|
||||
|
||||
cd "%FullScriptPath%"
|
||||
call gyp --depth=. --generator-output=../build/msvs -Goutput_dir=../../../out Telegram.gyp --format=ninja
|
||||
call gyp --depth=. --generator-output=../build/msvs -Goutput_dir=../../../out Telegram.gyp --format=msvs-ninja
|
||||
cd "%FullExecPath%"
|
||||
set "Silence=>nul"
|
||||
if "%1" == "-v" set "Silence="
|
||||
|
||||
cd "%FullScriptPath%"
|
||||
call gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=ninja
|
||||
if %errorlevel% neq 0 goto error
|
||||
call gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=msvs-ninja
|
||||
if %errorlevel% neq 0 goto error
|
||||
cd ../..
|
||||
|
||||
rem looks like ninja build works without sdk 7.1 which was used by generating custom environment.arch files
|
||||
|
||||
rem cd "%FullScriptPath%"
|
||||
rem call gyp --depth=. --generator-output=../.. -Goutput_dir=out -Gninja_use_custom_environment_files=1 Telegram.gyp --format=ninja
|
||||
rem if %errorlevel% neq 0 goto error
|
||||
rem call gyp --depth=. --generator-output=../.. -Goutput_dir=out -Gninja_use_custom_environment_files=1 Telegram.gyp --format=msvs-ninja
|
||||
rem if %errorlevel% neq 0 goto error
|
||||
rem cd ../..
|
||||
|
||||
rem call msbuild /target:SetBuildDefaultEnvironmentVariables Telegram.vcxproj /fileLogger %Silence%
|
||||
rem if %errorlevel% neq 0 goto error
|
||||
|
||||
rem call python "%FullScriptPath%create_env.py"
|
||||
rem if %errorlevel% neq 0 goto error
|
||||
|
||||
rem call move environment.x86 out\Debug\ %Silence%
|
||||
rem if %errorlevel% neq 0 goto error
|
||||
|
||||
cd "%FullExecPath%"
|
||||
exit /b
|
||||
|
||||
:error
|
||||
echo FAILED
|
||||
if exist "%FullScriptPath%..\..\msbuild.log" del "%FullScriptPath%..\..\msbuild.log"
|
||||
if exist "%FullScriptPath%..\..\environment.x86" del "%FullScriptPath%..\..\environment.x86"
|
||||
cd "%FullExecPath%"
|
||||
exit /b 1
|
||||
|
@ -37,12 +37,15 @@
|
||||
'HAVE_STDINT_H',
|
||||
'ZLIB_WINAPI',
|
||||
'_SCL_SECURE_NO_WARNINGS',
|
||||
'_USING_V110_SDK71_',
|
||||
],
|
||||
'TreatWChar_tAsBuiltInType': 'false',
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
'SubSystem': '<(win_subsystem)',
|
||||
'MinimumRequiredVersion': '5.01',
|
||||
'ImageHasSafeExceptionHandlers': 'false', # Disable /SAFESEH
|
||||
'ImportLibrary': '<(PRODUCT_DIR)/<(_target_name).lib',
|
||||
},
|
||||
},
|
||||
'libraries': [
|
||||
@ -61,8 +64,6 @@
|
||||
'uuid',
|
||||
'odbc32',
|
||||
'odbccp32',
|
||||
# 'glu32',
|
||||
# 'opengl32',
|
||||
'Shlwapi',
|
||||
'Iphlpapi',
|
||||
'Gdiplus',
|
||||
@ -74,40 +75,30 @@
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'Optimization': '0', # Disabled (/Od)
|
||||
'PreprocessorDefinitions': [
|
||||
],
|
||||
'RuntimeLibrary': '1', # Multi-threaded Debug (/MTd)
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
'GenerateDebugInformation': 'true', # true (/DEBUG)
|
||||
'IgnoreDefaultLibraryNames': 'LIBCMT',
|
||||
'LinkIncremental': '2', # Yes (/INCREMENTAL)
|
||||
'AdditionalDependencies': [
|
||||
'msvcrtd.lib',
|
||||
],
|
||||
'AdditionalOptions': [
|
||||
'/NODEFAULTLIB:LIBCMTD'
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
'Release': {
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'Optimization': '2', # Maximize Speed (/O2)
|
||||
'PreprocessorDefinitions': [
|
||||
],
|
||||
'FavorSizeOrSpeed': '1', # Favor fast code (/Ot)
|
||||
'RuntimeLibrary': '0', # Multi-threaded (/MT)
|
||||
'EnableEnhancedInstructionSet': '2',# Streaming SIMD Extensions 2 (/arch:SSE2)
|
||||
'Optimization': '2', # Maximize Speed (/O2)
|
||||
'InlineFunctionExpansion': '2', # Any suitable (/Ob2)
|
||||
'EnableIntrinsicFunctions': 'true', # Yes (/Oi)
|
||||
'FavorSizeOrSpeed': '1', # Favor fast code (/Ot)
|
||||
'RuntimeLibrary': '0', # Multi-threaded (/MT)
|
||||
'EnableEnhancedInstructionSet': '2', # Streaming SIMD Extensions 2 (/arch:SSE2)
|
||||
'WholeProgramOptimization': 'true', # /GL
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
'GenerateDebugInformation': 'true', # /DEBUG
|
||||
'AdditionalDependencies': [
|
||||
'msvcrt.lib',
|
||||
],
|
||||
'AdditionalOptions': [
|
||||
'/NODEFAULTLIB:LIBCMT'
|
||||
],
|
||||
'GenerateDebugInformation': 'true', # /DEBUG
|
||||
'OptimizeReferences': '2',
|
||||
'LinkTimeCodeGeneration': '1', # /LTCG
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user