1
0
Fork 0

Add more options and external_ libs.

This commit is contained in:
John Preston 2019-11-21 14:54:32 +03:00
parent 2a87436d39
commit 118ce81dd4
11 changed files with 158 additions and 24 deletions

View file

@ -9,8 +9,10 @@ add_subdirectory(openssl)
add_subdirectory(variant) add_subdirectory(variant)
add_subdirectory(ranges) add_subdirectory(ranges)
add_subdirectory(gsl) add_subdirectory(gsl)
add_subdirectory(lz4)
add_subdirectory(crash_reports) add_subdirectory(crash_reports)
add_subdirectory(auto_updates) add_subdirectory(auto_updates)
add_subdirectory(zlib) add_subdirectory(zlib)
add_subdirectory(opus) add_subdirectory(opus)
add_subdirectory(openal) add_subdirectory(openal)
add_subdirectory(xxhash)

28
external/lz4/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,28 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
add_library(external_lz4 OBJECT)
init_target(external_lz4 "(external)")
set(lz4_loc ${third_party_loc}/lz4/lib)
target_sources(external_lz4
PRIVATE
${lz4_loc}/lz4.c
${lz4_loc}/lz4.h
${lz4_loc}/lz4frame.c
${lz4_loc}/lz4frame.h
${lz4_loc}/lz4frame_static.h
${lz4_loc}/lz4hc.c
${lz4_loc}/lz4hc.h
${lz4_loc}/xxhash.c
${lz4_loc}/xxhash.h
)
target_include_directories(external_lz4
PUBLIC
${lz4_loc}
)

View file

@ -20,3 +20,9 @@ target_link_libraries(external_openal
INTERFACE INTERFACE
OpenAL32 OpenAL32
) )
target_compile_definitions(external_openal
INTERFACE
AL_LIBTYPE_STATIC
AL_ALEXT_PROTOTYPES
)

View file

@ -6,6 +6,14 @@
add_library(external_qt INTERFACE IMPORTED GLOBAL) add_library(external_qt INTERFACE IMPORTED GLOBAL)
if (LINUX)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_definitions(external_qt INTERFACE Q_OS_LINUX64)
else()
target_compile_definitions(external_qt INTERFACE Q_OS_LINUX32)
endif()
endif()
target_include_directories(external_qt SYSTEM target_include_directories(external_qt SYSTEM
INTERFACE INTERFACE
${qt_loc}/include ${qt_loc}/include
@ -18,6 +26,17 @@ INTERFACE
${qt_loc}/include/QtGui/${qt_version}/QtGui ${qt_loc}/include/QtGui/${qt_version}/QtGui
) )
target_compile_definitions(external_qt
INTERFACE
_REENTRANT
QT_STATICPLUGIN
QT_PLUGIN
QT_WIDGETS_LIB
QT_NETWORK_LIB
QT_GUI_LIB
QT_CORE_LIB
)
set(common_qt_libs set(common_qt_libs
qwebp qwebp
qgif qgif

17
external/xxhash/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,17 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
add_library(external_xxhash INTERFACE IMPORTED GLOBAL)
target_include_directories(external_xxhash SYSTEM
INTERFACE
${third_party_loc}/xxHash
)
target_compile_definitions(external_xxhash
INTERFACE
XXH_INLINE_ALL
)

View file

@ -1,19 +0,0 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
function(force_include target_name file_path)
if (MSVC)
target_compile_options(${target_name}
PRIVATE
/FI${file_path}
)
else()
target_compile_options(${target_name}
PRIVATE
-include ${file_path}
)
endif()
endfunction()

View file

@ -14,9 +14,23 @@ INTERFACE
target_compile_definitions(common_options target_compile_definitions(common_options
INTERFACE INTERFACE
UNICODE UNICODE
_UNICODE
$<IF:$<CONFIG:Debug>,_DEBUG,NDEBUG>
) )
if (DESKTOP_APP_DISABLE_CRASH_REPORTS)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_DISABLE_CRASH_REPORTS
)
endif()
if (WIN32) if (WIN32)
include(cmake/options_win.cmake) include(cmake/options_win.cmake)
elseif(APPLE)
include(cmake/options_mac.cmake)
elseif(LINUX)
include(cmake/options_linux.cmake)
else() else()
message(FATAL_ERROR "Unknown platform type")
endif() endif()

5
options_linux.cmake Normal file
View file

@ -0,0 +1,5 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL

View file

@ -4,6 +4,8 @@
# 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
get_filename_component(libs_loc "../Libraries" REALPATH) if (build_osx)
get_filename_component(third_party_loc "Telegram/ThirdParty" REALPATH) target_compile_definitions(common_options INTERFACE OS_OSX)
get_filename_component(submodules_loc "Telegram" REALPATH) elseif (build_macstore)
target_compile_definitions(common_options INTERFACE OS_MAC_STORE)
endif()

View file

@ -8,8 +8,6 @@ target_compile_definitions(common_options
INTERFACE INTERFACE
WIN32 WIN32
_WINDOWS _WINDOWS
_UNICODE
UNICODE
_SCL_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS
_USING_V110_SDK71_ _USING_V110_SDK71_
NOMINMAX NOMINMAX
@ -65,3 +63,7 @@ INTERFACE
Rstrtmgr Rstrtmgr
Crypt32 Crypt32
) )
if (build_uwp)
target_compile_definitions(common_options INTERFACE OS_WIN_STORE)
endif()

58
variables.cmake Normal file
View file

@ -0,0 +1,58 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
get_filename_component(libs_loc "../Libraries" REALPATH)
get_filename_component(third_party_loc "Telegram/ThirdParty" REALPATH)
get_filename_component(submodules_loc "Telegram" REALPATH)
set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'mas' for Mac App Store.")
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)
function(report_bad_special_target)
message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'")
endfunction()
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp"
OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "mas")
set(disable_autoupdate 1)
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12)
if (WIN32)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp")
set(build_uwp 1)
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win")
report_bad_special_target()
endif()
elseif (APPLE)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
set(build_osx 1)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "mas")
set(build_macstore 1)
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac")
report_bad_special_target()
endif()
else()
set(LINUX 1)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux")
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
report_bad_special_target()
endif()
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux32")
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
report_bad_special_target()
endif()
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
report_bad_special_target()
endif()
endif()