mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-20 06:21:00 +00:00
Use precompiled header from cmake 3.16.
This commit is contained in:
parent
61723bd794
commit
e5bd187d4d
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
cmake_policy(SET CMP0076 NEW)
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
|
||||
@ -12,7 +12,7 @@ project(Telegram
|
||||
)
|
||||
|
||||
include(cmake/paths.cmake)
|
||||
include(cmake/force_include.cmake)
|
||||
include(cmake/options.cmake)
|
||||
include(cmake/init_target.cmake)
|
||||
include(cmake/generate_target.cmake)
|
||||
include(cmake/nice_target_sources.cmake)
|
||||
|
@ -1,6 +1,9 @@
|
||||
add_executable(Telegram WIN32 MACOSX_BUNDLE)
|
||||
init_target(Telegram)
|
||||
|
||||
add_executable(Updater WIN32)
|
||||
init_target(Updater)
|
||||
|
||||
add_subdirectory(lib_rpl)
|
||||
add_subdirectory(lib_crl)
|
||||
add_subdirectory(lib_base)
|
||||
@ -939,7 +942,7 @@ PRIVATE
|
||||
)
|
||||
nice_target_sources(Telegram ${res_loc} "${telegram_resources}")
|
||||
|
||||
force_include(Telegram stdafx.h)
|
||||
target_precompile_headers(Telegram PRIVATE ${src_loc}/stdafx.h)
|
||||
|
||||
if (WIN32)
|
||||
# message(${CMAKE_GENERATOR})
|
||||
@ -980,3 +983,14 @@ PRIVATE
|
||||
AL_LIBTYPE_STATIC
|
||||
AL_ALEXT_PROTOTYPES
|
||||
)
|
||||
|
||||
add_dependencies(Telegram Updater)
|
||||
|
||||
set(updater_sources
|
||||
PRIVATE
|
||||
_other/updater.cpp
|
||||
_other/updater.h
|
||||
_other/updater_linux.cpp
|
||||
_other/updater_osx.m
|
||||
)
|
||||
nice_target_sources(Updater ${src_loc} "${updater_sources}")
|
||||
|
@ -27,7 +27,7 @@ PRIVATE
|
||||
)
|
||||
nice_target_sources(lib_export ${src_loc} "${lib_export_sources}")
|
||||
|
||||
force_include(lib_export export/export_pch.h)
|
||||
target_precompile_headers(lib_export PRIVATE ${src_loc}/export/export_pch.h)
|
||||
|
||||
target_include_directories(lib_export
|
||||
PUBLIC
|
||||
|
@ -12,7 +12,7 @@ PRIVATE
|
||||
)
|
||||
nice_target_sources(lib_mtproto ${src_loc} "${lib_mtproto_sources}")
|
||||
|
||||
force_include(lib_mtproto mtproto/mtp_pch.h)
|
||||
target_precompile_headers(lib_mtproto PRIVATE ${src_loc}/mtproto/mtp_pch.h)
|
||||
|
||||
target_include_directories(lib_mtproto
|
||||
PUBLIC
|
||||
|
@ -1,5 +1,5 @@
|
||||
add_library(lib_tgvoip OBJECT)
|
||||
init_target_no_ranges(lib_tgvoip)
|
||||
init_target(lib_tgvoip)
|
||||
|
||||
set(tgvoip_loc ${third_party_loc}/libtgvoip)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8e8d1de1a1ad5fbc9db0ec797880b5c754be8be7
|
||||
Subproject commit dc530a1cecddf8291b7b67e71e455cef6b963e06
|
@ -1 +1 @@
|
||||
Subproject commit eae95787375e0dd399641abb5e94e40f5ef154e7
|
||||
Subproject commit c156e8eaf7600545024625ce182995e9305ef6ff
|
@ -1 +1 @@
|
||||
Subproject commit 5ea1a6d4469ff6292f4a563958830d3104b42aef
|
||||
Subproject commit 48bfce822d5a3262e9b0643517a2a996125e1026
|
@ -1 +1 @@
|
||||
Subproject commit 01f028516bcb2041b6ad2aaba1bcd4d62bc32e90
|
||||
Subproject commit e4ac966708205159a696435021a7c1a6ccd71dae
|
@ -1 +1 @@
|
||||
Subproject commit 3f375807eacd3411dfe8644df7b0dc494536d3de
|
||||
Subproject commit ffdc9cc7b64e3d9502ae416cc362f3f2d327b8a8
|
@ -1 +1 @@
|
||||
Subproject commit 110a17089a2b18e93edf77a0adf596df92e9def0
|
||||
Subproject commit b7af3b71a3f7ee93cb2ea70cdeb16a8a3ff06bce
|
@ -1,95 +1 @@
|
||||
add_subdirectory(external)
|
||||
|
||||
add_library(with_ranges INTERFACE)
|
||||
|
||||
if (WIN32)
|
||||
target_compile_options(with_ranges
|
||||
INTERFACE
|
||||
/experimental:preprocessor # need for range-v3 see https://github.com/ericniebler/range-v3#supported-compilers
|
||||
/wd5105 # needed for `/experimental:preprocessor`, suppressing C5105 "macro expansion producing 'defined' has undefined behavior"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(common_no_ranges INTERFACE)
|
||||
|
||||
target_compile_features(common_no_ranges
|
||||
INTERFACE
|
||||
cxx_std_17
|
||||
)
|
||||
|
||||
target_compile_definitions(common_no_ranges
|
||||
INTERFACE
|
||||
UNICODE
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
target_compile_definitions(common_no_ranges
|
||||
INTERFACE
|
||||
WIN32
|
||||
_WINDOWS
|
||||
_UNICODE
|
||||
UNICODE
|
||||
_SCL_SECURE_NO_WARNINGS
|
||||
_USING_V110_SDK71_
|
||||
NOMINMAX
|
||||
)
|
||||
target_compile_options(common_no_ranges
|
||||
INTERFACE
|
||||
/permissive-
|
||||
# /Qspectre
|
||||
/W1
|
||||
/WX
|
||||
/MP # Enable multi process build.
|
||||
/EHsc # Catch C++ exceptions only, extern C functions never throw a C++ exception.
|
||||
/w14834 # [[nodiscard]]
|
||||
/w15038 # wrong initialization order
|
||||
/w14265 # class has virtual functions, but destructor is not virtual
|
||||
/wd4068 # Disable "warning C4068: unknown pragma"
|
||||
/wd5105 # needed for `/experimental:preprocessor`, suppressing C5105 "macro expansion producing 'defined' has undefined behavior"
|
||||
/Zc:wchar_t- # don't tread wchar_t as builtin type
|
||||
)
|
||||
target_link_options(common_no_ranges
|
||||
INTERFACE
|
||||
/NODEFAULTLIB:LIBCMT
|
||||
)
|
||||
target_link_libraries(common_no_ranges
|
||||
INTERFACE
|
||||
winmm
|
||||
imm32
|
||||
ws2_32
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
winspool
|
||||
comdlg32
|
||||
advapi32
|
||||
shell32
|
||||
ole32
|
||||
oleaut32
|
||||
uuid
|
||||
odbc32
|
||||
odbccp32
|
||||
Shlwapi
|
||||
Iphlpapi
|
||||
Gdiplus
|
||||
Strmiids
|
||||
Netapi32
|
||||
Userenv
|
||||
Version
|
||||
Dwmapi
|
||||
Wtsapi32
|
||||
UxTheme
|
||||
DbgHelp
|
||||
Rstrtmgr
|
||||
Crypt32
|
||||
)
|
||||
else()
|
||||
endif()
|
||||
|
||||
add_library(common INTERFACE)
|
||||
|
||||
target_link_libraries(common
|
||||
INTERFACE
|
||||
common_no_ranges
|
||||
with_ranges
|
||||
)
|
8
cmake/external/ranges/CMakeLists.txt
vendored
8
cmake/external/ranges/CMakeLists.txt
vendored
@ -4,3 +4,11 @@ target_include_directories(external_ranges SYSTEM
|
||||
INTERFACE
|
||||
${libs_loc}/range-v3/include
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
target_compile_options(external_ranges
|
||||
INTERFACE
|
||||
/experimental:preprocessor # need for range-v3 see https://github.com/ericniebler/range-v3#supported-compilers
|
||||
/wd5105 # needed for `/experimental:preprocessor`, suppressing C5105 "macro expansion producing 'defined' has undefined behavior"
|
||||
)
|
||||
endif()
|
@ -4,22 +4,12 @@ function(init_target_folder target_name folder_name)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(init_target_no_ranges target_name) # init_target(my_target folder_name)
|
||||
init_target_folder(${target_name} "${ARGV1}")
|
||||
set_property(TARGET ${target_name} PROPERTY
|
||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
if (WIN32)
|
||||
target_compile_options(${target_name}
|
||||
INTERFACE
|
||||
/W1
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(${target_name} PUBLIC common_no_ranges)
|
||||
endfunction()
|
||||
|
||||
function(init_target target_name) # init_target(my_target folder_name)
|
||||
init_target_folder(${target_name} "${ARGV1}")
|
||||
init_target_no_ranges(${target_name})
|
||||
target_link_libraries(${target_name} PUBLIC common)
|
||||
if (WIN32)
|
||||
set_property(TARGET ${target_name} PROPERTY
|
||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
target_link_libraries(${target_name} PUBLIC common_options)
|
||||
endfunction()
|
||||
|
||||
|
@ -14,7 +14,7 @@ function(nice_target_sources target_name src_loc list)
|
||||
if (${file} MATCHES "(^|/)win/" OR ${file} MATCHES "(^|/)winrc/" OR ${file} MATCHES "(^|/)windows/" OR ${file} MATCHES "[_\\/]win\\.")
|
||||
list(APPEND not_mac_sources ${full_name})
|
||||
list(APPEND not_linux_sources ${full_name})
|
||||
elseif (${file} MATCHES "(^|/)mac/" OR ${file} MATCHES "(^|/)darwin/" OR ${file} MATCHES "[_\\/]mac\\.")
|
||||
elseif (${file} MATCHES "(^|/)mac/" OR ${file} MATCHES "(^|/)darwin/" OR ${file} MATCHES "(^|/)osx/" OR ${file} MATCHES "[_\\/]mac\\." OR ${file} MATCHES "[_\\/]darwin\\." OR ${file} MATCHES "[_\\/]osx\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
list(APPEND not_linux_sources ${full_name})
|
||||
elseif (${file} MATCHES "(^|/)linux/" OR ${file} MATCHES "[_\\/]linux\\.")
|
||||
|
16
cmake/options.cmake
Normal file
16
cmake/options.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
add_library(common_options INTERFACE)
|
||||
|
||||
target_compile_features(common_options
|
||||
INTERFACE
|
||||
cxx_std_17
|
||||
)
|
||||
|
||||
target_compile_definitions(common_options
|
||||
INTERFACE
|
||||
UNICODE
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
include(cmake/options_win.cmake)
|
||||
else()
|
||||
endif()
|
61
cmake/options_win.cmake
Normal file
61
cmake/options_win.cmake
Normal file
@ -0,0 +1,61 @@
|
||||
target_compile_definitions(common_options
|
||||
INTERFACE
|
||||
WIN32
|
||||
_WINDOWS
|
||||
_UNICODE
|
||||
UNICODE
|
||||
_SCL_SECURE_NO_WARNINGS
|
||||
_USING_V110_SDK71_
|
||||
NOMINMAX
|
||||
)
|
||||
target_compile_options(common_options
|
||||
INTERFACE
|
||||
/permissive-
|
||||
# /Qspectre
|
||||
/W1
|
||||
/WX
|
||||
/MP # Enable multi process build.
|
||||
/EHsc # Catch C++ exceptions only, extern C functions never throw a C++ exception.
|
||||
/w14834 # [[nodiscard]]
|
||||
/w15038 # wrong initialization order
|
||||
/w14265 # class has virtual functions, but destructor is not virtual
|
||||
/wd4068 # Disable "warning C4068: unknown pragma"
|
||||
/Zc:wchar_t- # don't tread wchar_t as builtin type
|
||||
)
|
||||
|
||||
target_link_options(common_options
|
||||
INTERFACE
|
||||
/NODEFAULTLIB:LIBCMT
|
||||
)
|
||||
|
||||
target_link_libraries(common_options
|
||||
INTERFACE
|
||||
winmm
|
||||
imm32
|
||||
ws2_32
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
winspool
|
||||
comdlg32
|
||||
advapi32
|
||||
shell32
|
||||
ole32
|
||||
oleaut32
|
||||
uuid
|
||||
odbc32
|
||||
odbccp32
|
||||
Shlwapi
|
||||
Iphlpapi
|
||||
Gdiplus
|
||||
Strmiids
|
||||
Netapi32
|
||||
Userenv
|
||||
Version
|
||||
Dwmapi
|
||||
Wtsapi32
|
||||
UxTheme
|
||||
DbgHelp
|
||||
Rstrtmgr
|
||||
Crypt32
|
||||
)
|
Loading…
Reference in New Issue
Block a user