1
0
Fork 0

Make packaged build working

This commit is contained in:
Ilya Fedin 2020-01-03 08:33:52 +04:00
parent 652bbaf002
commit 1db22f3663
15 changed files with 547 additions and 422 deletions

View file

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

View file

@ -7,32 +7,58 @@
add_library(external_ffmpeg INTERFACE IMPORTED GLOBAL) add_library(external_ffmpeg INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_ffmpeg ALIAS external_ffmpeg) add_library(desktop-app::external_ffmpeg ALIAS external_ffmpeg)
target_include_directories(external_ffmpeg SYSTEM if (DESKTOP_APP_USE_PACKAGED)
INTERFACE find_package(PkgConfig REQUIRED)
${libs_loc}/ffmpeg
)
set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) pkg_check_modules(AVCODEC REQUIRED libavcodec)
pkg_check_modules(AVFORMAT REQUIRED libavformat)
pkg_check_modules(AVUTIL REQUIRED libavutil)
pkg_check_modules(SWSCALE REQUIRED libswscale)
pkg_check_modules(SWRESAMPLE REQUIRED libswresample)
target_link_libraries(external_ffmpeg target_include_directories(external_ffmpeg
INTERFACE
${ffmpeg_lib_loc}/libavformat/libavformat.a
${ffmpeg_lib_loc}/libavcodec/libavcodec.a
${ffmpeg_lib_loc}/libswresample/libswresample.a
${ffmpeg_lib_loc}/libswscale/libswscale.a
${ffmpeg_lib_loc}/libavutil/libavutil.a
)
if (LINUX)
target_link_static_libraries(external_ffmpeg
INTERFACE INTERFACE
va-x11 ${AVCODEC_INCLUDE_DIRS}
va-drm ${AVFORMAT_INCLUDE_DIRS}
va ${AVUTIL_INCLUDE_DIRS}
vdpau ${SWSCALE_INCLUDE_DIRS}
drm ${SWRESAMPLE_INCLUDE_DIRS})
Xi
Xext target_link_libraries(external_ffmpeg
Xfixes INTERFACE
Xrender ${AVCODEC_LIBRARIES}
${AVFORMAT_LIBRARIES}
${AVUTIL_LIBRARIES}
${SWSCALE_LIBRARIES}
${SWRESAMPLE_LIBRARIES})
else()
target_include_directories(external_ffmpeg SYSTEM
INTERFACE
${libs_loc}/ffmpeg
) )
set(ffmpeg_lib_loc ${libs_loc}/ffmpeg)
target_link_libraries(external_ffmpeg
INTERFACE
${ffmpeg_lib_loc}/libavformat/libavformat.a
${ffmpeg_lib_loc}/libavcodec/libavcodec.a
${ffmpeg_lib_loc}/libswresample/libswresample.a
${ffmpeg_lib_loc}/libswscale/libswscale.a
${ffmpeg_lib_loc}/libavutil/libavutil.a
)
if (LINUX)
target_link_static_libraries(external_ffmpeg
INTERFACE
va-x11
va-drm
va
vdpau
drm
Xi
Xext
Xfixes
Xrender
)
endif()
endif() endif()

View file

@ -4,26 +4,37 @@
# 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
add_library(external_lz4 OBJECT) if (DESKTOP_APP_USE_PACKAGED)
add_library(desktop-app::external_lz4 ALIAS external_lz4) add_library(external_lz4 INTERFACE IMPORTED GLOBAL)
init_target(external_lz4 "(external)") add_library(desktop-app::external_lz4 ALIAS external_lz4)
set(lz4_loc ${third_party_loc}/lz4/lib) find_package(PkgConfig REQUIRED)
pkg_check_modules(LZ4 REQUIRED liblz4)
target_sources(external_lz4 target_include_directories(external_lz4 INTERFACE ${LZ4_INCLUDE_DIRS})
PRIVATE target_link_libraries(external_lz4 INTERFACE ${LZ4_LIBRARIES})
${lz4_loc}/lz4.c else()
${lz4_loc}/lz4.h add_library(external_lz4 OBJECT)
${lz4_loc}/lz4frame.c add_library(desktop-app::external_lz4 ALIAS external_lz4)
${lz4_loc}/lz4frame.h init_target(external_lz4 "(external)")
${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 set(lz4_loc ${third_party_loc}/lz4/lib)
PUBLIC
${lz4_loc} 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}
)
endif()

View file

@ -7,7 +7,11 @@
add_library(external_openal INTERFACE IMPORTED GLOBAL) add_library(external_openal INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_openal ALIAS external_openal) add_library(desktop-app::external_openal ALIAS external_openal)
if (WIN32) if (DESKTOP_APP_USE_PACKAGED)
find_package(OpenAL REQUIRED)
target_include_directories(external_openal INTERFACE ${OPENAL_INCLUDE_DIR})
target_link_libraries(external_openal INTERFACE ${OPENAL_LIBRARY})
elseif (WIN32)
target_include_directories(external_openal SYSTEM target_include_directories(external_openal SYSTEM
INTERFACE INTERFACE
${libs_loc}/openal-soft/include ${libs_loc}/openal-soft/include
@ -36,8 +40,14 @@ else()
) )
endif() endif()
if (NOT DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(external_openal
INTERFACE
AL_LIBTYPE_STATIC
)
endif()
target_compile_definitions(external_openal target_compile_definitions(external_openal
INTERFACE INTERFACE
AL_LIBTYPE_STATIC
AL_ALEXT_PROTOTYPES AL_ALEXT_PROTOTYPES
) )

View file

@ -7,52 +7,57 @@
add_library(external_openssl INTERFACE IMPORTED GLOBAL) add_library(external_openssl INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_openssl ALIAS external_openssl) add_library(desktop-app::external_openssl ALIAS external_openssl)
if (LINUX) if (DESKTOP_APP_USE_PACKAGED)
target_include_directories(external_openssl SYSTEM find_package(OpenSSL REQUIRED)
INTERFACE target_link_libraries(external_openssl INTERFACE OpenSSL::SSL)
/usr/local/desktop-app/openssl-1.1.1/include
)
elseif (NOT APPLE OR NOT build_osx)
target_include_directories(external_openssl SYSTEM
INTERFACE
${libs_loc}/openssl_1_1_1/include
)
else() else()
target_include_directories(external_openssl SYSTEM if (LINUX)
INTERFACE target_include_directories(external_openssl SYSTEM
${libs_loc}/openssl/include
)
endif()
if (WIN32)
set(openssl_lib_ext lib)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1/out32$<$<CONFIG:Debug>:.dbg>)
else()
set(openssl_lib_ext a)
if (APPLE)
if (NOT build_osx)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1)
else()
set(openssl_lib_loc ${libs_loc}/openssl)
endif()
else()
set(openssl_lib_loc /usr/local/desktop-app/openssl-1.1.1/lib)
endif()
endif()
target_link_libraries(external_openssl
INTERFACE
${openssl_lib_loc}/libssl.${openssl_lib_ext}
${openssl_lib_loc}/libcrypto.${openssl_lib_ext}
)
if (LINUX)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_openssl
INTERFACE INTERFACE
desktop-app::linux_glibc_wraps /usr/local/desktop-app/openssl-1.1.1/include
$<TARGET_FILE:desktop-app::linux_glibc_wraps> )
elseif (NOT APPLE OR NOT build_osx)
target_include_directories(external_openssl SYSTEM
INTERFACE
${libs_loc}/openssl_1_1_1/include
)
else()
target_include_directories(external_openssl SYSTEM
INTERFACE
${libs_loc}/openssl/include
) )
endif() endif()
target_link_libraries(external_openssl INTERFACE pthread)
if (WIN32)
set(openssl_lib_ext lib)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1/out32$<$<CONFIG:Debug>:.dbg>)
else()
set(openssl_lib_ext a)
if (APPLE)
if (NOT build_osx)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1)
else()
set(openssl_lib_loc ${libs_loc}/openssl)
endif()
else()
set(openssl_lib_loc /usr/local/desktop-app/openssl-1.1.1/lib)
endif()
endif()
target_link_libraries(external_openssl
INTERFACE
${openssl_lib_loc}/libssl.${openssl_lib_ext}
${openssl_lib_loc}/libcrypto.${openssl_lib_ext}
)
if (LINUX)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_openssl
INTERFACE
desktop-app::linux_glibc_wraps
$<TARGET_FILE:desktop-app::linux_glibc_wraps>
)
endif()
target_link_libraries(external_openssl INTERFACE pthread)
endif()
endif() endif()

View file

@ -7,12 +7,21 @@
add_library(external_opus INTERFACE IMPORTED GLOBAL) add_library(external_opus INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_opus ALIAS external_opus) add_library(desktop-app::external_opus ALIAS external_opus)
target_include_directories(external_opus SYSTEM if (DESKTOP_APP_USE_PACKAGED)
INTERFACE find_package(PkgConfig REQUIRED)
${libs_loc}/opus/include pkg_check_modules(OPUS opus)
)
if (WIN32) target_include_directories(external_opus INTERFACE ${OPUS_INCLUDE_DIRS})
else()
target_include_directories(external_opus SYSTEM
INTERFACE
${libs_loc}/opus/include
)
endif()
if (DESKTOP_APP_USE_PACKAGED)
target_link_libraries(external_opus INTERFACE ${OPUS_LIBRARIES})
elseif (WIN32)
set(opus_lib_loc ${libs_loc}/opus/win32/VS2015/Win32/$<IF:$<CONFIG:Debug>,Debug,Release>) set(opus_lib_loc ${libs_loc}/opus/win32/VS2015/Win32/$<IF:$<CONFIG:Debug>,Debug,Release>)
target_link_libraries(external_opus target_link_libraries(external_opus

View file

@ -15,203 +15,218 @@ if (LINUX)
endif() endif()
endif() endif()
target_include_directories(external_qt SYSTEM if (DESKTOP_APP_USE_PACKAGED)
INTERFACE target_link_libraries(external_qt
${qt_loc}/include INTERFACE
${qt_loc}/include/QtCore Qt5::Core
${qt_loc}/include/QtGui Qt5::Gui
${qt_loc}/include/QtDBus Qt5::Widgets
${qt_loc}/include/QtCore/${qt_version} Qt5::Network
${qt_loc}/include/QtGui/${qt_version} Qt5::DBus)
${qt_loc}/include/QtCore/${qt_version}/QtCore
${qt_loc}/include/QtGui/${qt_version}/QtGui
)
target_compile_definitions(external_qt target_include_directories(external_qt
INTERFACE INTERFACE
_REENTRANT ${Qt5Core_PRIVATE_INCLUDE_DIRS}
QT_STATICPLUGIN ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
QT_PLUGIN
QT_WIDGETS_LIB
QT_NETWORK_LIB
QT_GUI_LIB
QT_CORE_LIB
)
if (WIN32)
set(qt_lib_prefix "")
set(qt_lib_suffix $<$<CONFIG:Debug>:d>.lib)
else() else()
set(qt_lib_prefix lib) target_include_directories(external_qt SYSTEM
if (APPLE) INTERFACE
set(qt_lib_suffix $<$<CONFIG:Debug>:_debug>.a) ${qt_loc}/include
else() ${qt_loc}/include/QtCore
set(qt_lib_suffix .a) ${qt_loc}/include/QtGui
endif() ${qt_loc}/include/QtDBus
endif() ${qt_loc}/include/QtCore/${qt_version}
${qt_loc}/include/QtGui/${qt_version}
set(common_qt_libs ${qt_loc}/include/QtCore/${qt_version}/QtCore
plugins/imageformats/${qt_lib_prefix}qwebp ${qt_loc}/include/QtGui/${qt_version}/QtGui
plugins/imageformats/${qt_lib_prefix}qgif
plugins/imageformats/${qt_lib_prefix}qjpeg
lib/${qt_lib_prefix}Qt5PrintSupport
lib/${qt_lib_prefix}Qt5AccessibilitySupport
lib/${qt_lib_prefix}Qt5FontDatabaseSupport
lib/${qt_lib_prefix}Qt5EventDispatcherSupport
lib/${qt_lib_prefix}Qt5ThemeSupport
lib/${qt_lib_prefix}Qt5Network
lib/${qt_lib_prefix}Qt5Widgets
lib/${qt_lib_prefix}Qt5Gui
lib/${qt_lib_prefix}qtharfbuzz
lib/${qt_lib_prefix}qtlibpng
)
set(qt_libs_list "")
if (WIN32)
set(qt_libs
${common_qt_libs}
lib/${qt_lib_prefix}Qt5Core
lib/${qt_lib_prefix}Qt5WindowsUIAutomationSupport
lib/${qt_lib_prefix}qtmain
lib/${qt_lib_prefix}qtfreetype
lib/${qt_lib_prefix}qtpcre2
plugins/platforms/${qt_lib_prefix}qwindows
) )
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") target_compile_definitions(external_qt
endforeach() INTERFACE
elseif (APPLE) _REENTRANT
if (NOT build_osx) QT_STATICPLUGIN
QT_PLUGIN
QT_WIDGETS_LIB
QT_NETWORK_LIB
QT_GUI_LIB
QT_CORE_LIB
)
if (WIN32)
set(qt_lib_prefix "")
set(qt_lib_suffix $<$<CONFIG:Debug>:d>.lib)
else()
set(qt_lib_prefix lib)
if (APPLE)
set(qt_lib_suffix $<$<CONFIG:Debug>:_debug>.a)
else()
set(qt_lib_suffix .a)
endif()
endif()
set(common_qt_libs
plugins/imageformats/${qt_lib_prefix}qwebp
plugins/imageformats/${qt_lib_prefix}qgif
plugins/imageformats/${qt_lib_prefix}qjpeg
lib/${qt_lib_prefix}Qt5PrintSupport
lib/${qt_lib_prefix}Qt5AccessibilitySupport
lib/${qt_lib_prefix}Qt5FontDatabaseSupport
lib/${qt_lib_prefix}Qt5EventDispatcherSupport
lib/${qt_lib_prefix}Qt5ThemeSupport
lib/${qt_lib_prefix}Qt5Network
lib/${qt_lib_prefix}Qt5Widgets
lib/${qt_lib_prefix}Qt5Gui
lib/${qt_lib_prefix}qtharfbuzz
lib/${qt_lib_prefix}qtlibpng
)
set(qt_libs_list "")
if (WIN32)
set(qt_libs set(qt_libs
${common_qt_libs} ${common_qt_libs}
lib/${qt_lib_prefix}Qt5Core lib/${qt_lib_prefix}Qt5Core
lib/${qt_lib_prefix}Qt5GraphicsSupport lib/${qt_lib_prefix}Qt5WindowsUIAutomationSupport
lib/${qt_lib_prefix}Qt5ClipboardSupport lib/${qt_lib_prefix}qtmain
lib/${qt_lib_prefix}qtfreetype lib/${qt_lib_prefix}qtfreetype
lib/${qt_lib_prefix}qtpcre2 lib/${qt_lib_prefix}qtpcre2
plugins/platforms/${qt_lib_prefix}qcocoa plugins/platforms/${qt_lib_prefix}qwindows
plugins/bearer/${qt_lib_prefix}qgenericbearer )
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach()
elseif (APPLE)
if (NOT build_osx)
set(qt_libs
${common_qt_libs}
lib/${qt_lib_prefix}Qt5Core
lib/${qt_lib_prefix}Qt5GraphicsSupport
lib/${qt_lib_prefix}Qt5ClipboardSupport
lib/${qt_lib_prefix}qtfreetype
lib/${qt_lib_prefix}qtpcre2
plugins/platforms/${qt_lib_prefix}qcocoa
plugins/bearer/${qt_lib_prefix}qgenericbearer
)
else()
set(qt_libs
lib/${qt_lib_prefix}Qt5PrintSupport
lib/${qt_lib_prefix}Qt5PlatformSupport
lib/${qt_lib_prefix}Qt5Network
lib/${qt_lib_prefix}Qt5Widgets
lib/${qt_lib_prefix}Qt5Gui
lib/${qt_lib_prefix}Qt5Core
lib/${qt_lib_prefix}qtharfbuzzng
lib/${qt_lib_prefix}qtfreetype
lib/${qt_lib_prefix}qtpcre
plugins/platforms/${qt_lib_prefix}qcocoa
plugins/imageformats/${qt_lib_prefix}qwebp
plugins/bearer/${qt_lib_prefix}qgenericbearer
)
endif()
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach()
target_link_libraries(external_qt
INTERFACE
desktop-app::external_zlib
cups
) )
else() else()
set(qt_libs set(qt_libs
lib/${qt_lib_prefix}Qt5PrintSupport plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin
lib/${qt_lib_prefix}Qt5PlatformSupport plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin
lib/${qt_lib_prefix}Qt5Network plugins/platforminputcontexts/${qt_lib_prefix}fcitxplatforminputcontextplugin
lib/${qt_lib_prefix}Qt5Widgets plugins/platforminputcontexts/${qt_lib_prefix}himeplatforminputcontextplugin
lib/${qt_lib_prefix}Qt5Gui plugins/platforminputcontexts/${qt_lib_prefix}nimfplatforminputcontextplugin
lib/${qt_lib_prefix}Qt5Core plugins/platforms/${qt_lib_prefix}qxcb
lib/${qt_lib_prefix}qtharfbuzzng lib/${qt_lib_prefix}Qt5XcbQpa
lib/${qt_lib_prefix}qtfreetype lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport
lib/${qt_lib_prefix}qtpcre lib/${qt_lib_prefix}Qt5ServiceSupport
plugins/platforms/${qt_lib_prefix}qcocoa lib/${qt_lib_prefix}Qt5EdidSupport
plugins/imageformats/${qt_lib_prefix}qwebp plugins/bearer/${qt_lib_prefix}qconnmanbearer
plugins/bearer/${qt_lib_prefix}qgenericbearer plugins/bearer/${qt_lib_prefix}qgenericbearer
plugins/bearer/${qt_lib_prefix}qnmbearer
${common_qt_libs}
lib/${qt_lib_prefix}Qt5DBus
lib/${qt_lib_prefix}Qt5Core
lib/${qt_lib_prefix}qtpcre2
lib/${qt_lib_prefix}xcb-static
) )
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach()
endif() endif()
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach()
target_link_libraries(external_qt target_link_libraries(external_qt
INTERFACE INTERFACE
desktop-app::external_zlib ${qt_libs_list}
cups
) )
else()
set(qt_libs
plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin
plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin
plugins/platforminputcontexts/${qt_lib_prefix}fcitxplatforminputcontextplugin
plugins/platforminputcontexts/${qt_lib_prefix}himeplatforminputcontextplugin
plugins/platforminputcontexts/${qt_lib_prefix}nimfplatforminputcontextplugin
plugins/platforms/${qt_lib_prefix}qxcb
lib/${qt_lib_prefix}Qt5XcbQpa
lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport
lib/${qt_lib_prefix}Qt5ServiceSupport
lib/${qt_lib_prefix}Qt5EdidSupport
plugins/bearer/${qt_lib_prefix}qconnmanbearer
plugins/bearer/${qt_lib_prefix}qgenericbearer
plugins/bearer/${qt_lib_prefix}qnmbearer
${common_qt_libs}
lib/${qt_lib_prefix}Qt5DBus
lib/${qt_lib_prefix}Qt5Core
lib/${qt_lib_prefix}qtpcre2
lib/${qt_lib_prefix}xcb-static
)
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach()
endif()
target_link_libraries(external_qt if (LINUX)
INTERFACE target_include_directories(external_qt SYSTEM
${qt_libs_list} INTERFACE
) ${qt_loc}/mkspecs/linux-g++
)
if (LINUX)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/mkspecs/linux-g++
)
target_link_options(external_qt
INTERFACE
-static-libstdc++
-pthread
-rdynamic
)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_options(external_qt target_link_options(external_qt
INTERFACE INTERFACE
-Wl,-wrap,aligned_alloc -static-libstdc++
-Wl,-wrap,secure_getenv -pthread
-Wl,-wrap,clock_gettime -rdynamic
-Wl,--no-as-needed,-lrt
) )
if (NOT build_linux32) if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_options(external_qt target_link_options(external_qt
INTERFACE INTERFACE
-Wl,-wrap,__divmodti4 -Wl,-wrap,aligned_alloc
-Wl,-wrap,secure_getenv
-Wl,-wrap,clock_gettime
-Wl,--no-as-needed,-lrt
) )
else() if (NOT build_linux32)
target_link_options(external_qt target_link_options(external_qt
INTERFACE
-Wl,-wrap,__divmodti4
)
else()
target_link_options(external_qt
INTERFACE
-Wl,-wrap,__divmoddi4
)
endif()
endif()
target_link_static_libraries(external_qt
INTERFACE
SM
ICE
fontconfig
freetype
expat
z
xcb-shm
xcb-xfixes
xcb-render
xkbcommon
xkbcommon-x11
Xrender
icutu
icui18n
icuuc
icudata
)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_qt
INTERFACE INTERFACE
-Wl,-wrap,__divmoddi4 desktop-app::linux_glibc_wraps
$<TARGET_FILE:desktop-app::linux_glibc_wraps>
) )
endif() endif()
endif()
target_link_static_libraries(external_qt
INTERFACE
SM
ICE
fontconfig
freetype
expat
z
xcb-shm
xcb-xfixes
xcb-render
xkbcommon
xkbcommon-x11
Xrender
icutu
icui18n
icuuc
icudata
)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_qt target_link_libraries(external_qt
INTERFACE INTERFACE
desktop-app::linux_glibc_wraps xcb
$<TARGET_FILE:desktop-app::linux_glibc_wraps> X11
X11-xcb
dbus-1
dl
glib-2.0
pthread
) )
endif() endif()
target_link_libraries(external_qt
INTERFACE
xcb
X11
X11-xcb
dbus-1
dl
glib-2.0
pthread
)
endif() endif()

View file

@ -4,19 +4,21 @@
# 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 (NOT APPLE OR NOT build_osx) if (NOT DESKTOP_APP_USE_PACKAGED)
set(qt_version 5.12.5) if (NOT APPLE OR NOT build_osx)
else() set(qt_version 5.12.5)
set(qt_version 5.6.2) else()
endif() set(qt_version 5.6.2)
endif()
if (WIN32) if (WIN32)
set(qt_loc ${libs_loc}/Qt-${qt_version}) set(qt_loc ${libs_loc}/Qt-${qt_version})
else() else()
set(qt_loc /usr/local/desktop-app/Qt-${qt_version}) set(qt_loc /usr/local/desktop-app/Qt-${qt_version})
endif() endif()
set(Qt5_DIR ${qt_loc}/lib/cmake/Qt5) set(Qt5_DIR ${qt_loc}/lib/cmake/Qt5)
endif()
find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED) find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED)

View file

@ -7,10 +7,14 @@
add_library(external_ranges INTERFACE IMPORTED GLOBAL) add_library(external_ranges INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_ranges ALIAS external_ranges) add_library(desktop-app::external_ranges ALIAS external_ranges)
target_include_directories(external_ranges SYSTEM if (DESKTOP_APP_USE_PACKAGED)
INTERFACE find_package(range-v3 REQUIRED)
${libs_loc}/range-v3/include else()
) target_include_directories(external_ranges SYSTEM
INTERFACE
${libs_loc}/range-v3/include
)
endif()
if (WIN32) if (WIN32)
target_compile_options(external_ranges target_compile_options(external_ranges

View file

@ -4,115 +4,123 @@
# 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
add_library(external_rlottie OBJECT) if (DESKTOP_APP_USE_PACKAGED_RLOTTIE)
add_library(desktop-app::external_rlottie ALIAS external_rlottie) add_library(external_rlottie INTERFACE IMPORTED GLOBAL)
init_target(external_rlottie "(external)") add_library(desktop-app::external_rlottie ALIAS external_rlottie)
get_filename_component(src_loc . REALPATH) find_package(rlottie REQUIRED)
set(rlottie_loc ${third_party_loc}/rlottie) target_link_libraries(external_rlottie INTERFACE rlottie::rlottie)
else()
add_library(external_rlottie OBJECT)
add_library(desktop-app::external_rlottie ALIAS external_rlottie)
init_target(external_rlottie "(external)")
target_sources(external_rlottie PRIVATE ${src_loc}/config/config.h) get_filename_component(src_loc . REALPATH)
nice_target_sources(external_rlottie ${rlottie_loc} set(rlottie_loc ${third_party_loc}/rlottie)
PRIVATE
inc/rlottie.h
inc/rlottie_capi.h
inc/rlottiecommon.h
src/lottie/lottieanimation.cpp target_sources(external_rlottie PRIVATE ${src_loc}/config/config.h)
src/lottie/lottieitem.cpp nice_target_sources(external_rlottie ${rlottie_loc}
src/lottie/lottieitem.h
src/lottie/lottiekeypath.cpp
src/lottie/lottiekeypath.h
src/lottie/lottieloader.cpp
src/lottie/lottieloader.h
src/lottie/lottiemodel.cpp
src/lottie/lottiemodel.h
src/lottie/lottieparser.cpp
src/lottie/lottieparser.h
src/lottie/lottieproxymodel.cpp
src/lottie/lottieproxymodel.h
src/vector/freetype/v_ft_math.cpp
src/vector/freetype/v_ft_math.h
src/vector/freetype/v_ft_raster.cpp
src/vector/freetype/v_ft_raster.h
src/vector/freetype/v_ft_stroker.cpp
src/vector/freetype/v_ft_stroker.h
src/vector/freetype/v_ft_types.h
# src/vector/pixman/pixman-arm-neon-asm.h
# src/vector/pixman/pixman-arm-neon-asm.S
src/vector/pixman/vregion.cpp
src/vector/pixman/vregion.h
src/vector/vbezier.cpp
src/vector/vbezier.h
src/vector/vbitmap.cpp
src/vector/vbitmap.h
src/vector/vbrush.cpp
src/vector/vbrush.h
src/vector/vcompositionfunctions.cpp
src/vector/vcowptr.h
src/vector/vdasher.cpp
src/vector/vdasher.h
src/vector/vdebug.cpp
src/vector/vdebug.h
src/vector/vdrawable.cpp
src/vector/vdrawable.h
src/vector/vdrawhelper.cpp
src/vector/vdrawhelper.h
src/vector/vdrawhelper_neon.cpp
src/vector/vdrawhelper_sse2.cpp
src/vector/velapsedtimer.cpp
src/vector/velapsedtimer.h
src/vector/vglobal.h
src/vector/vimageloader.cpp
src/vector/vimageloader.h
src/vector/vinterpolator.cpp
src/vector/vinterpolator.h
src/vector/vline.h
src/vector/vmatrix.cpp
src/vector/vmatrix.h
src/vector/vpainter.cpp
src/vector/vpainter.h
src/vector/vpath.cpp
src/vector/vpath.h
src/vector/vpathmesure.cpp
src/vector/vpathmesure.h
src/vector/vpoint.h
src/vector/vraster.cpp
src/vector/vraster.h
src/vector/vrect.cpp
src/vector/vrect.h
src/vector/vrle.cpp
src/vector/vrle.h
src/vector/vstackallocator.h
src/vector/vtaskqueue.h
)
target_compile_definitions(external_rlottie
PUBLIC
LOT_BUILD
PRIVATE
_USE_MATH_DEFINES
"RAPIDJSON_ASSERT=(void)"
)
target_include_directories(external_rlottie
PUBLIC
${rlottie_loc}/inc
PRIVATE
${src_loc}/config
${rlottie_loc}/src/lottie
${rlottie_loc}/src/vector
${rlottie_loc}/src/vector/pixman
${rlottie_loc}/src/vector/freetype
)
if (WIN32)
target_compile_options(external_rlottie
PRIVATE PRIVATE
/w44244 # 'initializing': conversion from 'double' to 'float' inc/rlottie.h
/w44251 # needs to have dll-interface to be used by clients of class inc/rlottie_capi.h
inc/rlottiecommon.h
src/lottie/lottieanimation.cpp
src/lottie/lottieitem.cpp
src/lottie/lottieitem.h
src/lottie/lottiekeypath.cpp
src/lottie/lottiekeypath.h
src/lottie/lottieloader.cpp
src/lottie/lottieloader.h
src/lottie/lottiemodel.cpp
src/lottie/lottiemodel.h
src/lottie/lottieparser.cpp
src/lottie/lottieparser.h
src/lottie/lottieproxymodel.cpp
src/lottie/lottieproxymodel.h
src/vector/freetype/v_ft_math.cpp
src/vector/freetype/v_ft_math.h
src/vector/freetype/v_ft_raster.cpp
src/vector/freetype/v_ft_raster.h
src/vector/freetype/v_ft_stroker.cpp
src/vector/freetype/v_ft_stroker.h
src/vector/freetype/v_ft_types.h
# src/vector/pixman/pixman-arm-neon-asm.h
# src/vector/pixman/pixman-arm-neon-asm.S
src/vector/pixman/vregion.cpp
src/vector/pixman/vregion.h
src/vector/vbezier.cpp
src/vector/vbezier.h
src/vector/vbitmap.cpp
src/vector/vbitmap.h
src/vector/vbrush.cpp
src/vector/vbrush.h
src/vector/vcompositionfunctions.cpp
src/vector/vcowptr.h
src/vector/vdasher.cpp
src/vector/vdasher.h
src/vector/vdebug.cpp
src/vector/vdebug.h
src/vector/vdrawable.cpp
src/vector/vdrawable.h
src/vector/vdrawhelper.cpp
src/vector/vdrawhelper.h
src/vector/vdrawhelper_neon.cpp
src/vector/vdrawhelper_sse2.cpp
src/vector/velapsedtimer.cpp
src/vector/velapsedtimer.h
src/vector/vglobal.h
src/vector/vimageloader.cpp
src/vector/vimageloader.h
src/vector/vinterpolator.cpp
src/vector/vinterpolator.h
src/vector/vline.h
src/vector/vmatrix.cpp
src/vector/vmatrix.h
src/vector/vpainter.cpp
src/vector/vpainter.h
src/vector/vpath.cpp
src/vector/vpath.h
src/vector/vpathmesure.cpp
src/vector/vpathmesure.h
src/vector/vpoint.h
src/vector/vraster.cpp
src/vector/vraster.h
src/vector/vrect.cpp
src/vector/vrect.h
src/vector/vrle.cpp
src/vector/vrle.h
src/vector/vstackallocator.h
src/vector/vtaskqueue.h
) )
target_compile_definitions(external_rlottie
PUBLIC
LOT_BUILD
PRIVATE
_USE_MATH_DEFINES
"RAPIDJSON_ASSERT=(void)"
)
target_include_directories(external_rlottie
PUBLIC
${rlottie_loc}/inc
PRIVATE
${src_loc}/config
${rlottie_loc}/src/lottie
${rlottie_loc}/src/vector
${rlottie_loc}/src/vector/pixman
${rlottie_loc}/src/vector/freetype
)
if (WIN32)
target_compile_options(external_rlottie
PRIVATE
/w44244 # 'initializing': conversion from 'double' to 'float'
/w44251 # needs to have dll-interface to be used by clients of class
)
endif()
endif() endif()

View file

@ -7,12 +7,20 @@
add_library(external_xxhash INTERFACE IMPORTED GLOBAL) add_library(external_xxhash INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_xxhash ALIAS external_xxhash) add_library(desktop-app::external_xxhash ALIAS external_xxhash)
target_include_directories(external_xxhash SYSTEM if (DESKTOP_APP_USE_PACKAGED)
INTERFACE find_library(XXHASH_LIBRARY xxhash)
${third_party_loc}/xxHash find_path(XXHASH_INCLUDE_DIRS xxhash.h)
)
target_compile_definitions(external_xxhash target_include_directories(external_xxhash INTERFACE ${XXHASH_INCLUDE_DIRS})
INTERFACE target_link_libraries(external_xxhash INTERFACE ${XXHASH_LIBRARY})
XXH_INLINE_ALL else()
) target_include_directories(external_xxhash SYSTEM
INTERFACE
${third_party_loc}/xxHash
)
target_compile_definitions(external_xxhash
INTERFACE
XXH_INLINE_ALL
)
endif()

View file

@ -7,7 +7,16 @@
add_library(external_zlib INTERFACE IMPORTED GLOBAL) add_library(external_zlib INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_zlib ALIAS external_zlib) add_library(desktop-app::external_zlib ALIAS external_zlib)
if (NOT WIN32) if (DESKTOP_APP_USE_PACKAGED)
add_library(external_minizip INTERFACE IMPORTED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(MINIZIP REQUIRED minizip)
target_include_directories(external_minizip INTERFACE ${MINIZIP_INCLUDE_DIRS})
target_link_libraries(external_minizip INTERFACE ${MINIZIP_LIBRARIES})
target_link_libraries(external_zlib INTERFACE external_minizip)
elseif (NOT WIN32)
add_library(external_minizip STATIC) add_library(external_minizip STATIC)
init_target(external_minizip "(external)") init_target(external_minizip "(external)")
@ -32,13 +41,18 @@ if (NOT WIN32)
target_link_libraries(external_zlib INTERFACE external_minizip) target_link_libraries(external_zlib INTERFACE external_minizip)
endif() endif()
target_include_directories(external_zlib SYSTEM if (NOT DESKTOP_APP_USE_PACKAGED)
INTERFACE target_include_directories(external_zlib SYSTEM
${libs_loc}/zlib INTERFACE
${libs_loc}/zlib/contrib/minizip ${libs_loc}/zlib
) ${libs_loc}/zlib/contrib/minizip
)
endif()
if (WIN32) if (DESKTOP_APP_USE_PACKAGED)
find_package(ZLIB REQUIRED)
target_link_libraries(external_zlib INTERFACE ZLIB::ZLIB)
elseif (WIN32)
target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI) target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI)
set(zlib_lib_loc ${libs_loc}/zlib/contrib/vstudio/vc14/x86/ZlibStat$<IF:$<CONFIG:Debug>,Debug,ReleaseWithoutAsm>) set(zlib_lib_loc ${libs_loc}/zlib/contrib/vstudio/vc14/x86/ZlibStat$<IF:$<CONFIG:Debug>,Debug,ReleaseWithoutAsm>)

View file

@ -26,8 +26,10 @@ function(init_target target_name) # init_target(my_target folder_name)
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif() endif()
target_link_libraries(${target_name} PUBLIC desktop-app::common_options) target_link_libraries(${target_name} PUBLIC desktop-app::common_options)
if (NOT DESKTOP_APP_USE_PACKAGED)
set_target_properties(${target_name} PROPERTIES LINK_SEARCH_START_STATIC 1)
endif()
set_target_properties(${target_name} PROPERTIES set_target_properties(${target_name} PROPERTIES
LINK_SEARCH_START_STATIC 1
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES

View file

@ -6,10 +6,9 @@
target_compile_options(common_options target_compile_options(common_options
INTERFACE INTERFACE
$<IF:$<CONFIG:Debug>,,-Ofast -fno-strict-aliasing> $<IF:$<CONFIG:Debug>,,-fno-strict-aliasing>
-pipe -pipe
-Wall -Wall
-Werror
-W -W
-fPIC -fPIC
-Wno-unused-variable -Wno-unused-variable
@ -26,14 +25,21 @@ INTERFACE
-Wno-maybe-uninitialized -Wno-maybe-uninitialized
-Wno-error=class-memaccess -Wno-error=class-memaccess
) )
target_link_options(common_options if (NOT DESKTOP_APP_USE_PACKAGED)
INTERFACE target_compile_options(common_options
$<IF:$<CONFIG:Debug>,,-Ofast> INTERFACE
) $<IF:$<CONFIG:Debug>,,-Ofast>
-Werror
)
target_link_options(common_options
INTERFACE
$<IF:$<CONFIG:Debug>,,-Ofast>
)
endif()
if (build_linux32) if (build_linux32)
target_compile_options(common_options INTERFACE -g0) target_compile_options(common_options INTERFACE -g0)
target_link_options(common_options INTERFACE -g0) target_link_options(common_options INTERFACE -g0)
else() elseif (NOT DESKTOP_APP_USE_PACKAGED)
target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto>) target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto>)
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>) target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>)
endif() endif()

View file

@ -10,6 +10,7 @@ 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_GLIBC_WRAPS "Use wraps for new GLIBC features." OFF)
option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ON) option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ON)
option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
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}'")
@ -74,9 +75,11 @@ else()
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
report_bad_special_target() report_bad_special_target()
endif() endif()
set(CMAKE_AR /usr/bin/gcc-ar) if (NOT DESKTOP_APP_USE_PACKAGED)
set(CMAKE_RANLIB /usr/bin/gcc-ranlib) set(CMAKE_AR /usr/bin/gcc-ar)
set(CMAKE_NM /usr/bin/gcc-nm) set(CMAKE_RANLIB /usr/bin/gcc-ranlib)
set(CMAKE_NM /usr/bin/gcc-nm)
endif()
endif() endif()
if (NOT APPLE OR build_osx) if (NOT APPLE OR build_osx)