1
0
Fork 0

Introduce DESKTOP_APP_USE_PACKAGED.

This commit is contained in:
John Preston 2019-12-06 13:12:04 +03:00
parent 3182d2d4a7
commit 632ed315b2
7 changed files with 90 additions and 23 deletions

View file

@ -5,4 +5,6 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL
add_subdirectory(external)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
add_subdirectory(linux_glibc_wraps)
endif()

View file

@ -7,7 +7,10 @@
add_library(external_xz INTERFACE IMPORTED GLOBAL)
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
INTERFACE
/usr/local/macos/lib/liblzma.a

View file

@ -47,9 +47,8 @@ INTERFACE
)
if (LINUX)
target_link_libraries(external_openssl
INTERFACE
desktop-app::linux_glibc_wraps
pthread
)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_openssl INTERFACE desktop-app::linux_glibc_wraps)
endif()
target_link_libraries(external_openssl INTERFACE pthread)
endif()

View file

@ -191,9 +191,11 @@ if (LINUX)
icuuc
icudata
)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_qt INTERFACE desktop-app::linux_glibc_wraps)
endif()
target_link_libraries(external_qt
INTERFACE
desktop-app::linux_glibc_wraps
xcb
X11
X11-xcb

View file

@ -4,7 +4,6 @@
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
if (LINUX)
add_library(linux_glibc_wraps STATIC)
add_library(desktop-app::linux_glibc_wraps ALIAS linux_glibc_wraps)
@ -21,4 +20,3 @@ if (LINUX)
else()
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_64.c PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
endif()

54
run_cmake.py Normal file
View 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

View file

@ -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_SPELLCHECK "Disable spellcheck library." OFF)
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)
message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'")
@ -19,6 +21,11 @@ if (DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
set(disable_autoupdate 1)
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")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version" FORCE)
else()
@ -38,6 +45,7 @@ if (WIN32)
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win")
report_bad_special_target()
endif()
set(DESKTOP_APP_USE_GLIBC_WRAPS OFF)
elseif (APPLE)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
set(build_osx 1)
@ -48,6 +56,7 @@ elseif (APPLE)
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac")
report_bad_special_target()
endif()
set(DESKTOP_APP_USE_GLIBC_WRAPS OFF)
else()
set(LINUX 1)
execute_process(COMMAND uname -m OUTPUT_VARIABLE machine_uname)