Build lib_ui with cmake.

This commit is contained in:
John Preston 2019-11-08 13:05:59 +03:00
parent b7fed0377c
commit 02a71d745d
7 changed files with 34 additions and 10 deletions

View File

@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.12)
cmake_policy(SET CMP0076 NEW)
cmake_policy(SET CMP0091 NEW)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
project(Telegram
LANGUAGES C CXX
VERSION 1.9.0

View File

@ -1,18 +1,33 @@
add_subdirectory(lib_rpl)
add_subdirectory(lib_crl)
add_subdirectory(lib_base)
add_subdirectory(lib_ui)
add_subdirectory(codegen)
# include(lib_ui/cmake/generate_styles.cmake)
# get_filename_component(src_loc "./SourceFiles" REALPATH)
# add_executable(Telegram WIN32 MACOSX_BUNDLE
# ${src_loc}/main.cpp
# )
# add_executable(Telegram WIN32 MACOSX_BUNDLE)
# init_target(Telegram)
# force_include(Telegram stdafx.h)
# set(telegram_sources
# PRIVATE
# main.cpp
# )
# nice_target_sources(Telegram ${src_loc} "${telegram_sources}")
# target_compile_definitions(Telegram
# PRIVATE
# TDESKTOP_API_ID=17349
# TDESKTOP_API_HASH=344583e45741c457fe1862106095a5eb
# )
# target_link_libraries(Telegram
# PRIVATE
# lib_base
# lib_ui
# )

@ -1 +1 @@
Subproject commit 3eee2b6581f4d89952d863b3ea39553a4db1d787
Subproject commit 2f972846ad4beb64f068dac236ab95b04aa343a9

@ -1 +1 @@
Subproject commit c68dceb1892284f49ef1bf04a719f89635d35c58
Subproject commit ab76dcd0879e684b34c3de243e44e3751b68356f

View File

@ -29,6 +29,8 @@ if (WIN32)
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]]

View File

@ -1,5 +1,6 @@
get_filename_component(libs_loc "../Libraries" REALPATH)
get_filename_component(third_party_loc "Telegram/ThirdParty" REALPATH)
get_filename_component(submodules_loc "Telegram" REALPATH)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(build_debug 1)

View File

@ -12,9 +12,13 @@ else()
endif()
endfunction()
function(init_target target_name)
function(init_target target_name) # init_target(my_target folder_name)
set(folder_name "${ARGV1}")
set_property(TARGET ${target_name} PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if (NOT "${folder_name}" STREQUAL "")
set_target_properties(${target_name} PROPERTIES FOLDER ${folder_name})
endif()
endfunction()
function(nice_target_sources target_name src_loc list)
@ -30,16 +34,16 @@ function(nice_target_sources target_name src_loc list)
set(writing_now ${file})
else()
set(full_name ${src_loc}/${file})
if (${file} MATCHES "/win/" OR ${file} MATCHES "_win\.")
if (${file} MATCHES "/win/" 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 "_mac\.")
elseif (${file} MATCHES "/mac/" OR ${file} MATCHES "_mac\\.")
list(APPEND not_win_sources ${full_name})
list(APPEND not_linux_sources ${full_name})
elseif (${file} MATCHES "/linux/" OR ${file} MATCHES "_linux\.")
elseif (${file} MATCHES "/linux/" OR ${file} MATCHES "_linux\\.")
list(APPEND not_win_sources ${full_name})
list(APPEND not_mac_sources ${full_name})
elseif (${file} MATCHES "/posix/" OR ${file} MATCHES "_posix\.")
elseif (${file} MATCHES "/posix/" OR ${file} MATCHES "_posix\\.")
list(APPEND not_win_sources ${full_name})
endif()
if ("${writing_now}" STREQUAL "PRIVATE")