[wip] add cmake files

This commit is contained in:
Berkus Decker 2017-11-20 22:10:06 +02:00
parent 60a45e6cfe
commit 90d4ad0597
4 changed files with 565 additions and 0 deletions

33
CMakeLists.txt Normal file
View File

@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.7)
project(tdesktop)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(OpenAL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
#find_package(PortAudio REQUIRED)
#find_package(Opus REQUIRED)
#find_package(FFmpeg REQUIRED)
if (NOT OPENAL_FOUND)
message(FATAL_ERROR OpenAL Soft is required)
endif()
if (NOT ZLIB_FOUND)
message(FATAL_ERROR Zlib is required)
endif()
if (NOT OPENSSL_FOUND)
message(FATAL_ERROR OpenSSL is required)
endif()
# OPENAL_LIBRARY
# ZLIB_LIBRARIES
# OPENSSL_LIBRARIES
include_directories(${OPENAL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
add_subdirectory(Telegram)
#target_link_libraries(publisher Qt5::Widgets Qt5::DBus)

326
Telegram/CMakeLists.txt Normal file
View File

@ -0,0 +1,326 @@
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
set(APP_SRC
SourceFiles/apiwrap.cpp
SourceFiles/app.cpp
SourceFiles/application.cpp
SourceFiles/autoupdater.cpp
SourceFiles/dialogswidget.cpp
SourceFiles/facades.cpp
SourceFiles/fileuploader.cpp
SourceFiles/history.cpp
SourceFiles/historywidget.cpp
SourceFiles/lang.cpp
SourceFiles/langloaderplain.cpp
SourceFiles/layerwidget.cpp
SourceFiles/layout.cpp
SourceFiles/localimageloader.cpp
SourceFiles/localstorage.cpp
SourceFiles/logs.cpp
SourceFiles/main.cpp
SourceFiles/mainwidget.cpp
SourceFiles/mainwindow.cpp
SourceFiles/mediaview.cpp
SourceFiles/observer_peer.cpp
SourceFiles/overviewwidget.cpp
SourceFiles/passcodewidget.cpp
SourceFiles/settings.cpp
SourceFiles/shortcuts.cpp
SourceFiles/stdafx.cpp
SourceFiles/structs.cpp
SourceFiles/boxes/aboutbox.cpp
SourceFiles/boxes/abstractbox.cpp
SourceFiles/boxes/addcontactbox.cpp
SourceFiles/boxes/autolockbox.cpp
SourceFiles/boxes/backgroundbox.cpp
SourceFiles/boxes/confirmbox.cpp
SourceFiles/boxes/confirmphonebox.cpp
SourceFiles/boxes/connectionbox.cpp
SourceFiles/boxes/contactsbox.cpp
SourceFiles/boxes/downloadpathbox.cpp
SourceFiles/boxes/emojibox.cpp
SourceFiles/boxes/languagebox.cpp
SourceFiles/boxes/localstoragebox.cpp
SourceFiles/boxes/members_box.cpp
SourceFiles/boxes/notifications_box.cpp
SourceFiles/boxes/passcodebox.cpp
SourceFiles/boxes/photocropbox.cpp
SourceFiles/boxes/report_box.cpp
SourceFiles/boxes/send_files_box.cpp
SourceFiles/boxes/sessionsbox.cpp
SourceFiles/boxes/sharebox.cpp
SourceFiles/boxes/stickers_box.cpp
SourceFiles/boxes/stickersetbox.cpp
SourceFiles/boxes/usernamebox.cpp
SourceFiles/core/click_handler.cpp
SourceFiles/core/click_handler_types.cpp
SourceFiles/core/observer.cpp
SourceFiles/core/parse_helper.cpp
SourceFiles/core/qthelp_url.cpp
SourceFiles/core/runtime_composer.cpp
SourceFiles/core/single_timer.cpp
SourceFiles/core/task_queue.cpp
SourceFiles/core/utils.cpp
SourceFiles/data/data_abstract_structure.cpp
SourceFiles/data/data_drafts.cpp
SourceFiles/dialogs/dialogs_indexed_list.cpp
SourceFiles/dialogs/dialogs_layout.cpp
SourceFiles/dialogs/dialogs_list.cpp
SourceFiles/dialogs/dialogs_row.cpp
SourceFiles/history/field_autocomplete.cpp
SourceFiles/history/history_drag_area.cpp
SourceFiles/history/history_item.cpp
SourceFiles/history/history_location_manager.cpp
SourceFiles/history/history_media_types.cpp
SourceFiles/history/history_message.cpp
SourceFiles/history/history_service_layout.cpp
SourceFiles/inline_bots/inline_bot_layout_internal.cpp
SourceFiles/inline_bots/inline_bot_layout_item.cpp
SourceFiles/inline_bots/inline_bot_result.cpp
SourceFiles/inline_bots/inline_bot_send_data.cpp
SourceFiles/intro/introcode.cpp
SourceFiles/intro/introphone.cpp
SourceFiles/intro/intropwdcheck.cpp
SourceFiles/intro/introsignup.cpp
SourceFiles/intro/introstart.cpp
SourceFiles/intro/introwidget.cpp
SourceFiles/media/media_audio.cpp
SourceFiles/media/media_audio_ffmpeg_loader.cpp
SourceFiles/media/media_audio_loader.cpp
SourceFiles/media/media_audio_loaders.cpp
SourceFiles/media/media_child_ffmpeg_loader.cpp
SourceFiles/media/media_clip_ffmpeg.cpp
SourceFiles/media/media_clip_implementation.cpp
SourceFiles/media/media_clip_qtgif.cpp
SourceFiles/media/media_clip_reader.cpp
SourceFiles/media/player/media_player_button.cpp
SourceFiles/media/player/media_player_cover.cpp
SourceFiles/media/player/media_player_instance.cpp
SourceFiles/media/player/media_player_list.cpp
SourceFiles/media/player/media_player_panel.cpp
SourceFiles/media/player/media_player_volume_controller.cpp
SourceFiles/media/player/media_player_widget.cpp
SourceFiles/media/view/media_clip_controller.cpp
SourceFiles/media/view/media_clip_playback.cpp
SourceFiles/media/view/media_clip_volume_controller.cpp
SourceFiles/mtproto/auth_key.cpp
SourceFiles/mtproto/connection.cpp
SourceFiles/mtproto/connection_abstract.cpp
SourceFiles/mtproto/connection_auto.cpp
SourceFiles/mtproto/connection_http.cpp
SourceFiles/mtproto/connection_tcp.cpp
SourceFiles/mtproto/core_types.cpp
SourceFiles/mtproto/dcenter.cpp
SourceFiles/mtproto/facade.cpp
SourceFiles/mtproto/file_download.cpp
SourceFiles/mtproto/rpc_sender.cpp
SourceFiles/mtproto/rsa_public_key.cpp
SourceFiles/mtproto/scheme_auto.cpp
SourceFiles/mtproto/session.cpp
SourceFiles/overview/overview_layout.cpp
SourceFiles/profile/profile_back_button.cpp
SourceFiles/profile/profile_block_actions.cpp
SourceFiles/profile/profile_block_channel_members.cpp
SourceFiles/profile/profile_block_group_members.cpp
SourceFiles/profile/profile_block_info.cpp
SourceFiles/profile/profile_block_invite_link.cpp
SourceFiles/profile/profile_block_peer_list.cpp
SourceFiles/profile/profile_block_settings.cpp
SourceFiles/profile/profile_block_shared_media.cpp
SourceFiles/profile/profile_block_widget.cpp
SourceFiles/profile/profile_common_groups_section.cpp
SourceFiles/profile/profile_cover.cpp
SourceFiles/profile/profile_cover_drop_area.cpp
SourceFiles/profile/profile_fixed_bar.cpp
SourceFiles/profile/profile_inner_widget.cpp
SourceFiles/profile/profile_section_memento.cpp
SourceFiles/profile/profile_userpic_button.cpp
SourceFiles/profile/profile_widget.cpp
SourceFiles/serialize/serialize_common.cpp
SourceFiles/serialize/serialize_document.cpp
SourceFiles/settings/settings_advanced_widget.cpp
SourceFiles/settings/settings_background_widget.cpp
SourceFiles/settings/settings_block_widget.cpp
SourceFiles/settings/settings_chat_settings_widget.cpp
SourceFiles/settings/settings_cover.cpp
SourceFiles/settings/settings_fixed_bar.cpp
SourceFiles/settings/settings_general_widget.cpp
SourceFiles/settings/settings_info_widget.cpp
SourceFiles/settings/settings_inner_widget.cpp
SourceFiles/settings/settings_notifications_widget.cpp
SourceFiles/settings/settings_privacy_widget.cpp
SourceFiles/settings/settings_scale_widget.cpp
SourceFiles/settings/settings_widget.cpp
SourceFiles/stickers/emoji_pan.cpp
SourceFiles/stickers/stickers.cpp
SourceFiles/ui/abstract_button.cpp
SourceFiles/ui/animation.cpp
SourceFiles/ui/countryinput.cpp
SourceFiles/ui/emoji_config.cpp
SourceFiles/ui/filedialog.cpp
SourceFiles/ui/images.cpp
SourceFiles/ui/twidget.cpp
SourceFiles/ui/buttons/history_down_button.cpp
SourceFiles/ui/buttons/peer_avatar_button.cpp
SourceFiles/ui/effects/cross_animation.cpp
SourceFiles/ui/effects/panel_animation.cpp
SourceFiles/ui/effects/radial_animation.cpp
SourceFiles/ui/effects/ripple_animation.cpp
SourceFiles/ui/effects/round_checkbox.cpp
SourceFiles/ui/effects/send_action_animations.cpp
SourceFiles/ui/effects/slide_animation.cpp
SourceFiles/ui/effects/widget_fade_wrap.cpp
SourceFiles/ui/effects/widget_slide_wrap.cpp
SourceFiles/ui/style/style_core.cpp
SourceFiles/ui/style/style_core_color.cpp
SourceFiles/ui/style/style_core_font.cpp
SourceFiles/ui/style/style_core_icon.cpp
SourceFiles/ui/style/style_core_types.cpp
SourceFiles/ui/text/text.cpp
SourceFiles/ui/text/text_block.cpp
SourceFiles/ui/text/text_entity.cpp
SourceFiles/ui/toast/toast.cpp
SourceFiles/ui/toast/toast_manager.cpp
SourceFiles/ui/toast/toast_widget.cpp
SourceFiles/ui/widgets/buttons.cpp
SourceFiles/ui/widgets/checkbox.cpp
SourceFiles/ui/widgets/continuous_sliders.cpp
SourceFiles/ui/widgets/discrete_sliders.cpp
SourceFiles/ui/widgets/dropdown_menu.cpp
SourceFiles/ui/widgets/inner_dropdown.cpp
SourceFiles/ui/widgets/input_fields.cpp
SourceFiles/ui/widgets/labels.cpp
SourceFiles/ui/widgets/menu.cpp
SourceFiles/ui/widgets/multi_select.cpp
SourceFiles/ui/widgets/popup_menu.cpp
SourceFiles/ui/widgets/scroll_area.cpp
SourceFiles/ui/widgets/shadow.cpp
SourceFiles/ui/widgets/tooltip.cpp
SourceFiles/window/main_window.cpp
SourceFiles/window/notifications_manager.cpp
SourceFiles/window/notifications_manager_default.cpp
SourceFiles/window/notifications_utilities.cpp
SourceFiles/window/player_wrap_widget.cpp
SourceFiles/window/section_widget.cpp
SourceFiles/window/top_bar_widget.cpp
SourceFiles/window/window_main_menu.cpp
SourceFiles/window/window_slide_animation.cpp
SourceFiles/window/window_theme.cpp
SourceFiles/window/window_theme_preview.cpp
SourceFiles/window/window_theme_warning.cpp
)
set (PLAT_SRC )
if (APPLE)
set(PLAT_SRC ${PLAT_SRC}
SourceFiles/pspecific_mac.cpp
SourceFiles/pspecific_mac_p.mm
SourceFiles/platform/mac/file_dialog_mac.mm
SourceFiles/platform/mac/mac_utilities.mm
SourceFiles/platform/mac/main_window_mac.mm
SourceFiles/platform/mac/notifications_manager_mac.mm
SourceFiles/platform/mac/window_title_mac.mm
)
endif()
if (WIN32)
set(PLAT_SRC ${PLAT_SRC}
SourceFiles/pspecific_win.cpp
SourceFiles/platform/win/main_window_win.cpp
SourceFiles/platform/win/notifications_manager_win.cpp
SourceFiles/platform/win/window_title_win.cpp
SourceFiles/platform/win/windows_app_user_model_id.cpp
SourceFiles/platform/win/windows_dlls.cpp
SourceFiles/platform/win/windows_event_filter.cpp
)
endif()
if (WINRT)
set(PLAT_SRC ${PLAT_SRC}
SourceFiles/pspecific_winrt.cpp
SourceFiles/platform/winrt/main_window_winrt.cpp
)
endif()
if (LINUX)
set(PLAT_SRC ${PLAT_SRC}
SourceFiles/pspecific_linux.cpp
SourceFiles/platform/linux/file_dialog_linux.cpp
SourceFiles/platform/linux/linux_gdk_helper.cpp
SourceFiles/platform/linux/linux_libnotify.cpp
SourceFiles/platform/linux/linux_libs.cpp
SourceFiles/platform/linux/main_window_linux.cpp
SourceFiles/platform/linux/notifications_manager_linux.cpp
)
endif()
##======================
## Telegram
##======================
add_executable(Telegram ${APP_SRC} ${PLAT_SRC})
target_link_libraries(Telegram Qt5::Core Qt5::Widgets)
##======================
if (APPLE)
set(UPD_SRC SourceFiles/_other/updater_osx.m)
endif()
if (WIN32)
set(UPD_SRC SourceFiles/_other/updater.cpp)
endif()
if (LINUX)
set(UPD_SRC SourceFiles/_other/updater_linux.cpp)
endif()
##======================
## Updater
##======================
#add_executable(Updater ${UPD_SRC})
## codegen/common/basic_tokenized_file.cpp
## codegen/common/checked_utf8_string.cpp
## codegen/common/clean_file.cpp
## codegen/common/cpp_file.cpp
## codegen/common/logging.cpp
##
## codegen/numbers/generator.cpp
## codegen/numbers/main.cpp
## codegen/numbers/options.cpp
## codegen/numbers/parsed_file.cpp
## codegen/numbers/processor.cpp
##
## codegen/style/generator.cpp
## codegen/style/main.cpp
## codegen/style/module.cpp
## codegen/style/options.cpp
## codegen/style/parsed_file.cpp
## codegen/style/processor.cpp
## codegen/style/structure_types.cpp

5
conanfile.txt Normal file
View File

@ -0,0 +1,5 @@
[requires]
openal-soft/1.17.2@hilborn/stable
[generators]
cmake

201
doc/building-cmake.md Normal file
View File

@ -0,0 +1,201 @@
`cmake -G Ninja .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5`
##Build instructions for GYP/CMake under Ubuntu 12.04
###Prepare
* Install git by command **sudo apt-get install git** in Terminal
* Install g++ by command **sudo apt-get install g++** in Terminal
You need to install g++ version 4.9 manually by such commands
* sudo add-apt-repository ppa:ubuntu-toolchain-r/test
* sudo apt-get update
* sudo apt-get install gcc-4.9 g++-4.9
* sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 21
* sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 21
###Prepare folder
Choose a folder for the future build, for example **/home/user/TBuild** There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app.
###Clone source code
By git in Terminal go to **/home/user/TBuild** and run
git clone https://github.com/telegramdesktop/tdesktop.git
###Prepare libraries
Install dev libraries
sudo apt-get install libexif-dev liblzma-dev libz-dev libssl-dev libappindicator-dev libunity-dev libicu-dev
####zlib 1.2.8
http://www.zlib.net/ > Download [**zlib source code, version 1.2.8, zipfile format**](http://zlib.net/zlib128.zip)
Extract to **/home/user/TBuild/Libraries**
#####Building library
In Terminal go to **/home/user/TBuild/Libraries/zlib-1.2.8** and run:
./configure
make
sudo make install
Install audio libraries
####Opus codec 1.1
Download [opus-1.1 sources](http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz) from http://www.opus-codec.org/downloads, extract to **/home/user/TBuild/Libraries**, go to **/home/user/TBuild/Libraries/opus-1.1** and run
./configure
make
sudo make install
####FFmpeg
In Terminal go to **/home/user/TBuild/Libraries** and run
git clone git://anongit.freedesktop.org/git/libva
cd libva
./autogen.sh --enable-static
make
sudo make install
cd ..
git clone git://anongit.freedesktop.org/vdpau/libvdpau
cd libvdpau
./autogen.sh --enable-static
make
sudo make install
cd ..
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
git checkout release/3.2
sudo apt-get update
sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texi2html zlib1g-dev
sudo apt-get install yasm
./configure --prefix=/usr/local --disable-programs --disable-doc --disable-everything --enable-protocol=file --enable-libopus --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=aasc --enable-decoder=flac --enable-decoder=gif --enable-decoder=h264 --enable-decoder=h264_vdpau --enable-decoder=mp1 --enable-decoder=mp1float --enable-decoder=mp2 --enable-decoder=mp2float --enable-decoder=mp3 --enable-decoder=mp3adu --enable-decoder=mp3adufloat --enable-decoder=mp3float --enable-decoder=mp3on4 --enable-decoder=mp3on4float --enable-decoder=mpeg4 --enable-decoder=mpeg4_vdpau --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=opus --enable-decoder=vorbis --enable-decoder=wavpack --enable-decoder=wmalossless --enable-decoder=wmapro --enable-decoder=wmav1 --enable-decoder=wmav2 --enable-decoder=wmavoice --enable-encoder=libopus --enable-hwaccel=h264_vaapi --enable-hwaccel=h264_vdpau --enable-hwaccel=mpeg4_vaapi --enable-hwaccel=mpeg4_vdpau --enable-parser=aac --enable-parser=aac_latm --enable-parser=flac --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=opus --enable-parser=vorbis --enable-demuxer=aac --enable-demuxer=flac --enable-demuxer=gif --enable-demuxer=h264 --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=ogg --enable-demuxer=wav --enable-muxer=ogg --enable-muxer=opus
make
sudo make install
####PortAudio 19
[Download portaudio sources](http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz) from **http://www.portaudio.com/download.html**, extract to **/home/user/TBuild/Libraries**, go to **/home/user/TBuild/Libraries/portaudio** and run
./configure
make
sudo make install
####OpenAL Soft
In Terminal go to **/home/user/TBuild/Libraries** and run
git clone git://repo.or.cz/openal-soft.git
then go to **/home/user/TBuild/Libraries/openal-soft/build** and run
sudo apt-get install cmake
cmake -D LIBTYPE:STRING=STATIC ..
make
sudo make install
####OpenSSL
In Terminal go to **/home/user/TBuild/Libraries** and run
git clone https://github.com/openssl/openssl
cd openssl
git checkout OpenSSL_1_0_1-stable
./config
make
sudo make install
####libxkbcommon (required for Fcitx Qt plugin)
In Terminal go to **/home/user/TBuild/Libraries** and run
sudo apt-get install xutils-dev bison python-xcbgen
git clone https://github.com/xkbcommon/libxkbcommon.git
cd libxkbcommon
./autogen.sh --disable-x11
make
sudo make install
####Qt 5.6.2, slightly patched
In Terminal go to **/home/user/TBuild/Libraries** and run
git clone git://code.qt.io/qt/qt5.git qt5_6_2
cd qt5_6_2
git checkout 5.6
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.6.2
cd qtimageformats && git checkout v5.6.2 && cd ..
cd qtbase && git checkout v5.6.2 && cd ..
#####Apply the patch
cd qtbase && git apply ../../../tdesktop/Telegram/Patches/qtbase_5_6_2.diff && cd ..
#####Building library
Install some packages for Qt (see **/home/user/TBuild/Libraries/qt5_6_2/qtbase/src/plugins/platforms/xcb/README**)
sudo apt-get install libxcb1-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-icccm4-dev libxcb-render-util0-dev libxcb-util0-dev libxrender-dev libasound-dev libpulse-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-randr0-dev libx11-xcb-dev libffi-dev
In Terminal go to **/home/user/TBuild/Libraries/qt5_6_2** and there run
./configure -prefix "/usr/local/tdesktop/Qt-5.6.2" -release -force-debug-info -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -no-gtkstyle -static -openssl-linked -nomake examples -nomake tests
make -j4
sudo make install
building (**make** command) will take really long time.
####Google Breakpad
In Terminal go to **/home/user/TBuild/Libraries** and run
git clone https://chromium.googlesource.com/breakpad/breakpad
git clone https://chromium.googlesource.com/linux-syscall-support breakpad/src/third_party/lss
cd breakpad
./configure --prefix=$PWD
make
make install
####GYP and CMake
In Terminal go to **/home/user/TBuild/Libraries** and run
git clone https://chromium.googlesource.com/external/gyp
wget https://cmake.org/files/v3.6/cmake-3.6.2.tar.gz
tar -xf cmake-3.6.2.tar.gz
cd gyp
git apply ../../tdesktop/Telegram/Patches/gyp.diff
cd ../cmake-3.6.2
./configure
make
###Building Telegram Desktop
In Terminal go to **/home/user/TBuild/tdesktop/Telegram** and run
gyp/refresh.sh
To make Debug version go to **/home/user/TBuild/tdesktop/out/Debug** and run
make
To make Release version go to **/home/user/TBuild/tdesktop/out/Release** and run
make
You can debug your builds from Qt Creator, just open **CMakeLists.txt** from **/home/user/TBuild/tdesktop/out/Debug** and start debug.