Introduce DESKTOP_APP_USE_PACKAGED.
This commit is contained in:
parent
3182d2d4a7
commit
632ed315b2
7 changed files with 90 additions and 23 deletions
|
|
@ -5,4 +5,6 @@
|
||||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
add_subdirectory(external)
|
add_subdirectory(external)
|
||||||
add_subdirectory(linux_glibc_wraps)
|
if (DESKTOP_APP_USE_GLIBC_WRAPS)
|
||||||
|
add_subdirectory(linux_glibc_wraps)
|
||||||
|
endif()
|
||||||
|
|
|
||||||
5
external/auto_updates/xz/CMakeLists.txt
vendored
5
external/auto_updates/xz/CMakeLists.txt
vendored
|
|
@ -7,7 +7,10 @@
|
||||||
add_library(external_xz INTERFACE IMPORTED GLOBAL)
|
add_library(external_xz INTERFACE IMPORTED GLOBAL)
|
||||||
add_library(desktop-app::external_xz ALIAS external_xz)
|
add_library(desktop-app::external_xz ALIAS external_xz)
|
||||||
|
|
||||||
if (APPLE AND NOT build_osx)
|
if (DESKTOP_APP_USE_PACKAGED)
|
||||||
|
find_package(LibLZMA REQUIRED)
|
||||||
|
target_link_libraries(external_xz LibLZMA::LibLZMA)
|
||||||
|
elseif (APPLE AND NOT build_osx)
|
||||||
target_link_libraries(external_xz
|
target_link_libraries(external_xz
|
||||||
INTERFACE
|
INTERFACE
|
||||||
/usr/local/macos/lib/liblzma.a
|
/usr/local/macos/lib/liblzma.a
|
||||||
|
|
|
||||||
9
external/openssl/CMakeLists.txt
vendored
9
external/openssl/CMakeLists.txt
vendored
|
|
@ -47,9 +47,8 @@ INTERFACE
|
||||||
)
|
)
|
||||||
|
|
||||||
if (LINUX)
|
if (LINUX)
|
||||||
target_link_libraries(external_openssl
|
if (DESKTOP_APP_USE_GLIBC_WRAPS)
|
||||||
INTERFACE
|
target_link_libraries(external_openssl INTERFACE desktop-app::linux_glibc_wraps)
|
||||||
desktop-app::linux_glibc_wraps
|
endif()
|
||||||
pthread
|
target_link_libraries(external_openssl INTERFACE pthread)
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
4
external/qt/CMakeLists.txt
vendored
4
external/qt/CMakeLists.txt
vendored
|
|
@ -191,9 +191,11 @@ if (LINUX)
|
||||||
icuuc
|
icuuc
|
||||||
icudata
|
icudata
|
||||||
)
|
)
|
||||||
|
if (DESKTOP_APP_USE_GLIBC_WRAPS)
|
||||||
|
target_link_libraries(external_qt INTERFACE desktop-app::linux_glibc_wraps)
|
||||||
|
endif()
|
||||||
target_link_libraries(external_qt
|
target_link_libraries(external_qt
|
||||||
INTERFACE
|
INTERFACE
|
||||||
desktop-app::linux_glibc_wraps
|
|
||||||
xcb
|
xcb
|
||||||
X11
|
X11
|
||||||
X11-xcb
|
X11-xcb
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,19 @@
|
||||||
# For license and copyright information please follow this link:
|
# For license and copyright information please follow this link:
|
||||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
if (LINUX)
|
add_library(linux_glibc_wraps STATIC)
|
||||||
add_library(linux_glibc_wraps STATIC)
|
add_library(desktop-app::linux_glibc_wraps ALIAS linux_glibc_wraps)
|
||||||
add_library(desktop-app::linux_glibc_wraps ALIAS linux_glibc_wraps)
|
|
||||||
|
|
||||||
get_filename_component(src_loc . REALPATH)
|
get_filename_component(src_loc . REALPATH)
|
||||||
|
|
||||||
nice_target_sources(linux_glibc_wraps ${src_loc}
|
nice_target_sources(linux_glibc_wraps ${src_loc}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
platform/linux/linux_glibc_wraps.c
|
platform/linux/linux_glibc_wraps.c
|
||||||
platform/linux/linux_glibc_wraps_32.c
|
platform/linux/linux_glibc_wraps_32.c
|
||||||
platform/linux/linux_glibc_wraps_64.c
|
platform/linux/linux_glibc_wraps_64.c
|
||||||
)
|
)
|
||||||
if (NOT build_linux32)
|
if (NOT build_linux32)
|
||||||
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_32.c PROPERTIES HEADER_FILE_ONLY TRUE)
|
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_32.c PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||||
else()
|
else()
|
||||||
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_64.c PROPERTIES HEADER_FILE_ONLY TRUE)
|
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_64.c PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
54
run_cmake.py
Normal file
54
run_cmake.py
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
'''
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
'''
|
||||||
|
import sys, os, shutil, subprocess
|
||||||
|
|
||||||
|
def run(project, arguments):
|
||||||
|
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
basePath = scriptPath + '/../out'
|
||||||
|
|
||||||
|
cmake = ['cmake']
|
||||||
|
for arg in arguments:
|
||||||
|
if arg == 'debug':
|
||||||
|
cmake.append('-DCMAKE_BUILD_TYPE=Debug')
|
||||||
|
elif arg != 'fresh':
|
||||||
|
cmake.append(arg)
|
||||||
|
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
cmake.append('-AWin32')
|
||||||
|
elif sys.platform != 'darwin':
|
||||||
|
if not '-DCMAKE_BUILD_TYPE=Debug' in cmake:
|
||||||
|
cmake.append('-DCMAKE_BUILD_TYPE=Release')
|
||||||
|
|
||||||
|
specialTarget = ''
|
||||||
|
specialTargetFile = scriptPath + '/../' + project + '/build/target'
|
||||||
|
if os.path.isfile(specialTargetFile):
|
||||||
|
with open(specialTargetFile, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
target = line.strip()
|
||||||
|
if len(target) > 0:
|
||||||
|
cmake.append('-DDESKTOP_APP_SPECIAL_TARGET=' + target)
|
||||||
|
|
||||||
|
cmake.extend(['-Werror=dev', '-Werror=deprecated', '--warn-uninitialized', '..'])
|
||||||
|
command = ' '.join(cmake)
|
||||||
|
|
||||||
|
if not os.path.exists(basePath):
|
||||||
|
os.mkdir(basePath)
|
||||||
|
elif 'fresh' in arguments:
|
||||||
|
paths = os.listdir(basePath)
|
||||||
|
for path in paths:
|
||||||
|
if path.lower().startswith('cmake'):
|
||||||
|
full = basePath + '/' + path
|
||||||
|
if os.path.isdir(full):
|
||||||
|
shutil.rmtree(full, ignore_errors=False)
|
||||||
|
else:
|
||||||
|
os.remove(full)
|
||||||
|
print('Cleared previous.')
|
||||||
|
os.chdir(basePath)
|
||||||
|
subprocess.call(command, shell=True)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
@ -8,6 +8,8 @@ set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, lik
|
||||||
option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." OFF)
|
option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." OFF)
|
||||||
option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF)
|
option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF)
|
||||||
option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON)
|
option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON)
|
||||||
|
option(DESKTOP_APP_USE_GLIBC_WRAPS "Use wraps for new GLIBC features." OFF)
|
||||||
|
option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ON)
|
||||||
|
|
||||||
function(report_bad_special_target)
|
function(report_bad_special_target)
|
||||||
message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'")
|
message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'")
|
||||||
|
|
@ -19,6 +21,11 @@ if (DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
|
||||||
set(disable_autoupdate 1)
|
set(disable_autoupdate 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
|
||||||
|
set(DESKTOP_APP_USE_GLIBC_WRAPS ON)
|
||||||
|
set(DESKTOP_APP_USE_PACKAGED OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
|
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version" FORCE)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version" FORCE)
|
||||||
else()
|
else()
|
||||||
|
|
@ -38,6 +45,7 @@ if (WIN32)
|
||||||
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win")
|
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win")
|
||||||
report_bad_special_target()
|
report_bad_special_target()
|
||||||
endif()
|
endif()
|
||||||
|
set(DESKTOP_APP_USE_GLIBC_WRAPS OFF)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
|
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
|
||||||
set(build_osx 1)
|
set(build_osx 1)
|
||||||
|
|
@ -48,6 +56,7 @@ elseif (APPLE)
|
||||||
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac")
|
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac")
|
||||||
report_bad_special_target()
|
report_bad_special_target()
|
||||||
endif()
|
endif()
|
||||||
|
set(DESKTOP_APP_USE_GLIBC_WRAPS OFF)
|
||||||
else()
|
else()
|
||||||
set(LINUX 1)
|
set(LINUX 1)
|
||||||
execute_process(COMMAND uname -m OUTPUT_VARIABLE machine_uname)
|
execute_process(COMMAND uname -m OUTPUT_VARIABLE machine_uname)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue