1
0
Fork 0

Initial build with Xcode.

This commit is contained in:
John Preston 2019-11-25 18:39:08 +03:00
parent b303af63d7
commit 9e68adb866
19 changed files with 352 additions and 75 deletions

View file

@ -7,6 +7,7 @@
add_subdirectory(auto_updates)
add_subdirectory(crash_reports)
add_subdirectory(gsl)
add_subdirectory(iconv)
add_subdirectory(lz4)
add_subdirectory(openal)
add_subdirectory(openssl)
@ -14,6 +15,7 @@ add_subdirectory(opus)
add_subdirectory(qt)
add_subdirectory(ranges)
add_subdirectory(rlottie)
add_subdirectory(sp_media_key_tap)
add_subdirectory(variant)
add_subdirectory(xxhash)
add_subdirectory(zlib)

20
external/auto_updates/xz/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,20 @@
# 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_xz INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_xz ALIAS external_xz)
if (APPLE AND NOT build_osx)
target_link_libraries(external_xz
INTERFACE
/usr/local/macos/lib/liblzma.a
)
else()
target_link_libraries(external_xz
INTERFACE
/usr/local/lib/liblzma.a
)
endif()

View file

@ -7,13 +7,14 @@
add_library(external_crash_reports INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_crash_reports ALIAS external_crash_reports)
if (WIN32)
if (WIN32 OR LINUX OR build_macstore)
add_subdirectory(breakpad)
target_link_libraries(external_crash_reports
INTERFACE
desktop-app::external_breakpad
)
else()
add_subdirectory(crashpad)
target_link_libraries(external_crash_reports
INTERFACE
desktop-app::external_crashpad

View file

@ -0,0 +1,24 @@
# 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_crashpad INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_crashpad ALIAS external_crashpad)
target_include_directories(external_crashpad SYSTEM
INTERFACE
${libs_loc}/crashpad
${libs_loc}/crashpad/third_party/mini_chromium/mini_chromium
)
set(crashpad_lib_loc ${libs_loc}/crashpad/out/$<IF:$<CONFIG:Debug>,Debug,Release>)
target_link_libraries(external_crashpad
INTERFACE
${crashpad_lib_loc}/libbase.a
${crashpad_lib_loc}/libcrashpad_client.a
${crashpad_lib_loc}/libcrashpad_util.a
bsm
)

20
external/iconv/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,20 @@
# 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_iconv INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_iconv ALIAS external_iconv)
if (build_osx)
target_link_libraries(external_iconv
INTERFACE
/usr/local/lib/libiconv.a
)
else()
target_link_libraries(external_iconv
INTERFACE
/usr/local/macos/lib/libiconv.a
)
endif()

View file

@ -7,20 +7,25 @@
add_library(external_openal INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_openal ALIAS external_openal)
target_include_directories(external_openal SYSTEM
INTERFACE
if (WIN32)
target_include_directories(external_openal SYSTEM
INTERFACE
${libs_loc}/openal-soft/include
)
target_link_directories(external_openal
INTERFACE
${libs_loc}/openal-soft/build/$<IF:$<CONFIG:Debug>,Debug,Release>
)
target_link_libraries(external_openal
INTERFACE
OpenAL32
)
)
target_link_libraries(external_openal
INTERFACE
${libs_loc}/openal-soft/build/$<IF:$<CONFIG:Debug>,Debug,Release>/OpenAL32
)
else()
target_include_directories(external_openal SYSTEM
INTERFACE
/usr/local/macos/include
)
target_link_libraries(external_openal
INTERFACE
/usr/local/macos/lib/libopenal.a
)
endif()
target_compile_definitions(external_openal
INTERFACE

View file

@ -12,13 +12,27 @@ INTERFACE
${libs_loc}/openssl_1_1_1/include
)
target_link_directories(external_openssl
INTERFACE
if (WIN32)
target_link_directories(external_openssl
INTERFACE
${libs_loc}/openssl_1_1_1/out32$<$<CONFIG:Debug>:.dbg>
)
target_link_libraries(external_openssl
INTERFACE
)
target_link_libraries(external_openssl
INTERFACE
libcrypto
libssl
)
)
else()
if (APPLE)
target_link_directories(external_openssl
INTERFACE
${libs_loc}/openssl_1_1_1
)
endif()
target_link_libraries(external_openssl
INTERFACE
crypto
ssl
)
endif()

View file

@ -12,12 +12,24 @@ INTERFACE
${libs_loc}/opus/include
)
target_link_directories(external_opus
INTERFACE
if (WIN32)
target_link_directories(external_opus
INTERFACE
${libs_loc}/opus/win32/VS2015/Win32/$<IF:$<CONFIG:Debug>,Debug,Release>
)
)
target_link_libraries(external_opus
INTERFACE
target_link_libraries(external_opus
INTERFACE
opus
)
)
elseif (APPLE AND NOT build_osx)
target_link_libraries(external_opus
INTERFACE
/usr/local/macos/lib/libopus.a
)
else()
target_link_libraries(external_opus
INTERFACE
/usr/local/lib/libopus.a
)
endif()

View file

@ -54,6 +54,7 @@ set(common_qt_libs
qtlibpng
)
set(qt_libs_list "")
if (WIN32)
set(qt_libs
${common_qt_libs}
@ -64,11 +65,31 @@ if (WIN32)
qtfreetype
qtpcre2
)
set(qt_libs_list "")
foreach(lib ${qt_libs})
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${lib}$<$<CONFIG:Debug>:d>")
endforeach()
else()
elseif (APPLE)
if (NOT build_osx)
set(qt_libs
${common_qt_libs}
Qt5Core
Qt5GraphicsSupport
Qt5ClipboardSupport
qgenericbearer
qtfreetype
qtpcre2
qcocoa
)
else()
endif()
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${lib}$<$<CONFIG:Debug>:_debug>")
endforeach()
target_link_libraries(external_qt
INTERFACE
desktop-app::external_zlib
cups
)
endif()
target_link_directories(external_qt

View file

@ -9,6 +9,7 @@ set(qt_version 5.12.5)
if (WIN32)
set(qt_loc ${libs_loc}/Qt-${qt_version})
else()
set(qt_loc /usr/local/desktop-app/Qt-${qt_version})
endif()
set(Qt5_DIR ${qt_loc}/lib/cmake/Qt5)

View file

@ -0,0 +1,26 @@
# 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
if (EXISTS ${third_party_loc}/SPMediaKeyTap)
add_library(external_sp_media_key_tap OBJECT)
add_library(desktop-app::external_sp_media_key_tap ALIAS external_sp_media_key_tap)
init_target(external_sp_media_key_tap "(external)")
set(sp_media_key_tap_loc ${third_party_loc}/SPMediaKeyTap)
target_sources(external_sp_media_key_tap
PRIVATE
${sp_media_key_tap_loc}/SPMediaKeyTap.m
${sp_media_key_tap_loc}/SPMediaKeyTap.h
${sp_media_key_tap_loc}/SPInvocationGrabbing/NSObject+SPInvocationGrabbing.m
${sp_media_key_tap_loc}/SPInvocationGrabbing/NSObject+SPInvocationGrabbing.h
)
target_include_directories(external_sp_media_key_tap SYSTEM
INTERFACE
${sp_media_key_tap_loc}
)
endif()

View file

@ -7,6 +7,31 @@
add_library(external_zlib INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_zlib ALIAS external_zlib)
if (NOT WIN32)
add_library(external_minizip STATIC)
init_target(external_minizip "(external)")
set(minizip_loc ${third_party_loc}/minizip)
target_sources(external_minizip
PRIVATE
${minizip_loc}/crypt.h
${minizip_loc}/ioapi.c
${minizip_loc}/ioapi.h
${minizip_loc}/zip.c
${minizip_loc}/zip.h
${minizip_loc}/unzip.c
${minizip_loc}/unzip.h
)
target_include_directories(external_minizip SYSTEM
INTERFACE
${minizip_loc}
)
target_link_libraries(external_zlib INTERFACE external_minizip)
endif()
target_include_directories(external_zlib SYSTEM
INTERFACE
${libs_loc}/zlib
@ -14,18 +39,14 @@ INTERFACE
)
if (WIN32)
target_compile_definitions(external_zlib
target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI)
target_link_directories(external_zlib
INTERFACE
ZLIB_WINAPI
)
endif()
target_link_directories(external_zlib
INTERFACE
${libs_loc}/zlib/contrib/vstudio/vc14/x86/ZlibStat$<IF:$<CONFIG:Debug>,Debug,ReleaseWithoutAsm>
)
)
target_link_libraries(external_zlib
INTERFACE
zlibstat
)
target_link_libraries(external_zlib INTERFACE zlibstat)
else()
target_link_libraries(external_zlib INTERFACE /usr/local/lib/libz.a)
endif()

View file

@ -11,8 +11,15 @@ function(init_target_folder target_name folder_name)
endfunction()
function(init_target target_name) # init_target(my_target folder_name)
if (DEFINED ARGV1)
init_target_folder(${target_name} "${ARGV1}")
if (ARGC GREATER 1)
if (${ARGV1} STREQUAL cxx_std_14 OR ${ARGV1} STREQUAL cxx_std_11)
target_compile_features(${target_name} PUBLIC ${ARGV1})
else()
target_compile_features(${target_name} PUBLIC cxx_std_17)
init_target_folder(${target_name} ${ARGV1})
endif()
else()
target_compile_features(${target_name} PUBLIC cxx_std_17)
endif()
if (WIN32)
set_target_properties(${target_name} PROPERTIES
@ -23,6 +30,10 @@ function(init_target target_name) # init_target(my_target folder_name)
INTERPROCEDURAL_OPTIMIZATION_RELEASE True
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True
INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True
LINK_SEARCH_START_STATIC 1
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES
)
endfunction()

View file

@ -12,21 +12,21 @@ function(nice_target_sources target_name src_loc list)
set(not_win_sources "")
set(not_mac_sources "")
set(not_linux_sources "")
foreach(file ${list})
if (${file} STREQUAL "PRIVATE" OR ${file} STREQUAL "PUBLIC" OR ${file} STREQUAL "INTERFACE")
set(writing_now ${file})
foreach (entry ${list})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry})
else()
set(full_name ${src_loc}/${file})
if (${file} MATCHES "(^|/)win/" OR ${file} MATCHES "(^|/)winrc/" OR ${file} MATCHES "(^|/)windows/" OR ${file} MATCHES "[_\\/]win\\.")
set(full_name ${src_loc}/${entry})
if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} 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 "(^|/)osx/" OR ${file} MATCHES "[_\\/]mac\\." OR ${file} MATCHES "[_\\/]darwin\\." OR ${file} MATCHES "[_\\/]osx\\.")
elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.")
list(APPEND not_win_sources ${full_name})
list(APPEND not_linux_sources ${full_name})
elseif (${file} MATCHES "(^|/)linux/" OR ${file} MATCHES "[_\\/]linux\\.")
elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} 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 (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.")
list(APPEND not_win_sources ${full_name})
endif()
if ("${writing_now}" STREQUAL "PRIVATE")

View file

@ -7,15 +7,8 @@
add_library(common_options INTERFACE)
add_library(desktop-app::common_options ALIAS common_options)
target_compile_features(common_options
INTERFACE
cxx_std_17
)
target_compile_definitions(common_options
INTERFACE
UNICODE
_UNICODE
$<IF:$<CONFIG:Debug>,_DEBUG,NDEBUG>
)
@ -28,9 +21,9 @@ endif()
if (WIN32)
include(cmake/options_win.cmake)
elseif(APPLE)
elseif (APPLE)
include(cmake/options_mac.cmake)
elseif(LINUX)
elseif (LINUX)
include(cmake/options_linux.cmake)
else()
message(FATAL_ERROR "Unknown platform type")

View file

@ -6,6 +6,61 @@
if (build_osx)
target_compile_definitions(common_options INTERFACE OS_OSX)
elseif (build_macstore)
else()
if (build_macstore)
target_compile_definitions(common_options INTERFACE OS_MAC_STORE)
endif()
target_include_directories(common_options
INTERFACE
/usr/local/macos/include
)
endif()
target_compile_options(common_options
INTERFACE
-pipe
-g
-Wall
-Werror
-W
-fPIE
-Wno-deprecated-declarations # temp for range-v3
-Wno-unused-variable
-Wno-unused-parameter
-Wno-unused-function
-Wno-switch
-Wno-comment
-Wno-missing-field-initializers
-Wno-sign-compare
-Wno-unknown-attributes
-Wno-pragma-system-header-outside-header
)
target_link_frameworks(common_options
INTERFACE
Cocoa
CoreFoundation
CoreServices
CoreText
CoreGraphics
CoreMedia
IOSurface
Metal
OpenGL
AudioUnit
ApplicationServices
Foundation
AGL
Security
SystemConfiguration
Carbon
AudioToolbox
VideoToolbox
VideoDecodeAcceleration
AVFoundation
CoreAudio
QuartzCore
AppKit
CoreWLAN
IOKit
)

View file

@ -11,6 +11,8 @@ INTERFACE
_SCL_SECURE_NO_WARNINGS
_USING_V110_SDK71_
NOMINMAX
UNICODE
_UNICODE
)
target_compile_options(common_options
INTERFACE
@ -65,6 +67,6 @@ INTERFACE
Crypt32
)
if (build_uwp)
if (build_winstore)
target_compile_definitions(common_options INTERFACE OS_WIN_STORE)
endif()

View file

@ -0,0 +1,41 @@
# 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(target_link_frameworks target_name)
set(list ${ARGV})
list(REMOVE_AT list 0)
set(writing_now "")
set(private_frameworks "")
set(public_frameworks "")
set(interface_frameworks "")
foreach (entry ${list})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry})
else()
set(full_argument "-framework ${entry}")
if ("${writing_now}" STREQUAL "PRIVATE")
list(APPEND private_frameworks ${full_argument})
elseif ("${writing_now}" STREQUAL "PUBLIC")
list(APPEND public_frameworks ${full_argument})
elseif ("${writing_now}" STREQUAL "INTERFACE")
list(APPEND interface_frameworks ${full_argument})
else()
message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}")
endif()
endif()
endforeach()
if (NOT "${public_frameworks}" STREQUAL "")
target_link_libraries(${target_name} PUBLIC ${public_frameworks})
endif()
if (NOT "${private_frameworks}" STREQUAL "")
target_link_libraries(${target_name} PRIVATE ${private_frameworks})
endif()
if (NOT "${interface_frameworks}" STREQUAL "")
target_link_libraries(${target_name} INTERFACE ${interface_frameworks})
endif()
endfunction()

View file

@ -4,10 +4,6 @@
# 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)
@ -23,11 +19,15 @@ if (DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
set(disable_autoupdate 1)
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version" FORCE)
set(build_osx 0)
set(build_macstore 0)
set(build_winstore 0)
if (WIN32)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp")
set(build_uwp 1)
set(build_winstore 1)
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win")
report_bad_special_target()
@ -56,3 +56,11 @@ else()
report_bad_special_target()
endif()
endif()
if (NOT APPLE OR build_osx)
get_filename_component(libs_loc "../Libraries" REALPATH)
else()
get_filename_component(libs_loc "../Libraries/macos" REALPATH)
endif()
get_filename_component(third_party_loc "Telegram/ThirdParty" REALPATH)
get_filename_component(submodules_loc "Telegram" REALPATH)