diff --git a/Telegram/SourceFiles/_other/genlang.cpp b/Telegram/SourceFiles/_other/genlang.cpp index f8924fadb2..17cb660652 100644 --- a/Telegram/SourceFiles/_other/genlang.cpp +++ b/Telegram/SourceFiles/_other/genlang.cpp @@ -27,14 +27,7 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) #endif #ifdef Q_OS_MAC -Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) -Q_IMPORT_PLUGIN(QDDSPlugin) -Q_IMPORT_PLUGIN(QICNSPlugin) -Q_IMPORT_PLUGIN(QICOPlugin) -Q_IMPORT_PLUGIN(QTgaPlugin) -Q_IMPORT_PLUGIN(QTiffPlugin) -Q_IMPORT_PLUGIN(QWbmpPlugin) -Q_IMPORT_PLUGIN(QWebpPlugin) +//Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) #endif typedef unsigned int uint32; diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp index 08f17ccb5c..95acbaea38 100644 --- a/Telegram/SourceFiles/_other/packer.cpp +++ b/Telegram/SourceFiles/_other/packer.cpp @@ -23,14 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include #ifdef Q_OS_MAC -Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) -Q_IMPORT_PLUGIN(QDDSPlugin) -Q_IMPORT_PLUGIN(QICNSPlugin) -Q_IMPORT_PLUGIN(QICOPlugin) -Q_IMPORT_PLUGIN(QTgaPlugin) -Q_IMPORT_PLUGIN(QTiffPlugin) -Q_IMPORT_PLUGIN(QWbmpPlugin) -Q_IMPORT_PLUGIN(QWebpPlugin) +//Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) #endif bool AlphaChannel = false; diff --git a/Telegram/SourceFiles/stdafx.cpp b/Telegram/SourceFiles/stdafx.cpp index 0cef37654f..680dd0cd34 100644 --- a/Telegram/SourceFiles/stdafx.cpp +++ b/Telegram/SourceFiles/stdafx.cpp @@ -30,12 +30,6 @@ Q_IMPORT_PLUGIN(QWebpPlugin) #elif defined Q_OS_MAC // Q_OS_WIN Q_IMPORT_PLUGIN(QGenericEnginePlugin) Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) -Q_IMPORT_PLUGIN(QDDSPlugin) -Q_IMPORT_PLUGIN(QICNSPlugin) -Q_IMPORT_PLUGIN(QICOPlugin) -Q_IMPORT_PLUGIN(QTgaPlugin) -Q_IMPORT_PLUGIN(QTiffPlugin) -Q_IMPORT_PLUGIN(QWbmpPlugin) Q_IMPORT_PLUGIN(QWebpPlugin) #elif defined Q_OS_LINUX // Q_OS_LINUX Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp index fe41c59516..574af1a3ff 100644 --- a/Telegram/gyp/Telegram.gyp +++ b/Telegram/gyp/Telegram.gyp @@ -24,6 +24,7 @@ 'libs_loc': '../../../Libraries', 'src_loc': '../SourceFiles', 'res_loc': '../Resources', + 'minizip_loc': '../ThirdParty/minizip', 'style_files': [ '<(res_loc)/basic.style', '<(res_loc)/basic_types.style', @@ -35,13 +36,14 @@ '<(src_loc)/profile/profile.style', '<(src_loc)/ui/widgets/widgets.style', ], - 'qrc_files': [ - '<(res_loc)/telegram.qrc', - '<(res_loc)/telegram_emojis.qrc', - ], + 'mac_target': '10.8', }, 'includes': [ 'common_executable.gypi', + 'telegram_qrc.gypi', + 'telegram_win.gypi', + 'telegram_mac.gypi', + 'telegram_linux.gypi', 'qt.gypi', 'codegen_rules.gypi', ], @@ -61,12 +63,14 @@ '<(src_loc)', '<(SHARED_INTERMEDIATE_DIR)', '<(libs_loc)/breakpad/src', + '<(libs_loc)/crashpad/crashpad', + '<(libs_loc)/crashpad/crashpad/third_party/mini_chromium/mini_chromium', '<(libs_loc)/lzma/C', '<(libs_loc)/libexif-0.6.20', '<(libs_loc)/zlib-1.2.8', '<(libs_loc)/ffmpeg', '<(libs_loc)/openal-soft/include', - '../ThirdParty/minizip', + '<(minizip_loc)', ], 'library_dirs': [ '<(libs_loc)/ffmpeg', @@ -277,6 +281,12 @@ '<(src_loc)/overview/overview_layout.h', '<(src_loc)/pspecific_win.cpp', '<(src_loc)/pspecific_win.h', + '<(src_loc)/pspecific_mac.cpp', + '<(src_loc)/pspecific_mac.h', + '<(src_loc)/pspecific_mac_p.mm', + '<(src_loc)/pspecific_mac_p.h', + '<(src_loc)/pspecific_linux.cpp', + '<(src_loc)/pspecific_linux.h', '<(src_loc)/platform/linux/linux_gdk_helper.cpp', '<(src_loc)/platform/linux/linux_gdk_helper.h', '<(src_loc)/platform/linux/linux_libs.cpp', @@ -407,20 +417,6 @@ '<(src_loc)/window/top_bar_widget.h', ], 'configurations': { - 'Debug': { - 'include_dirs': [ - '<(libs_loc)/openssl_debug/Debug/include', - ], - 'library_dirs': [ - '<(libs_loc)/lzma/C/Util/LzmaLib/Debug', - '<(libs_loc)/libexif-0.6.20/win32/Debug', - '<(libs_loc)/opus/win32/VS2010/Win32/Debug', - '<(libs_loc)/openal-soft/build/Debug', - '<(libs_loc)/zlib-1.2.8/contrib/vstudio/vc11/x86/ZlibStatDebug', - '<(libs_loc)/openssl_debug/Debug/lib', - '<(libs_loc)/breakpad/src/client/windows/Debug', - ], - }, 'Release': { 'conditions': [ ['"<(official_build_target)" != ""', { @@ -429,79 +425,18 @@ ], }], ], - 'include_dirs': [ - '<(libs_loc)/openssl/Release/include', - ], - 'library_dirs': [ - '<(libs_loc)/lzma/C/Util/LzmaLib/Release', - '<(libs_loc)/libexif-0.6.20/win32/Release', - '<(libs_loc)/opus/win32/VS2010/Win32/Release', - '<(libs_loc)/openal-soft/build/Release', - '<(libs_loc)/zlib-1.2.8/contrib/vstudio/vc11/x86/ZlibStatRelease', - '<(libs_loc)/openssl/Release/lib', - '<(libs_loc)/breakpad/src/client/windows/Release', - ], }, }, - 'libraries': [ - 'libeay32', - 'ssleay32', - 'Crypt32', - 'zlibstat', - 'LzmaLib', - 'lib_exif', - 'UxTheme', - 'DbgHelp', - 'OpenAL32', - 'common', - 'libavformat\libavformat.a', - 'libavcodec\libavcodec.a', - 'libavutil\libavutil.a', - 'libswresample\libswresample.a', - 'libswscale\libswscale.a', - 'opus', - 'celt', - 'silk_common', - 'silk_float', - 'lib\common', - 'lib\exception_handler', - 'lib\crash_generation_client', - ], 'conditions': [ [ '"<(official_build_target)" != ""', { 'dependencies': [ 'utils.gyp:Packer', ], }], - [ 'build_linux', { - 'variables': { - 'qrc_files': [ - '<(res_loc)/telegram_linux.qrc', - ], - } - }], - [ 'build_mac', { - 'variables': { - 'qrc_files': [ - '<(res_loc)/telegram_mac.qrc', - ], - } - }], - [ 'build_win', { - 'msvs_precompiled_source': '<(src_loc)/stdafx.cpp', - 'msvs_precompiled_header': '<(src_loc)/stdafx.h', - 'msbuild_toolset': 'v140_xp', #Windows7.1SDK - 'sources': [ - '<(res_loc)/winrc/Telegram.rc', - ], - 'variables': { - 'qrc_files': [ - '<(res_loc)/telegram_wnd.qrc', - ], - } - }], [ '"<(build_linux)" != "1"', { 'sources!': [ + '<(src_loc)/pspecific_linux.cpp', + '<(src_loc)/pspecific_linux.h', '<(src_loc)/platform/linux/linux_gdk_helper.cpp', '<(src_loc)/platform/linux/linux_gdk_helper.h', '<(src_loc)/platform/linux/linux_libs.cpp', @@ -514,12 +449,25 @@ }], [ '"<(build_mac)" != "1"', { 'sources!': [ + '<(src_loc)/pspecific_mac.cpp', + '<(src_loc)/pspecific_mac.h', + '<(src_loc)/pspecific_mac_p.mm', + '<(src_loc)/pspecific_mac_p.h', '<(src_loc)/platform/mac/main_window_mac.mm', '<(src_loc)/platform/mac/main_window_mac.h', ], }], [ '"<(build_win)" != "1"', { + 'sources': [ + '<(minizip_loc)/crypt.h', + '<(minizip_loc)/ioapi.c', + '<(minizip_loc)/ioapi.h', + '<(minizip_loc)/zip.c', + '<(minizip_loc)/zip.h', + ], 'sources!': [ + '<(src_loc)/pspecific_win.cpp', + '<(src_loc)/pspecific_win.h', '<(src_loc)/platform/win/main_window_win.cpp', '<(src_loc)/platform/win/main_window_win.h', '<(src_loc)/platform/win/windows_app_user_model_id.cpp', diff --git a/Telegram/gyp/codegen.gyp b/Telegram/gyp/codegen.gyp index ecdd460141..208c905305 100644 --- a/Telegram/gyp/codegen.gyp +++ b/Telegram/gyp/codegen.gyp @@ -24,6 +24,7 @@ 'libs_loc': '../../../Libraries', 'src_loc': '../SourceFiles', 'gen_loc': '../GeneratedFiles', + 'mac_target': '10.10', }, 'includes': [ 'common_executable.gypi', @@ -45,6 +46,7 @@ 'variables': { 'libs_loc': '../../../Libraries', 'src_loc': '../SourceFiles', + 'mac_target': '10.10', }, 'includes': [ 'common_executable.gypi', @@ -88,6 +90,7 @@ 'variables': { 'libs_loc': '../../../Libraries', 'src_loc': '../SourceFiles', + 'mac_target': '10.10', }, 'includes': [ 'common_executable.gypi', diff --git a/Telegram/gyp/codegen_rules.gypi b/Telegram/gyp/codegen_rules.gypi index a437037e9d..3c5cc5592b 100644 --- a/Telegram/gyp/codegen_rules.gypi +++ b/Telegram/gyp/codegen_rules.gypi @@ -21,7 +21,7 @@ 'actions': [{ 'action_name': 'update_sprites', 'inputs': [ - '<(PRODUCT_DIR)/codegen_style.exe', + '<(PRODUCT_DIR)/codegen_style<(exe_ext)', '<(res_loc)/basic.style', '<(res_loc)/art/sprite.png', '<(res_loc)/art/sprite_200x.png', @@ -31,7 +31,7 @@ '<(res_loc)/art/sprite_150x.png', ], 'action': [ - '<(PRODUCT_DIR)/codegen_style.exe', + '<(PRODUCT_DIR)/codegen_style<(exe_ext)', '-I<(res_loc)', '-I<(src_loc)', '--skip-styles', '<(res_loc)/basic.style', ], @@ -71,7 +71,7 @@ }, { 'action_name': 'codegen_lang', 'inputs': [ - '<(PRODUCT_DIR)/MetaLang.exe', + '<(PRODUCT_DIR)/MetaLang<(exe_ext)', '<(res_loc)/langs/lang.strings', ], 'outputs': [ @@ -79,7 +79,7 @@ '<(SHARED_INTERMEDIATE_DIR)/lang_auto.h', ], 'action': [ - '<(PRODUCT_DIR)/MetaLang.exe', + '<(PRODUCT_DIR)/MetaLang<(exe_ext)', '-lang_in', '<(res_loc)/langs/lang.strings', '-lang_out', '<(SHARED_INTERMEDIATE_DIR)/lang_auto', ], @@ -88,7 +88,7 @@ }, { 'action_name': 'codegen_numbers', 'inputs': [ - '<(PRODUCT_DIR)/codegen_numbers.exe', + '<(PRODUCT_DIR)/codegen_numbers<(exe_ext)', '<(res_loc)/numbers.txt', ], 'outputs': [ @@ -96,7 +96,7 @@ '<(SHARED_INTERMEDIATE_DIR)/numbers.h', ], 'action': [ - '<(PRODUCT_DIR)/codegen_numbers.exe', + '<(PRODUCT_DIR)/codegen_numbers<(exe_ext)', '-o<(SHARED_INTERMEDIATE_DIR)', '<(res_loc)/numbers.txt', ], 'message': 'codegen_numbers-ing numbers.txt..', @@ -106,7 +106,7 @@ 'rule_name': 'codegen_style', 'extension': 'style', 'inputs': [ - '<(PRODUCT_DIR)/codegen_style.exe', + '<(PRODUCT_DIR)/codegen_style<(exe_ext)', '<(SHARED_INTERMEDIATE_DIR)/update_dependent_styles.timestamp', ], 'outputs': [ @@ -114,7 +114,7 @@ '<(SHARED_INTERMEDIATE_DIR)/styles/style_<(RULE_INPUT_ROOT).cpp', ], 'action': [ - '<(PRODUCT_DIR)/codegen_style.exe', + '<(PRODUCT_DIR)/codegen_style<(exe_ext)', '-I<(res_loc)', '-I<(src_loc)', '--skip-sprites', '-o<(SHARED_INTERMEDIATE_DIR)/styles', '<(RULE_INPUT_PATH)', ], diff --git a/Telegram/gyp/common.gypi b/Telegram/gyp/common.gypi index 750d157b70..d230c81fdb 100644 --- a/Telegram/gyp/common.gypi +++ b/Telegram/gyp/common.gypi @@ -21,31 +21,44 @@ 'variables': { 'variables': { 'variables': { - 'build_os%': '<(OS)', + 'variables': { + 'variables': { + 'build_os%': '<(OS)', + }, + 'build_os%': '<(build_os)', + 'conditions': [ + [ 'build_os == "win"', { + 'build_win': 1, + }, { + 'build_win': 0, + }], + [ 'build_os == "mac"', { + 'build_mac': 1, + }, { + 'build_mac': 0, + }], + [ 'build_os == "linux"', { + 'build_linux': 1, + }, { + 'build_linux': 0, + }], + ], + }, + 'build_os%': '<(build_os)', + 'build_win%': '<(build_win)', + 'build_mac%': '<(build_mac)', + 'build_linux%': '<(build_linux)', }, 'build_os%': '<(build_os)', - 'conditions': [ - [ 'build_os == "win"', { - 'build_win': 1, - }, { - 'build_win': 0, - }], - [ 'build_os == "mac"', { - 'build_mac': 1, - }, { - 'build_mac': 0, - }], - [ 'build_os == "linux"', { - 'build_linux': 1, - }, { - 'build_linux': 0, - }], - ], + 'build_win%': '<(build_win)', + 'build_mac%': '<(build_mac)', + 'build_linux%': '<(build_linux)', }, 'build_os%': '<(build_os)', 'build_win%': '<(build_win)', 'build_mac%': '<(build_mac)', 'build_linux%': '<(build_linux)', + 'mac_target%': '10.8', # GYP does not support per-configuration libraries :( # So they will be emulated through additional link flags, @@ -54,13 +67,16 @@ [ 'build_win', { 'ld_lib_prefix': '', 'ld_lib_postfix': '.lib', + 'exe_ext': '.exe', }, { 'ld_lib_prefix': '-l', 'ld_lib_postfix': '', + 'exe_ext': '', }], ], 'ld_lib_prefix': '<(ld_lib_prefix)', 'ld_lib_postfix': '<(ld_lib_postfix)', + 'exe_ext': '<(exe_ext)', 'library%': 'static_library', diff --git a/Telegram/gyp/common_executable.gypi b/Telegram/gyp/common_executable.gypi index 5fa96f5808..28be1d73da 100644 --- a/Telegram/gyp/common_executable.gypi +++ b/Telegram/gyp/common_executable.gypi @@ -25,5 +25,6 @@ 'includes': [ 'common.gypi', 'settings_win.gypi', + 'settings_mac.gypi', ], } diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi index 4e394e034e..d3ae26b1bd 100644 --- a/Telegram/gyp/qt.gypi +++ b/Telegram/gyp/qt.gypi @@ -21,51 +21,61 @@ 'variables': { 'variables': { 'variables': { + 'variables': { + 'qt_libs': [ + 'Qt5Core', + 'qtpcre', + 'Qt5Gui', + 'qtfreetype', + 'Qt5Widgets', + 'qtharfbuzzng', + 'Qt5Network', + 'Qt5PlatformSupport', + 'Qt5PrintSupport', + 'qwebp', + ], + }, 'qt_version%': '5.6.0', + 'conditions': [ + [ 'build_win', { + 'qt_lib_prefix': '<(ld_lib_prefix)', + 'qt_lib_debug_postfix': 'd<(ld_lib_postfix)', + 'qt_lib_release_postfix': '<(ld_lib_postfix)', + 'qt_libs': [ + '<@(qt_libs)', + 'qtmain', + 'qwindows', + ], + }], + [ 'build_mac', { + 'qt_lib_prefix': '<(ld_lib_prefix)', + 'qt_lib_debug_postfix': '_debug<(ld_lib_postfix)', + 'qt_lib_release_postfix': '<(ld_lib_postfix)', + 'qt_libs': [ + '<@(qt_libs)', + 'qgenericbearer', + 'qcocoa', + ], + }], + ], }, 'qt_version%': '<(qt_version)', - 'qt_version_loc': ' /dev/null +FullScriptPath=`pwd` +popd > /dev/null + +cd $FullScriptPath +gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode +cd ../.. + +cd $FullExecPath +exit + diff --git a/Telegram/gyp/settings_mac.gypi b/Telegram/gyp/settings_mac.gypi new file mode 100644 index 0000000000..2ea8e56933 --- /dev/null +++ b/Telegram/gyp/settings_mac.gypi @@ -0,0 +1,64 @@ +# 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 + +{ + 'conditions': [ + [ 'build_mac', { + 'variables': { + 'mac_frameworks': [ + 'Cocoa', + 'CoreFoundation', + 'CoreServices', + 'CoreText', + 'CoreGraphics', + 'OpenGL', + 'VideoToolbox', + 'VideoDecodeAcceleration', + 'AudioUnit', + 'ApplicationServices', + 'Foundation', + 'AGL', + 'Security', + 'SystemConfiguration', + 'Carbon', + 'AudioToolbox', + 'CoreAudio', + 'QuartzCore', + 'AVFoundation', + 'CoreMedia', + 'AppKit', + 'CoreWLAN', + 'IOKit', + ], + }, + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ + '-std=c++14', + '-Wno-switch', + '-stdlib=libc++', + ], + 'OTHER_LDFLAGS': [ + '-stdlib=libc++', + '