1
0
Fork 0

Updated cmake helpers to latest patches-track-wip

This commit is contained in:
Eric Kotato 2024-07-01 17:50:15 +03:00
commit 342cd3af3b
81 changed files with 1728 additions and 2114 deletions

6
.gitmodules vendored Normal file
View file

@ -0,0 +1,6 @@
[submodule "external/glib/cppgir"]
path = external/glib/cppgir
url = https://gitlab.com/mnauw/cppgir.git
[submodule "external/Implib.so"]
path = external/Implib.so
url = https://github.com/yugr/Implib.so.git

View file

@ -5,17 +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)
if (LINUX)
add_subdirectory(linux_jemalloc_helper)
endif()
if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED)
add_subdirectory(linux_xcb_helper)
endif()
if (LINUX
AND NOT DESKTOP_APP_USE_PACKAGED
AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
add_subdirectory(linux_wayland_helper)
endif()
if (DESKTOP_APP_USE_ALLOCATION_TRACER) if (DESKTOP_APP_USE_ALLOCATION_TRACER)
add_subdirectory(linux_allocation_tracer) add_subdirectory(linux_allocation_tracer)
endif() endif()

View file

@ -13,19 +13,20 @@ endmacro()
add_checked_subdirectory(angle) add_checked_subdirectory(angle)
add_checked_subdirectory(auto_updates) add_checked_subdirectory(auto_updates)
add_checked_subdirectory(boost)
if (add_cld3_library)
add_checked_subdirectory(cld3)
endif()
add_checked_subdirectory(crash_reports) add_checked_subdirectory(crash_reports)
if (LINUX) if (LINUX)
add_checked_subdirectory(dispatch) add_checked_subdirectory(dispatch)
endif() endif()
add_checked_subdirectory(expected) add_checked_subdirectory(expected)
if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) if (LINUX AND TARGET Qt::DBus AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
add_checked_subdirectory(fcitx_qt5) add_checked_subdirectory(fcitx5_qt)
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
add_checked_subdirectory(fcitx5_qt)
endif()
endif() endif()
add_checked_subdirectory(ffmpeg) add_checked_subdirectory(ffmpeg)
if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) if (LINUX)
add_checked_subdirectory(glib) add_checked_subdirectory(glib)
add_checked_subdirectory(glibmm) add_checked_subdirectory(glibmm)
endif() endif()
@ -37,13 +38,9 @@ if (add_hunspell_library)
add_checked_subdirectory(hunspell) add_checked_subdirectory(hunspell)
endif() endif()
add_checked_subdirectory(iconv) add_checked_subdirectory(iconv)
if (LINUX)
add_checked_subdirectory(jemalloc)
endif()
add_checked_subdirectory(jpeg) add_checked_subdirectory(jpeg)
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) add_checked_subdirectory(kcoreaddons)
add_checked_subdirectory(kwayland) add_checked_subdirectory(kimageformats)
endif()
add_checked_subdirectory(lz4) add_checked_subdirectory(lz4)
add_checked_subdirectory(minizip) add_checked_subdirectory(minizip)
if (LINUX) if (LINUX)
@ -57,9 +54,15 @@ add_checked_subdirectory(qr_code_generator)
add_checked_subdirectory(ranges) add_checked_subdirectory(ranges)
add_checked_subdirectory(rlottie) add_checked_subdirectory(rlottie)
add_checked_subdirectory(rnnoise) add_checked_subdirectory(rnnoise)
if (LINUX AND NOT DESKTOP_APP_DISABLE_SCUDO)
add_checked_subdirectory(scudo)
endif()
add_checked_subdirectory(ton) add_checked_subdirectory(ton)
add_checked_subdirectory(variant) add_checked_subdirectory(variant)
add_checked_subdirectory(vpx) add_checked_subdirectory(vpx)
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
add_checked_subdirectory(wayland_client)
endif()
add_checked_subdirectory(webrtc) add_checked_subdirectory(webrtc)
if (LINUX AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) if (LINUX AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
add_checked_subdirectory(xcb) add_checked_subdirectory(xcb)

1
external/Implib.so vendored Submodule

@ -0,0 +1 @@
Subproject commit 0ddaa715d2572b100f8248c0fa4450fbf895be14

25
external/boost/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,25 @@
# 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_boost_regex INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_boost_regex ALIAS external_boost_regex)
target_compile_definitions(external_boost_regex
INTERFACE
BOOST_NO_INTRINSIC_WCHAR_T
BOOST_REGEX_NO_W32
)
if (DESKTOP_APP_USE_PACKAGED OR LINUX)
find_package(Boost COMPONENTS regex REQUIRED)
target_link_libraries(external_boost_regex INTERFACE Boost::regex)
return()
endif()
target_include_directories(external_boost_regex SYSTEM
INTERFACE
${libs_loc}/regex/include
)

112
external/cld3/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,112 @@
# 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_cld3 INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_cld3 ALIAS external_cld3)
add_library(external_cld3_bundled STATIC)
init_target(external_cld3_bundled "(external)")
set(cld3_loc ${third_party_loc}/cld3)
set(cld3_src ${cld3_loc}/src)
set(gen_loc ${cld3_loc}/build/gen)
set(gen_dst ${gen_loc}/cld_3/protos)
if (DESKTOP_APP_USE_PACKAGED)
find_package(Protobuf)
if (NOT Protobuf_FOUND)
find_package(protobuf REQUIRED CONFIG)
endif()
set(protoc_executable protobuf::protoc)
set(protobuf_lib protobuf::libprotobuf-lite)
elseif (WIN32)
set(build_loc ${libs_loc}/protobuf/build/$<IF:$<CONFIG:Debug>,Debug,Release>)
set(protoc_executable ${build_loc}/protoc.exe)
set(protobuf_lib ${build_loc}/libprotobuf-lite.lib)
else()
set(protoc_executable ${libs_loc}/protobuf/build/protoc)
set(protobuf_lib ${libs_loc}/protobuf/build/libprotobuf-lite.a)
if (LINUX)
target_compile_options(external_cld3_bundled PRIVATE -Wno-implicit-fallthrough)
endif()
endif()
if (PROTOBUF_PROTOC_EXECUTABLE)
set(protoc_executable ${PROTOBUF_PROTOC_EXECUTABLE})
endif()
include(generate_protobuf.cmake)
function(generate protobuf_name)
generate_single_protobuf(
external_cld3_bundled
${gen_dst}
${protobuf_name}
${protoc_executable})
endfunction()
generate(feature_extractor.proto)
generate(sentence.proto)
generate(task_spec.proto)
nice_target_sources(external_cld3_bundled ${cld3_src}
PRIVATE
feature_extractor.proto
sentence.proto
task_spec.proto
base.cc
embedding_feature_extractor.cc
embedding_network.cc
feature_extractor.cc
feature_extractor.h
feature_types.cc
fml_parser.cc
language_identifier_features.cc
lang_id_nn_params.cc
nnet_language_identifier.cc
registry.cc
relevant_script_feature.cc
sentence_features.cc
task_context.cc
task_context_params.cc
unicodetext.cc
utils.cc
workspace.cc
script_span/generated_entities.cc
script_span/getonescriptspan.cc
script_span/getonescriptspan.h
script_span/utf8statetable.cc
script_span/offsetmap.cc
script_span/text_processing.cc
script_span/text_processing.h
script_span/fixunicodevalue.cc
)
target_include_directories(external_cld3_bundled
PUBLIC
${cld3_src}
${gen_loc}
)
if (NOT DESKTOP_APP_USE_PACKAGED)
target_include_directories(external_cld3_bundled
PUBLIC
${libs_loc}/protobuf/src
${libs_loc}/protobuf/third_party/abseil-cpp
)
endif()
target_link_libraries(external_cld3_bundled
PRIVATE
${protobuf_lib}
)
target_link_libraries(external_cld3
INTERFACE
external_cld3_bundled
)

58
external/cld3/generate_protobuf.cmake vendored Normal file
View file

@ -0,0 +1,58 @@
function(generate_single_protobuf target_name gen_dst protobuf_name executable)
file(MAKE_DIRECTORY ${gen_dst})
# Copied from myprotobuf.cmake.
if (PROTOBUF_GENERATE_CPP_APPEND_PATH)
# Create an include path for each file specified
set(FIL ${cld3_src}/${protobuf_name})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(ABS_PATH ${ABS_FIL} PATH)
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
if (${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
else()
set(_protobuf_include_path -I ${cld3_src})
endif()
if (DEFINED PROTOBUF_IMPORT_DIRS)
foreach (DIR ${PROTOBUF_IMPORT_DIRS})
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
if (${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
endforeach()
endif()
#
get_filename_component(protobuf_name_we ${protobuf_name} NAME_WE)
set(gen_timestamp ${gen_dst}/${protobuf_name}.timestamp)
set(gen_files
${gen_dst}/${protobuf_name_we}.pb.cc
${gen_dst}/${protobuf_name_we}.pb.h
)
set(gen_src ${cld3_src}/${protobuf_name})
add_custom_command(
OUTPUT
${gen_timestamp}
BYPRODUCTS
${gen_files}
COMMAND
${executable}
--cpp_out
${gen_dst}
${_protobuf_include_path}
${gen_src}
COMMAND
echo 1> ${gen_timestamp}
COMMENT "Generating protobuf ${protobuf_name} (${target_name})"
DEPENDS
${executable}
${gen_src}
VERBATIM
)
generate_target(${target_name} ${protobuf_name} ${gen_timestamp} "${gen_files}" ${gen_dst})
endfunction()

View file

@ -7,10 +7,19 @@
add_library(external_breakpad INTERFACE IMPORTED GLOBAL) add_library(external_breakpad INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_breakpad ALIAS external_breakpad) add_library(desktop-app::external_breakpad ALIAS external_breakpad)
target_include_directories(external_breakpad SYSTEM if (LINUX)
INTERFACE find_package(PkgConfig REQUIRED)
${libs_loc}/breakpad/src pkg_check_modules(BREAKPAD REQUIRED breakpad)
) target_include_directories(external_breakpad SYSTEM
INTERFACE
${BREAKPAD_INCLUDE_DIRS}
)
else()
target_include_directories(external_breakpad SYSTEM
INTERFACE
${libs_loc}/breakpad/src
)
endif()
if (build_win64) if (build_win64)
set(breakpad_config_add _x64) set(breakpad_config_add _x64)

View file

@ -9,24 +9,37 @@ set(dispatch_prefix ${CMAKE_CURRENT_BINARY_DIR}/dispatch-prefix)
set(dispatch_binary_dir ${dispatch_prefix}/src/dispatch-build) set(dispatch_binary_dir ${dispatch_prefix}/src/dispatch-build)
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
find_library(DISPATCH_LIBRARIES dispatch) find_library(DESKTOP_APP_DISPATCH_LIBRARIES dispatch)
find_path(DISPATCH_INCLUDE_DIRS dispatch/dispatch.h) find_path(DESKTOP_APP_DISPATCH_INCLUDE_DIRS dispatch/dispatch.h)
endif() endif()
if (NOT DISPATCH_LIBRARIES OR NOT DISPATCH_INCLUDE_DIRS) if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS)
if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET)
set(dispatch_extra_args
-DCMAKE_BUILD_TYPE=Release
"-DCMAKE_C_FLAGS=-g -pipe -fPIC -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS"
"-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS"
)
elseif (DEFINED CMAKE_BUILD_TYPE)
set(dispatch_extra_args
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
else()
set(dispatch_extra_args)
endif()
execute_process( execute_process(
COMMAND ${CMAKE_COMMAND} ${dispatch_loc} COMMAND ${CMAKE_COMMAND} ${dispatch_loc}
-B ${dispatch_binary_dir} -B ${dispatch_binary_dir}
-GNinja -GNinja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=clang -DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER=clang++
-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF -DBUILD_TESTING=OFF
${dispatch_extra_args}
) )
execute_process( execute_process(
COMMAND ${CMAKE_COMMAND} --build ${dispatch_binary_dir} COMMAND ${CMAKE_COMMAND} --build ${dispatch_binary_dir} --parallel
) )
if (NOT EXISTS ${dispatch_binary_dir}/src/libdispatch.a) if (NOT EXISTS ${dispatch_binary_dir}/src/libdispatch.a)
@ -41,9 +54,9 @@ endif()
add_library(external_dispatch INTERFACE IMPORTED GLOBAL) add_library(external_dispatch INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_dispatch ALIAS external_dispatch) add_library(desktop-app::external_dispatch ALIAS external_dispatch)
if (DESKTOP_APP_USE_PACKAGED AND DISPATCH_LIBRARIES AND DISPATCH_INCLUDE_DIRS) if (DESKTOP_APP_USE_PACKAGED AND DESKTOP_APP_DISPATCH_LIBRARIES AND DESKTOP_APP_DISPATCH_INCLUDE_DIRS)
target_include_directories(external_dispatch SYSTEM INTERFACE ${DISPATCH_INCLUDE_DIRS}) target_include_directories(external_dispatch SYSTEM INTERFACE ${DESKTOP_APP_DISPATCH_INCLUDE_DIRS})
target_link_libraries(external_dispatch INTERFACE ${DISPATCH_LIBRARIES}) target_link_libraries(external_dispatch INTERFACE ${DESKTOP_APP_DISPATCH_LIBRARIES})
return() return()
endif() endif()

View file

@ -15,31 +15,26 @@ add_library(desktop-app::external_fcitx5_qt ALIAS external_fcitx5_qt)
init_target(external_fcitx5_qt "(external)") init_target(external_fcitx5_qt "(external)")
set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt) set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt)
set(fcitx5_qt_src ${fcitx5_qt_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext)
if (DESKTOP_APP_QT6)
set(fcitx5_qt_src ${fcitx5_qt_loc}/qt6/platforminputcontext)
else()
set(fcitx5_qt_src ${fcitx5_qt_loc}/qt5/platforminputcontext)
endif()
set_target_properties(external_fcitx5_qt PROPERTIES AUTOMOC ON) set_target_properties(external_fcitx5_qt PROPERTIES AUTOMOC ON)
set(FCITX5_QT_EXTRA_PLUGIN_NAME "") set(FCITX5_QT_EXTRA_PLUGIN_NAME "\"fcitx\",")
configure_file("${fcitx5_qt_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json") configure_file("${fcitx5_qt_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json")
nice_target_sources(external_fcitx5_qt ${fcitx5_qt_src} nice_target_sources(external_fcitx5_qt ${fcitx5_qt_src}
PRIVATE PRIVATE
fcitx4watcher.cpp
fcitx4inputcontextproxy.cpp
fcitx4inputcontextproxyimpl.cpp
fcitx4inputmethodproxy.cpp
hybridinputcontext.cpp
qfcitxplatforminputcontext.cpp qfcitxplatforminputcontext.cpp
qfcitxplatforminputcontext.h
fcitxcandidatewindow.cpp fcitxcandidatewindow.cpp
fcitxcandidatewindow.h
fcitxtheme.cpp fcitxtheme.cpp
fcitxtheme.h
font.cpp font.cpp
font.h
qtkey.cpp qtkey.cpp
main.cpp main.cpp
main.h
) )
target_include_directories(external_fcitx5_qt target_include_directories(external_fcitx5_qt
@ -84,3 +79,23 @@ else()
xkbcommon xkbcommon
) )
endif() endif()
add_library(external_fcitx5_qt_init OBJECT)
add_library(desktop-app::external_fcitx5_qt_init ALIAS external_fcitx5_qt_init)
init_target(external_fcitx5_qt_init "(external)")
nice_target_sources(external_fcitx5_qt_init ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
init.cpp
)
target_link_libraries(external_fcitx5_qt_init
PRIVATE
desktop-app::external_qt
)
target_link_libraries(external_fcitx5_qt
INTERFACE
external_fcitx5_qt_init
$<TARGET_OBJECTS:external_fcitx5_qt_init>
)

View file

@ -15,12 +15,7 @@ add_library(desktop-app::external_fcitx5_qt_dbusaddons ALIAS external_fcitx5_qt_
init_target(external_fcitx5_qt_dbusaddons "(external)") init_target(external_fcitx5_qt_dbusaddons "(external)")
set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt) set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt)
set(fcitx5_qt_dbusaddons_src ${fcitx5_qt_loc}/qt${QT_VERSION_MAJOR}/dbusaddons)
if (DESKTOP_APP_QT6)
set(fcitx5_qt_dbusaddons_src ${fcitx5_qt_loc}/qt6/dbusaddons)
else()
set(fcitx5_qt_dbusaddons_src ${fcitx5_qt_loc}/qt5/dbusaddons)
endif()
set_target_properties(external_fcitx5_qt_dbusaddons PROPERTIES AUTOMOC ON) set_target_properties(external_fcitx5_qt_dbusaddons PROPERTIES AUTOMOC ON)
@ -40,12 +35,7 @@ PRIVATE
) )
include(GenerateExportHeader) include(GenerateExportHeader)
generate_export_header(external_fcitx5_qt_dbusaddons BASE_NAME Fcitx5Qt${QT_VERSION_MAJOR}DBusAddons)
if (DESKTOP_APP_QT6)
generate_export_header(external_fcitx5_qt_dbusaddons BASE_NAME Fcitx5Qt6DBusAddons)
else()
generate_export_header(external_fcitx5_qt_dbusaddons BASE_NAME Fcitx5Qt5DBusAddons)
endif()
target_include_directories(external_fcitx5_qt_dbusaddons target_include_directories(external_fcitx5_qt_dbusaddons
PUBLIC PUBLIC
@ -53,7 +43,7 @@ PUBLIC
"${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
) )
if (NOT DESKTOP_APP_QT6) if (QT_VERSION_MAJOR EQUAL 5)
target_compile_definitions(external_fcitx5_qt_dbusaddons target_compile_definitions(external_fcitx5_qt_dbusaddons
PRIVATE PRIVATE
FCITX5QT5DBUSADDONS_STATIC_DEFINE FCITX5QT5DBUSADDONS_STATIC_DEFINE

10
external/fcitx5_qt/init.cpp vendored Normal file
View file

@ -0,0 +1,10 @@
/*
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
*/
#include <QtCore/QtPlugin>
Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin)

View file

@ -1,89 +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
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
add_library(external_fcitx_qt5 INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_fcitx_qt5 ALIAS external_fcitx_qt5)
return()
endif()
add_library(external_fcitx_qt5 STATIC)
add_library(desktop-app::external_fcitx_qt5 ALIAS external_fcitx_qt5)
init_target(external_fcitx_qt5 "(external)")
set(fcitx_qt5_loc ${third_party_loc}/fcitx-qt5)
if (DESKTOP_APP_QT6)
set(fcitx_qt5_src ${fcitx_qt5_loc}/qt6/platforminputcontext)
else()
set(fcitx_qt5_src ${fcitx_qt5_loc}/qt5/platforminputcontext)
endif()
set_target_properties(external_fcitx_qt5 PROPERTIES AUTOMOC ON)
nice_target_sources(external_fcitx_qt5 ${fcitx_qt5_src}
PRIVATE
fcitxinputcontextproxy.cpp
fcitxqtdbustypes.cpp
fcitxwatcher.cpp
qfcitxplatforminputcontext.cpp
main.cpp
qtkey.cpp
)
set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml PROPERTIES
INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h)
set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext1.xml PROPERTIES
INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h)
set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod.xml PROPERTIES
INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h)
set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml PROPERTIES
INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h)
if (DESKTOP_APP_QT6)
qt6_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml inputcontextproxy)
qt6_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext1.xml inputcontext1proxy)
qt6_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod.xml inputmethodproxy)
qt6_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml inputmethod1proxy)
else()
qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml inputcontextproxy)
qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext1.xml inputcontext1proxy)
qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod.xml inputmethodproxy)
qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml inputmethod1proxy)
endif()
target_sources(external_fcitx_qt5 PRIVATE ${fcitx_qt5_adaptors})
target_include_directories(external_fcitx_qt5
PRIVATE
${fcitx_qt5_src}
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_compile_definitions(external_fcitx_qt5
PRIVATE
QT_STATICPLUGIN
)
target_link_libraries(external_fcitx_qt5
PRIVATE
desktop-app::external_qt
)
if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(XKBCOMMON REQUIRED IMPORTED_TARGET xkbcommon)
target_link_libraries(external_fcitx_qt5
PRIVATE
PkgConfig::XKBCOMMON
)
else()
target_link_static_libraries(external_fcitx_qt5
PRIVATE
xkbcommon
)
endif()

View file

@ -10,43 +10,111 @@ add_library(desktop-app::external_ffmpeg ALIAS external_ffmpeg)
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec) pkg_check_modules(AVFILTER REQUIRED IMPORTED_TARGET libavfilter)
pkg_check_modules(AVFORMAT REQUIRED IMPORTED_TARGET libavformat) pkg_check_modules(AVFORMAT REQUIRED IMPORTED_TARGET libavformat)
pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec)
pkg_check_modules(AVUTIL REQUIRED IMPORTED_TARGET libavutil) pkg_check_modules(AVUTIL REQUIRED IMPORTED_TARGET libavutil)
pkg_check_modules(SWSCALE REQUIRED IMPORTED_TARGET libswscale) pkg_check_modules(SWSCALE REQUIRED IMPORTED_TARGET libswscale)
pkg_check_modules(SWRESAMPLE REQUIRED IMPORTED_TARGET libswresample) pkg_check_modules(SWRESAMPLE REQUIRED IMPORTED_TARGET libswresample)
target_link_libraries(external_ffmpeg target_link_libraries(external_ffmpeg
INTERFACE INTERFACE
PkgConfig::AVCODEC PkgConfig::AVFILTER
PkgConfig::AVFORMAT PkgConfig::AVFORMAT
PkgConfig::AVCODEC
PkgConfig::AVUTIL PkgConfig::AVUTIL
PkgConfig::SWSCALE PkgConfig::SWSCALE
PkgConfig::SWRESAMPLE PkgConfig::SWRESAMPLE
) )
else()
target_include_directories(external_ffmpeg SYSTEM
INTERFACE
${libs_loc}/ffmpeg
)
return()
endif()
set(ffmpeg_lib_list)
if (LINUX)
list(APPEND ffmpeg_lib_list
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
)
else()
set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) set(ffmpeg_lib_loc ${libs_loc}/ffmpeg)
target_link_libraries(external_ffmpeg target_include_directories(external_ffmpeg SYSTEM
INTERFACE INTERFACE
${ffmpeg_lib_loc}
)
list(APPEND ffmpeg_lib_list
${ffmpeg_lib_loc}/libavfilter/libavfilter.a
${ffmpeg_lib_loc}/libavformat/libavformat.a ${ffmpeg_lib_loc}/libavformat/libavformat.a
${ffmpeg_lib_loc}/libavcodec/libavcodec.a ${ffmpeg_lib_loc}/libavcodec/libavcodec.a
${ffmpeg_lib_loc}/libswresample/libswresample.a ${ffmpeg_lib_loc}/libswresample/libswresample.a
${ffmpeg_lib_loc}/libswscale/libswscale.a ${ffmpeg_lib_loc}/libswscale/libswscale.a
${ffmpeg_lib_loc}/libavutil/libavutil.a ${ffmpeg_lib_loc}/libavutil/libavutil.a
$<LINK_ONLY:desktop-app::external_opus>
$<TARGET_FILE:desktop-app::external_opus>
$<LINK_ONLY:desktop-app::external_vpx>
$<TARGET_FILE:desktop-app::external_vpx>
) )
if (APPLE)
target_link_libraries(external_ffmpeg INTERFACE bz2)
elseif (LINUX)
target_link_static_libraries(external_ffmpeg INTERFACE lzma)
endif()
endif() endif()
list(APPEND ffmpeg_lib_list
$<TARGET_FILE:desktop-app::external_opus>
$<TARGET_FILE:desktop-app::external_vpx>
)
if (WIN32)
list(APPEND ffmpeg_lib_list
${libs_loc}/dav1d/builddir-$<IF:$<CONFIG:Debug>,debug,release>/src/libdav1d.a
)
elseif (APPLE)
list(APPEND ffmpeg_lib_list
bz2
)
elseif (LINUX)
list(APPEND ffmpeg_lib_list
-ldav1d
-llzma
$<TARGET_FILE:implib_vdpau>
$<TARGET_FILE:implib_va_x11>
$<TARGET_FILE:implib_va_drm>
$<TARGET_FILE:implib_va>
$<TARGET_FILE:implib_drm>
-lXv
-lXext
)
endif()
# Workaround cmake's random order on Linux...
if (LINUX)
generate_implib(
vdpau
va-x11
va-drm
va
drm
)
list(JOIN ffmpeg_lib_list , ffmpeg_lib_link)
target_link_libraries(external_ffmpeg
INTERFACE
-Wl,--push-state,-Bstatic,${ffmpeg_lib_link},--pop-state
$<LINK_ONLY:implib_vdpau>
$<LINK_ONLY:implib_va_x11>
$<LINK_ONLY:implib_va_drm>
$<LINK_ONLY:implib_va>
$<LINK_ONLY:implib_drm>
X11
)
else()
target_link_libraries(external_ffmpeg
INTERFACE
${ffmpeg_lib_list}
)
endif()
target_link_libraries(external_ffmpeg
INTERFACE
$<LINK_ONLY:desktop-app::external_opus>
$<LINK_ONLY:desktop-app::external_vpx>
)

View file

@ -7,33 +7,27 @@
add_library(external_glib INTERFACE IMPORTED GLOBAL) add_library(external_glib INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_glib ALIAS external_glib) add_library(desktop-app::external_glib ALIAS external_glib)
function(add_cppgir) # isolate scope
set(BUILD_TESTING OFF)
set(BUILD_DOC OFF)
set(BUILD_EXAMPLES OFF)
add_subdirectory(cppgir EXCLUDE_FROM_ALL)
endfunction()
add_cppgir()
include(generate_cppgir.cmake)
generate_cppgir(external_glib Gio-2.0)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0)
pkg_check_modules(GOBJECT REQUIRED IMPORTED_TARGET gobject-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
pkg_check_modules(GIO_UNIX REQUIRED IMPORTED_TARGET gio-unix-2.0)
if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(external_glib
target_link_libraries(external_glib INTERFACE
INTERFACE PkgConfig::GLIB2
PkgConfig::GIO_UNIX )
PkgConfig::GIO
PkgConfig::GOBJECT
PkgConfig::GLIB2
)
else()
target_include_directories(external_glib SYSTEM
INTERFACE
${GIO_UNIX_INCLUDE_DIRS}
${GIO_INCLUDE_DIRS}
${GOBJECT_INCLUDE_DIRS}
${GLIB2_INCLUDE_DIRS}
)
target_link_libraries(external_glib target_compile_definitions(external_glib
INTERFACE INTERFACE
gio-2.0 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56
gobject-2.0 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_56
glib-2.0 )
)
endif()

1
external/glib/cppgir vendored Submodule

@ -0,0 +1 @@
Subproject commit 83d94749d94fdb9b9e97a3e942f73a587a6ef253

59
external/glib/generate_cppgir.cmake vendored Normal file
View file

@ -0,0 +1,59 @@
# 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(generate_cppgir target_name gir)
set(cppgir_loc ${cmake_helpers_loc}/external/glib/cppgir)
# cppgir generates all the dependent headers everytime, better to have a global folder
set(gen_dst ${CMAKE_BINARY_DIR}/gen)
file(MAKE_DIRECTORY ${gen_dst})
set(gen_timestamp ${gen_dst}/${target_name}_cppgir.timestamp)
set(ignore_files
${cppgir_loc}/data/cppgir.ignore
${cppgir_loc}/data/cppgir_unix.ignore
)
set(gir_path)
if (IS_ABSOLUTE "${gir}")
set(gir_path ${gir})
endif()
add_custom_command(
OUTPUT
${gen_timestamp}
COMMAND
CppGir::cppgir
--debug
1
--class
--class-full
--expected
--ignore
"$<JOIN:${ignore_files},:>"
--output
${gen_dst}
${gir}
COMMAND
echo 1> ${gen_timestamp}
COMMENT "Generating C++ wrapper for ${gir} (${target_name})"
DEPENDS
CppGir::cppgir
${ignore_files}
${gir_path}
)
generate_target(${target_name} cppgir ${gen_timestamp} "" ${gen_dst})
get_target_property(target_type ${target_name} TYPE)
if (${target_type} STREQUAL "INTERFACE_LIBRARY")
target_link_libraries(${target_name} INTERFACE CppGir::gi)
target_compile_definitions(${target_name} INTERFACE GI_INLINE)
else()
target_link_libraries(${target_name} PUBLIC CppGir::gi)
target_compile_definitions(${target_name} PUBLIC GI_INLINE)
endif()
endfunction()

64
external/glib/generate_dbus.cmake vendored Normal file
View file

@ -0,0 +1,64 @@
# 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
include(${cmake_helpers_loc}/external/glib/generate_gir.cmake)
include(${cmake_helpers_loc}/external/glib/generate_cppgir.cmake)
function(generate_dbus target_name interface_prefix namespace interface_file)
find_program(DESKTOP_APP_GDBUSCODEGEN gdbus-codegen REQUIRED)
set(gen_loc ${CMAKE_CURRENT_BINARY_DIR}/gen)
set(gen_dst ${gen_loc}/dbus)
file(MAKE_DIRECTORY ${gen_dst})
set(gen_timestamp ${gen_dst}/${target_name}_${namespace}_dbus.timestamp)
set(gen_files
${gen_dst}/${target_name}_${namespace}_dbus.c
${gen_dst}/${target_name}_${namespace}_dbus.h
)
add_custom_command(
OUTPUT
${gen_timestamp}
BYPRODUCTS
${gen_files}
COMMAND
${DESKTOP_APP_GDBUSCODEGEN}
--interface-prefix
${interface_prefix}
--generate-c-code
${gen_dst}/${target_name}_${namespace}_dbus
--c-namespace
${namespace}
--c-generate-object-manager
${interface_file}
COMMAND
echo 1> ${gen_timestamp}
COMMENT "Generating D-Bus C code for ${namespace} (${target_name})"
DEPENDS
${DESKTOP_APP_GDBUSCODEGEN}
${interface_file}
)
add_library(${target_name}_${namespace}_dbus STATIC)
init_target(${target_name}_${namespace}_dbus "(gen)")
target_link_libraries(${target_name}_${namespace}_dbus PUBLIC desktop-app::external_glib)
generate_target(${target_name}_${namespace}_dbus timestamp ${gen_timestamp} "${gen_files}" ${gen_loc})
add_library(${target_name}_${namespace} INTERFACE)
init_target_folder(${target_name}_${namespace} "(gen)")
target_link_libraries(${target_name}_${namespace} INTERFACE ${target_name}_${namespace}_dbus)
generate_gir(${target_name}_${namespace} ${namespace} Gio-2.0 ${target_name}_${namespace}_dbus)
generate_cppgir(${target_name}_${namespace} ${CMAKE_CURRENT_BINARY_DIR}/gen/${target_name}_${namespace}.gir)
add_dependencies(${target_name}_${namespace}_cppgir ${target_name}_${namespace}_gir)
get_target_property(target_type ${target_name} TYPE)
if (${target_type} STREQUAL "INTERFACE_LIBRARY")
target_link_libraries(${target_name} INTERFACE ${target_name}_${namespace})
else()
target_link_libraries(${target_name} PUBLIC ${target_name}_${namespace})
endif()
endfunction()

46
external/glib/generate_gir.cmake vendored Normal file
View file

@ -0,0 +1,46 @@
# 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(generate_gir target_name namespace deps src_target_name)
find_program(DESKTOP_APP_GIRSCANNER g-ir-scanner REQUIRED)
set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen)
file(MAKE_DIRECTORY ${gen_dst})
set(gen_timestamp ${gen_dst}/${target_name}_gir.timestamp)
set(gen_file ${gen_dst}/${target_name}.gir)
add_custom_command(
OUTPUT
${gen_timestamp}
BYPRODUCTS
${gen_file}
COMMAND
${DESKTOP_APP_GIRSCANNER}
--quiet
-n
${namespace}
--nsversion
1.0
-l
$<TARGET_FILE:${src_target_name}>
--c-include
"$<JOIN:$<FILTER:$<TARGET_PROPERTY:${src_target_name},SOURCES>,INCLUDE,\\.h$>,$<SEMICOLON>--c-include>"
-i
"$<JOIN:${deps},$<SEMICOLON>-i>"
-o
${gen_file}
"$<TARGET_PROPERTY:${src_target_name},SOURCES>"
COMMAND
echo 1> ${gen_timestamp}
COMMAND_EXPAND_LISTS
COMMENT "Generating GIR (${target_name})"
DEPENDS
${DESKTOP_APP_GIRSCANNER}
${src_target_name}
)
generate_target(${target_name} gir ${gen_timestamp} "${gen_file}" ${gen_dst})
endfunction()

View file

@ -8,8 +8,8 @@ add_library(external_glibmm INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_glibmm ALIAS external_glibmm) add_library(desktop-app::external_glibmm ALIAS external_glibmm)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.4) pkg_check_modules(GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.68>=2.77)
pkg_check_modules(GIOMM REQUIRED IMPORTED_TARGET giomm-2.4) pkg_check_modules(GIOMM REQUIRED IMPORTED_TARGET giomm-2.68>=2.77)
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
target_link_libraries(external_glibmm target_link_libraries(external_glibmm
@ -26,9 +26,9 @@ else()
target_link_static_libraries(external_glibmm target_link_static_libraries(external_glibmm
INTERFACE INTERFACE
giomm-2.4 giomm-2.68
glibmm-2.4 glibmm-2.68
sigc-2.0 sigc-3.0
) )
target_link_libraries(external_glibmm target_link_libraries(external_glibmm

View file

@ -7,11 +7,12 @@
add_library(external_gsl INTERFACE IMPORTED GLOBAL) add_library(external_gsl INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_gsl ALIAS external_gsl) add_library(desktop-app::external_gsl ALIAS external_gsl)
#[[
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
if (DESKTOP_APP_USE_PACKAGED_LAZY) if (DESKTOP_APP_USE_PACKAGED_LAZY)
find_package(Microsoft.GSL QUIET) find_package(Microsoft.GSL 4.0.0 QUIET)
else() else()
find_package(Microsoft.GSL) find_package(Microsoft.GSL 4.0.0)
endif() endif()
if (Microsoft.GSL_FOUND) if (Microsoft.GSL_FOUND)
@ -19,6 +20,12 @@ if (DESKTOP_APP_USE_PACKAGED)
return() return()
endif() endif()
endif() endif()
]]
# https://gitlab.kitware.com/cmake/cmake/-/issues/25222
if (NOT EXISTS ${third_party_loc}/GSL/include)
message(FATAL_ERROR "Guidelines Support Library is not found")
endif()
target_include_directories(external_gsl SYSTEM target_include_directories(external_gsl SYSTEM
INTERFACE INTERFACE

View file

@ -43,3 +43,23 @@ PRIVATE
desktop-app::external_hime_im_client desktop-app::external_hime_im_client
desktop-app::external_qt desktop-app::external_qt
) )
add_library(external_hime_qt_init OBJECT)
add_library(desktop-app::external_hime_qt_init ALIAS external_hime_qt_init)
init_target(external_hime_qt_init "(external)")
nice_target_sources(external_hime_qt_init ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
init.cpp
)
target_link_libraries(external_hime_qt_init
PRIVATE
desktop-app::external_qt
)
target_link_libraries(external_hime_qt
INTERFACE
external_hime_qt_init
$<TARGET_OBJECTS:external_hime_qt_init>
)

View file

@ -27,6 +27,11 @@ PUBLIC
${hime_im_client_src} ${hime_im_client_src}
) )
target_link_libraries(external_hime_im_client
PRIVATE
desktop-app::lib_base
)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(X11 REQUIRED x11) pkg_check_modules(X11 REQUIRED x11)

View file

@ -4,13 +4,10 @@
// 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
// //
#include <dlfcn.h> #include "base/platform/linux/base_linux_library.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <hime-im-client.h> #include <hime-im-client.h>
#include <memory>
#include <iostream>
#define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func)
namespace HimeHelper { namespace HimeHelper {
namespace { namespace {
@ -50,51 +47,25 @@ void (*hime_im_client_set_client_window)(
const Window win); const Window win);
void (*hime_im_client_set_window)(HIME_client_handle *handle, Window win); void (*hime_im_client_set_window)(HIME_client_handle *handle, Window win);
struct HandleDeleter {
void operator()(void *handle) {
dlclose(handle);
}
};
using Handle = std::unique_ptr<void, HandleDeleter>;
bool LoadLibrary(Handle &handle, const char *name) {
handle = Handle(dlopen(name, RTLD_LAZY | RTLD_NODELETE));
if (handle) {
return true;
}
std::cerr << dlerror() << std::endl;
return false;
}
template <typename Function>
inline bool LoadSymbol(const Handle &handle, const char *name, Function &func) {
func = handle
? reinterpret_cast<Function>(dlsym(handle.get(), name))
: nullptr;
if (const auto error = dlerror()) {
std::cerr << error << std::endl;
}
return (func != nullptr);
}
bool Resolve() { bool Resolve() {
static const auto loaded = [&] { static const auto loaded = [&] {
auto lib = Handle(); const auto lib = base::Platform::LoadLibrary(
return LoadLibrary(lib, "libhime-im-client.so.1") "libhime-im-client.so.1",
&& LOAD_SYMBOL(lib, hime_im_client_close) RTLD_NODELETE);
&& LOAD_SYMBOL(lib, hime_im_client_focus_in) return lib
&& LOAD_SYMBOL(lib, hime_im_client_focus_out) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_close)
&& LOAD_SYMBOL(lib, hime_im_client_focus_out2) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_in)
&& LOAD_SYMBOL(lib, hime_im_client_forward_key_press) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_out)
&& LOAD_SYMBOL(lib, hime_im_client_forward_key_release) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_out2)
&& LOAD_SYMBOL(lib, hime_im_client_get_preedit) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_forward_key_press)
&& LOAD_SYMBOL(lib, hime_im_client_open) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_forward_key_release)
&& LOAD_SYMBOL(lib, hime_im_client_reset) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_get_preedit)
&& LOAD_SYMBOL(lib, hime_im_client_set_cursor_location) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_open)
&& LOAD_SYMBOL(lib, hime_im_client_set_flags) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_reset)
&& (LOAD_SYMBOL(lib, hime_im_client_set_client_window) && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_cursor_location)
|| LOAD_SYMBOL(lib, hime_im_client_set_window)); && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_flags)
&& (LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_client_window)
|| LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_window));
}(); }();
return loaded; return loaded;
} }

10
external/hime_qt/init.cpp vendored Normal file
View file

@ -0,0 +1,10 @@
/*
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
*/
#include <QtCore/QtPlugin>
Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)

View file

@ -56,6 +56,7 @@ PRIVATE
target_include_directories(external_hunspell_bundled target_include_directories(external_hunspell_bundled
PUBLIC PUBLIC
${hunspell_src} ${hunspell_src}
${hunspell_src}/hunspell
) )
target_compile_definitions(external_hunspell_bundled target_compile_definitions(external_hunspell_bundled

View file

@ -1,61 +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
add_library(external_jemalloc INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_jemalloc ALIAS external_jemalloc)
if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
return()
endif()
if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JEMALLOC jemalloc)
if (JEMALLOC_FOUND)
target_include_directories(external_jemalloc SYSTEM
INTERFACE
${JEMALLOC_INCLUDE_DIRS}
)
target_link_libraries(external_jemalloc
INTERFACE
-Wl,--push-state,--no-as-needed,${JEMALLOC_LINK_LIBRARIES},--pop-state
)
return()
endif()
endif()
include(ExternalProject)
ExternalProject_Add(jemalloc
URL ${third_party_loc}/jemalloc
CONFIGURE_COMMAND env
CC=clang
CXX=clang++
"EXTRA_CFLAGS=-fstack-protector-all -D_FORTIFY_SOURCE=2"
"EXTRA_CXXFLAGS=-fstack-protector-all -D_FORTIFY_SOURCE=2"
./autogen.sh --disable-shared
BUILD_IN_SOURCE 1
STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libjemalloc_pic.a
)
ExternalProject_Get_property(jemalloc SOURCE_DIR)
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
target_include_directories(external_jemalloc SYSTEM
INTERFACE
${SOURCE_DIR}/include
)
target_link_libraries(external_jemalloc
INTERFACE
-Wl,--push-state,--whole-archive,${SOURCE_DIR}/lib/libjemalloc_pic.a,--pop-state
)
add_dependencies(external_jemalloc jemalloc-build)

View file

@ -4,17 +4,32 @@
# 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_jpeg INTERFACE IMPORTED GLOBAL) if (DESKTOP_APP_USE_PACKAGED)
add_library(external_jpeg INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_jpeg ALIAS external_jpeg)
find_package(JPEG REQUIRED)
target_link_libraries(external_jpeg INTERFACE JPEG::JPEG)
return()
endif()
add_library(external_jpeg STATIC IMPORTED GLOBAL)
add_library(desktop-app::external_jpeg ALIAS external_jpeg) add_library(desktop-app::external_jpeg ALIAS external_jpeg)
if (DESKTOP_APP_USE_PACKAGED) if (WIN32)
find_package(JPEG) set(jpeg_lib_loc ${libs_loc}/mozjpeg)
target_link_libraries(external_jpeg INTERFACE JPEG::JPEG) target_include_directories(external_jpeg SYSTEM INTERFACE ${jpeg_lib_loc})
elseif (WIN32) set_target_properties(external_jpeg PROPERTIES
target_include_directories(external_jpeg SYSTEM INTERFACE ${libs_loc}/mozjpeg) IMPORTED_LOCATION "${jpeg_lib_loc}/Release/jpeg-static.lib"
target_link_libraries(external_jpeg INTERFACE ${libs_loc}/mozjpeg/$<IF:$<CONFIG:Debug>,Debug,Release>/jpeg-static.lib) IMPORTED_LOCATION_DEBUG "${jpeg_lib_loc}/Debug/jpeg-static.lib"
)
elseif (APPLE) elseif (APPLE)
target_link_libraries(external_jpeg INTERFACE ${libs_loc}/local/lib/libjpeg.a) set_target_properties(external_jpeg PROPERTIES
IMPORTED_LOCATION ${libs_loc}/local/lib/libjpeg.a
)
else() else()
target_link_static_libraries(external_jpeg INTERFACE jpeg) find_library(DESKTOP_APP_JPEG_LIBRARIES libjpeg.a REQUIRED)
set_target_properties(external_jpeg PROPERTIES
IMPORTED_LOCATION "${DESKTOP_APP_JPEG_LIBRARIES}"
)
endif() endif()

94
external/kcoreaddons/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,94 @@
# 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_kcoreaddons INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons)
if (DESKTOP_APP_USE_PACKAGED)
if (DESKTOP_APP_USE_PACKAGED_LAZY)
find_package(KF${QT_VERSION_MAJOR}CoreAddons QUIET)
else()
find_package(KF${QT_VERSION_MAJOR}CoreAddons)
endif()
if (KF${QT_VERSION_MAJOR}CoreAddons_FOUND)
target_link_libraries(external_kcoreaddons INTERFACE KF${QT_VERSION_MAJOR}::CoreAddons)
return()
endif()
endif()
add_library(external_kcoreaddons_bundled STATIC)
init_target(external_kcoreaddons_bundled "(external)")
set(kcoreaddons_loc ${third_party_loc}/kcoreaddons)
set(kcoreaddons_src ${kcoreaddons_loc}/src/lib)
nice_target_sources(external_kcoreaddons_bundled ${kcoreaddons_src}
PRIVATE
io/kurlmimedata.cpp
io/kurlmimedata.h
util/ksandbox.cpp
util/ksandbox.h
util/kshell.cpp
util/kshell.h
util/kshell_p.h
util/kshell_unix.cpp
util/kuser.h
util/kuser_unix.cpp
)
if (NOT LINUX)
remove_target_sources(external_kcoreaddons_bundled ${kcoreaddons_src}
util/kshell.cpp
util/kshell.h
util/kshell_p.h
util/kshell_unix.cpp
util/kuser.h
util/kuser_unix.cpp
)
endif()
if (LINUX AND TARGET Qt::DBus)
set_source_files_properties(${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml PROPERTIES INCLUDE ${kcoreaddons_src}/io/dbustypes_p.h)
qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml org.freedesktop.portal.FileTransfer)
set_source_files_properties(${kcoreaddons_src}/io/org.kde.KIOFuse.VFS.xml PROPERTIES NO_NAMESPACE TRUE)
qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.kde.KIOFuse.VFS.xml org.kde.KIOFuse.VFS)
target_sources(external_kcoreaddons_bundled PRIVATE ${_dbus_SRCS})
target_compile_definitions(external_kcoreaddons_bundled
PRIVATE
HAVE_QTDBUS
)
endif()
target_compile_definitions(external_kcoreaddons_bundled
PUBLIC
KCOREADDONS_EXPORT=
PRIVATE
ACCOUNTS_SERVICE_ICON_DIR="/var/lib/AccountsService/icons"
)
target_include_directories(external_kcoreaddons_bundled SYSTEM
PUBLIC
${kcoreaddons_src}/io
${kcoreaddons_src}/util
${CMAKE_CURRENT_SOURCE_DIR}/headers/public
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/headers/private
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(external_kcoreaddons_bundled
PRIVATE
desktop-app::external_qt
)
target_link_libraries(external_kcoreaddons
INTERFACE
external_kcoreaddons_bundled
)

View file

View file

@ -0,0 +1,3 @@
#pragma once
#include <QLoggingCategory>
static const QLoggingCategory KCOREADDONS_DEBUG("kf.coreaddons", QtInfoMsg);

View file

@ -0,0 +1 @@
#define KCOREADDONS_ENABLE_DEPRECATED_SINCE(major, minor) 0

140
external/kimageformats/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,140 @@
# 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 (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
add_library(external_kimageformats INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_kimageformats ALIAS external_kimageformats)
return()
endif()
add_library(external_kimageformats STATIC)
add_library(desktop-app::external_kimageformats ALIAS external_kimageformats)
init_target(external_kimageformats "(external)")
set(kimageformats_loc ${third_party_loc}/kimageformats)
set(kimageformats_src ${kimageformats_loc}/src/imageformats)
set_target_properties(external_kimageformats PROPERTIES AUTOMOC ON)
nice_target_sources(external_kimageformats ${kimageformats_src}
PRIVATE
avif.cpp
heif.cpp
jxl.cpp
qoi.cpp
)
target_compile_definitions(external_kimageformats
PRIVATE
QT_STATICPLUGIN
)
target_link_libraries(external_kimageformats
PRIVATE
desktop-app::external_qt
)
if (DESKTOP_APP_USE_PACKAGED)
find_package(libavif REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBHEIF REQUIRED IMPORTED_TARGET libheif)
pkg_check_modules(LIBJXL REQUIRED IMPORTED_TARGET libjxl)
pkg_check_modules(LIBJXL_THREADS REQUIRED IMPORTED_TARGET libjxl_threads)
target_link_libraries(external_kimageformats
PRIVATE
avif
PkgConfig::LIBHEIF
PkgConfig::LIBJXL
PkgConfig::LIBJXL_THREADS
)
elseif (WIN32)
target_compile_definitions(external_kimageformats
PRIVATE
JXL_STATIC_DEFINE
JXL_THREADS_STATIC_DEFINE
LIBHEIF_STATIC_BUILD
)
target_include_directories(external_kimageformats SYSTEM
PRIVATE
${libs_loc}/local/include
)
target_link_libraries(external_kimageformats
PRIVATE
${libs_loc}/libavif/$<IF:$<CONFIG:Debug>,Debug,Release>/avif.lib
${libs_loc}/libheif/libheif/$<IF:$<CONFIG:Debug>,Debug,Release>/heif.lib
${libs_loc}/libde265/libde265/$<IF:$<CONFIG:Debug>,Debug,Release>/libde265.lib
${libs_loc}/dav1d/builddir-$<IF:$<CONFIG:Debug>,debug,release>/src/libdav1d.a
${libs_loc}/libjxl/lib/$<IF:$<CONFIG:Debug>,Debug,Release>/jxl-static.lib
${libs_loc}/libjxl/lib/$<IF:$<CONFIG:Debug>,Debug,Release>/jxl_threads-static.lib
${libs_loc}/libjxl/third_party/highway/$<IF:$<CONFIG:Debug>,Debug,Release>/hwy.lib
${libs_loc}/libjxl/third_party/brotli/$<IF:$<CONFIG:Debug>,Debug,Release>/brotlidec-static.lib
${libs_loc}/libjxl/third_party/brotli/$<IF:$<CONFIG:Debug>,Debug,Release>/brotlienc-static.lib
${libs_loc}/libjxl/third_party/brotli/$<IF:$<CONFIG:Debug>,Debug,Release>/brotlicommon-static.lib
)
elseif (APPLE)
target_compile_definitions(external_kimageformats
PRIVATE
JXL_STATIC_DEFINE
JXL_THREADS_STATIC_DEFINE
LIBHEIF_STATIC_BUILD
)
target_include_directories(external_kimageformats SYSTEM
PRIVATE
${libs_loc}/local/include
)
target_link_libraries(external_kimageformats
PRIVATE
${libs_loc}/local/lib/libavif.a
${libs_loc}/local/lib/libheif.a
${libs_loc}/local/lib/libde265.a
${libs_loc}/local/lib/libdav1d.a
${libs_loc}/local/lib/libjxl.a
${libs_loc}/local/lib/libjxl_threads.a
${libs_loc}/local/lib/libhwy.a
${libs_loc}/local/lib/libbrotlidec-static.a
${libs_loc}/local/lib/libbrotlienc-static.a
${libs_loc}/local/lib/libbrotlicommon-static.a
)
else()
target_link_static_libraries(external_kimageformats
PRIVATE
avif
heif
jxl
jxl_threads
dav1d
de265
brotlidec
brotlienc
brotlicommon
hwy
lcms2
)
endif()
add_library(external_kimageformats_init OBJECT)
add_library(desktop-app::external_kimageformats_init ALIAS external_kimageformats_init)
init_target(external_kimageformats_init "(external)")
nice_target_sources(external_kimageformats_init ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
init.cpp
)
target_link_libraries(external_kimageformats_init
PRIVATE
desktop-app::external_qt
)
target_link_libraries(external_kimageformats
INTERFACE
external_kimageformats_init
$<TARGET_OBJECTS:external_kimageformats_init>
)

12
external/kimageformats/init.cpp vendored Normal file
View file

@ -0,0 +1,12 @@
/*
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
*/
#include <QtCore/QtPlugin>
Q_IMPORT_PLUGIN(QAVIFPlugin)
Q_IMPORT_PLUGIN(HEIFPlugin)
Q_IMPORT_PLUGIN(QJpegXLPlugin)

View file

@ -1,134 +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
add_library(external_kwayland INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_kwayland ALIAS external_kwayland)
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_QT6)
find_package(KF5Wayland)
if (KF5Wayland_FOUND)
target_link_libraries(external_kwayland INTERFACE KF5::WaylandClient)
return()
endif()
endif()
add_library(external_kwayland_bundled STATIC IMPORTED)
include(ExternalProject)
ExternalProject_Add(extra-cmake-modules
URL ${third_party_loc}/extra-cmake-modules
CMAKE_GENERATOR Ninja
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=<BINARY_DIR>
-DCMAKE_INSTALL_DATADIR=share
-DBUILD_TESTING=OFF
BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR>
COMMAND ${CMAKE_COMMAND} --install <BINARY_DIR>
STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS <BINARY_DIR>/share/ECM/cmake/ECMConfig.cmake
)
ExternalProject_Get_property(extra-cmake-modules BINARY_DIR)
set(extra_cmake_modules_binary_dir ${BINARY_DIR})
ExternalProject_Add(wayland-protocols
URL ${third_party_loc}/wayland-protocols
CONFIGURE_COMMAND meson
--prefix=<BINARY_DIR>
--libdir=lib
--buildtype=release
-Dtests=false
<BINARY_DIR> <SOURCE_DIR>
BUILD_COMMAND meson compile -C <BINARY_DIR>
COMMAND meson install -C <BINARY_DIR>
STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS <BINARY_DIR>/share/pkgconfig/wayland-protocols.pc
)
ExternalProject_Get_property(wayland-protocols BINARY_DIR)
set(wayland_protocols_binary_dir ${BINARY_DIR})
ExternalProject_Add(plasma-wayland-protocols
URL ${third_party_loc}/plasma-wayland-protocols
CMAKE_GENERATOR Ninja
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=<BINARY_DIR>
-DCMAKE_INSTALL_LIBDIR=lib
-DECM_DIR=${extra_cmake_modules_binary_dir}/share/ECM/cmake
BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR>
COMMAND ${CMAKE_COMMAND} --install <BINARY_DIR>
STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS <BINARY_DIR>/lib/cmake/PlasmaWaylandProtocols/PlasmaWaylandProtocolsConfig.cmake
)
ExternalProject_Add_StepDependencies(plasma-wayland-protocols configure extra-cmake-modules-build)
ExternalProject_Get_property(plasma-wayland-protocols BINARY_DIR)
set(plasma_wayland_protocols_binary_dir ${BINARY_DIR})
ExternalProject_Add(kwayland
URL ${third_party_loc}/kwayland
CMAKE_GENERATOR Ninja
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF
-DBUILD_WITH_QT6=${DESKTOP_APP_QT6}
-DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.91.0
-DCMAKE_PREFIX_PATH=${wayland_protocols_binary_dir}
-DECM_DIR=${extra_cmake_modules_binary_dir}/share/ECM/cmake
-DPlasmaWaylandProtocols_DIR=${plasma_wayland_protocols_binary_dir}/lib/cmake/PlasmaWaylandProtocols
STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS <BINARY_DIR>/lib/libKF5WaylandClient.a
)
ExternalProject_Add_StepDependencies(kwayland configure extra-cmake-modules-build)
ExternalProject_Add_StepDependencies(kwayland configure wayland-protocols-build)
ExternalProject_Add_StepDependencies(kwayland configure plasma-wayland-protocols-build)
ExternalProject_Get_property(kwayland SOURCE_DIR)
ExternalProject_Get_property(kwayland BINARY_DIR)
file(MAKE_DIRECTORY "${SOURCE_DIR}/src/client")
file(MAKE_DIRECTORY "${BINARY_DIR}/src/client")
set_target_properties(external_kwayland_bundled PROPERTIES
IMPORTED_LOCATION "${BINARY_DIR}/lib/libKF5WaylandClient.a"
)
target_include_directories(external_kwayland_bundled SYSTEM
INTERFACE
${SOURCE_DIR}/src/client
${BINARY_DIR}/src/client
)
target_link_libraries(external_kwayland_bundled
INTERFACE
desktop-app::external_qt
)
if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client)
target_link_libraries(external_kwayland_bundled INTERFACE PkgConfig::WAYLAND_CLIENT)
else()
target_link_libraries(external_kwayland_bundled INTERFACE desktop-app::linux_wayland_helper)
endif()
add_dependencies(external_kwayland_bundled kwayland-build)
target_link_libraries(external_kwayland
INTERFACE
external_kwayland_bundled
)

View file

@ -17,14 +17,6 @@ if (DESKTOP_APP_USE_PACKAGED)
endif() endif()
endif() endif()
if (WIN32)
target_include_directories(external_minizip SYSTEM
INTERFACE
${libs_loc}/zlib/contrib/minizip
)
return()
endif()
add_library(external_minizip_bundled STATIC) add_library(external_minizip_bundled STATIC)
init_target(external_minizip_bundled "(external)") init_target(external_minizip_bundled "(external)")
@ -46,6 +38,11 @@ PUBLIC
${minizip_loc} ${minizip_loc}
) )
target_link_libraries(external_minizip_bundled
PRIVATE
desktop-app::external_zlib
)
target_link_libraries(external_minizip target_link_libraries(external_minizip
INTERFACE INTERFACE
external_minizip_bundled external_minizip_bundled

View file

@ -48,3 +48,23 @@ target_link_libraries(external_nimf_qt5
PRIVATE PRIVATE
desktop-app::external_qt desktop-app::external_qt
) )
add_library(external_nimf_qt5_init OBJECT)
add_library(desktop-app::external_nimf_qt5_init ALIAS external_nimf_qt5_init)
init_target(external_nimf_qt5_init "(external)")
nice_target_sources(external_nimf_qt5_init ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
init.cpp
)
target_link_libraries(external_nimf_qt5_init
PRIVATE
desktop-app::external_qt
)
target_link_libraries(external_nimf_qt5
INTERFACE
external_nimf_qt5_init
$<TARGET_OBJECTS:external_nimf_qt5_init>
)

10
external/nimf_qt5/init.cpp vendored Normal file
View file

@ -0,0 +1,10 @@
/*
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
*/
#include <QtCore/QtPlugin>
Q_IMPORT_PLUGIN(NimfInputContextPlugin)

View file

@ -41,8 +41,8 @@ else()
INTERFACE INTERFACE
/usr/local/include/opus /usr/local/include/opus
) )
find_library(OPUS_LIBRARY libopus.a REQUIRED) find_library(DESKTOP_APP_OPUS_LIBRARIES libopus.a REQUIRED)
set_target_properties(external_opus PROPERTIES set_target_properties(external_opus PROPERTIES
IMPORTED_LOCATION "${OPUS_LIBRARY}" IMPORTED_LOCATION "${DESKTOP_APP_OPUS_LIBRARIES}"
) )
endif() endif()

View file

@ -8,12 +8,12 @@ add_library(external_qr_code_generator INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_qr_code_generator ALIAS external_qr_code_generator) add_library(desktop-app::external_qr_code_generator ALIAS external_qr_code_generator)
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
find_library(QRCODE_LIBRARIES NAMES qrcodegencpp) find_library(DESKTOP_APP_QRCODE_LIBRARIES NAMES qrcodegencpp)
find_path(QRCODE_INCLUDE_DIRS qrcodegen.hpp PATH_SUFFIXES qrcodegencpp qrcodegen) find_path(DESKTOP_APP_QRCODE_INCLUDE_DIRS NAMES qrcodegen.hpp QrCode.hpp PATH_SUFFIXES qrcodegencpp qrcodegen)
if (QRCODE_LIBRARIES AND QRCODE_INCLUDE_DIRS) if (DESKTOP_APP_QRCODE_LIBRARIES AND DESKTOP_APP_QRCODE_INCLUDE_DIRS)
target_include_directories(external_qr_code_generator SYSTEM INTERFACE ${QRCODE_INCLUDE_DIRS}) target_include_directories(external_qr_code_generator SYSTEM INTERFACE ${DESKTOP_APP_QRCODE_INCLUDE_DIRS})
target_link_libraries(external_qr_code_generator INTERFACE ${QRCODE_LIBRARIES}) target_link_libraries(external_qr_code_generator INTERFACE ${DESKTOP_APP_QRCODE_LIBRARIES})
return() return()
endif() endif()
endif() endif()

View file

@ -4,54 +4,30 @@
# 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_subdirectory(qt_static_plugins)
if (DESKTOP_APP_QT6)
add_subdirectory(qt6)
return()
endif()
add_library(external_qt INTERFACE IMPORTED GLOBAL) add_library(external_qt INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_qt ALIAS external_qt) add_library(desktop-app::external_qt ALIAS external_qt)
add_subdirectory(qt_static_plugins)
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
target_link_libraries(external_qt target_link_libraries(external_qt
INTERFACE INTERFACE
Qt5::Core Qt::Core
Qt5::Gui Qt::CorePrivate
Qt5::Widgets Qt::Gui
Qt5::Network Qt::GuiPrivate
Qt5::Svg $<TARGET_NAME_IF_EXISTS:Qt::OpenGL>
Qt::Widgets
Qt::WidgetsPrivate
$<TARGET_NAME_IF_EXISTS:Qt::OpenGLWidgets>
Qt::Network
Qt::Svg
$<TARGET_NAME_IF_EXISTS:Qt::DBus>
$<TARGET_NAME_IF_EXISTS:Qt::Quick>
$<TARGET_NAME_IF_EXISTS:Qt::QuickWidgets>
$<TARGET_NAME_IF_EXISTS:Qt::WaylandCompositor>
) )
target_include_directories(external_qt SYSTEM
INTERFACE
${Qt5Core_PRIVATE_INCLUDE_DIRS}
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
${Qt5Widgets_PRIVATE_INCLUDE_DIRS}
)
if (Qt5DBus_FOUND)
target_link_libraries(external_qt INTERFACE Qt5::DBus)
endif()
if (Qt5XkbCommonSupport_FOUND)
target_link_libraries(external_qt INTERFACE Qt5::XkbCommonSupport)
target_include_directories(external_qt SYSTEM
INTERFACE
${Qt5XkbCommonSupport_PRIVATE_INCLUDE_DIRS}
)
endif()
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_link_libraries(external_qt INTERFACE Qt5::WaylandClient)
target_include_directories(external_qt SYSTEM
INTERFACE
${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS}
)
endif()
return() return()
endif() endif()
@ -60,75 +36,48 @@ INTERFACE
${qt_loc}/include ${qt_loc}/include
${qt_loc}/include/QtCore ${qt_loc}/include/QtCore
${qt_loc}/include/QtGui ${qt_loc}/include/QtGui
$<$<TARGET_EXISTS:Qt::OpenGL>:${qt_loc}/include/QtOpenGL>
${qt_loc}/include/QtWidgets ${qt_loc}/include/QtWidgets
$<$<TARGET_EXISTS:Qt::OpenGLWidgets>:${qt_loc}/include/QtOpenGLWidgets>
${qt_loc}/include/QtSvg ${qt_loc}/include/QtSvg
$<$<TARGET_EXISTS:Qt::DBus>:${qt_loc}/include/QtDBus>
$<$<TARGET_EXISTS:Qt::Quick>:${qt_loc}/include/QtQuick>
$<$<TARGET_EXISTS:Qt::QuickWidgets>:${qt_loc}/include/QtQuickWidgets>
$<$<TARGET_EXISTS:Qt::WaylandCompositor>:${qt_loc}/include/QtWaylandCompositor>
${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtCore/${qt_version}
${qt_loc}/include/QtGui/${qt_version} ${qt_loc}/include/QtGui/${qt_version}
${qt_loc}/include/QtWidgets/${qt_version}
${qt_loc}/include/QtCore/${qt_version}/QtCore ${qt_loc}/include/QtCore/${qt_version}/QtCore
${qt_loc}/include/QtGui/${qt_version}/QtGui ${qt_loc}/include/QtGui/${qt_version}/QtGui
${qt_loc}/include/QtWidgets/${qt_version}/QtWidgets
) )
if (Qt5DBus_FOUND)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/include/QtDBus
)
endif()
if (Qt5XkbCommonSupport_FOUND)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/include/QtXkbCommonSupport
${qt_loc}/include/QtXkbCommonSupport/${qt_version}
${qt_loc}/include/QtXkbCommonSupport/${qt_version}/QtXkbCommonSupport
)
endif()
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/include/QtWaylandClient
${qt_loc}/include/QtWaylandClient/${qt_version}
${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient
)
endif()
target_compile_definitions(external_qt target_compile_definitions(external_qt
INTERFACE INTERFACE
_REENTRANT _REENTRANT
QT_STATICPLUGIN QT_STATICPLUGIN
QT_PLUGIN QT_PLUGIN
QT_WIDGETS_LIB
QT_NETWORK_LIB
QT_GUI_LIB
QT_CORE_LIB QT_CORE_LIB
QT_GUI_LIB
$<$<TARGET_EXISTS:Qt::OpenGL>:QT_OPENGL_LIB>
QT_WIDGETS_LIB
$<$<TARGET_EXISTS:Qt::OpenGLWidgets>:QT_OPENGLWIDGETS_LIB>
QT_NETWORK_LIB
QT_SVG_LIB QT_SVG_LIB
$<$<TARGET_EXISTS:Qt::DBus>:QT_DBUS_LIB>
$<$<TARGET_EXISTS:Qt::Quick>:QT_QUICK_LIB>
$<$<TARGET_EXISTS:Qt::QuickWidgets>:QT_QUICKWIDGETS_LIB>
$<$<TARGET_EXISTS:Qt::WaylandCompositor>:QT_WAYLANDCOMPOSITOR_LIB>
) )
if (Qt5DBus_FOUND)
target_compile_definitions(external_qt
INTERFACE
QT_DBUS_LIB
)
endif()
if (Qt5XkbCommonSupport_FOUND)
target_compile_definitions(external_qt
INTERFACE
QT_XKBCOMMON_SUPPORT_LIB
)
endif()
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_compile_definitions(external_qt
INTERFACE
QT_WAYLANDCLIENT_LIB
)
endif()
if (WIN32) if (WIN32)
set(qt_lib_prefix "") set(qt_lib_prefix "")
set(qt_lib_suffix $<$<CONFIG:Debug>:d>.lib) set(qt_lib_suffix $<$<CONFIG:Debug>:d>.lib)
target_compile_definitions(external_qt
INTERFACE
_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
)
else() else()
set(qt_lib_prefix lib) set(qt_lib_prefix lib)
if (APPLE) if (APPLE)
@ -139,36 +88,81 @@ else()
endif() endif()
set(common_qt_libs set(common_qt_libs
plugins/bearer/${qt_lib_prefix}qgenericbearer
plugins/imageformats/${qt_lib_prefix}qwebp plugins/imageformats/${qt_lib_prefix}qwebp
plugins/imageformats/${qt_lib_prefix}qgif plugins/imageformats/${qt_lib_prefix}qgif
plugins/imageformats/${qt_lib_prefix}qjpeg plugins/imageformats/${qt_lib_prefix}qjpeg
lib/${qt_lib_prefix}Qt5PrintSupport lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Svg
lib/${qt_lib_prefix}Qt5AccessibilitySupport lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Network
lib/${qt_lib_prefix}Qt5FontDatabaseSupport lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Widgets
lib/${qt_lib_prefix}Qt5EventDispatcherSupport lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Gui
lib/${qt_lib_prefix}Qt5ThemeSupport lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core
lib/${qt_lib_prefix}Qt5Network
lib/${qt_lib_prefix}Qt5Widgets
lib/${qt_lib_prefix}Qt5Gui
lib/${qt_lib_prefix}Qt5Svg
lib/${qt_lib_prefix}qtharfbuzz
lib/${qt_lib_prefix}qtlibpng
) )
if (TARGET Qt::OpenGL)
list(PREPEND common_qt_libs
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}OpenGL
)
endif()
if (TARGET Qt::OpenGLWidgets)
list(PREPEND common_qt_libs
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}OpenGLWidgets
)
endif()
if (TARGET Qt::Quick)
list(PREPEND common_qt_libs
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Quick
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Qml
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QmlBuiltins
)
endif()
if (TARGET Qt::QuickWidgets)
list(PREPEND common_qt_libs
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QuickWidgets
)
endif()
if (QT_VERSION_MAJOR GREATER_EQUAL 6)
list(APPEND common_qt_libs
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledHarfbuzz
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledLibpng
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledPcre2
)
else()
list(APPEND common_qt_libs
lib/${qt_lib_prefix}qtharfbuzz
lib/${qt_lib_prefix}qtlibpng
lib/${qt_lib_prefix}qtpcre2
)
endif()
set(qt_libs_list "") set(qt_libs_list "")
if (QT_VERSION_MAJOR GREATER_EQUAL 6)
list(APPEND qt_libs_list
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QWebpPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QJpegPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QGifPlugin_init>
)
endif()
if (WIN32) if (WIN32)
target_include_directories(external_qt SYSTEM target_include_directories(external_qt SYSTEM
INTERFACE INTERFACE
${qt_loc}/mkspecs/win32-msvc ${qt_loc}/mkspecs/win32-msvc
) )
set(qt_libs set(qt_libs
plugins/bearer/${qt_lib_prefix}qgenericbearer
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}AccessibilitySupport
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}FontDatabaseSupport
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}EventDispatcherSupport
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}ThemeSupport
${common_qt_libs} ${common_qt_libs}
lib/${qt_lib_prefix}Qt5Core lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WindowsUIAutomationSupport
lib/${qt_lib_prefix}Qt5WindowsUIAutomationSupport
lib/${qt_lib_prefix}qtmain lib/${qt_lib_prefix}qtmain
lib/${qt_lib_prefix}qtfreetype lib/${qt_lib_prefix}qtfreetype
lib/${qt_lib_prefix}qtpcre2
plugins/platforms/${qt_lib_prefix}qwindows plugins/platforms/${qt_lib_prefix}qwindows
) )
foreach (lib ${qt_libs}) foreach (lib ${qt_libs})
@ -186,76 +180,107 @@ elseif (APPLE)
) )
set(qt_libs set(qt_libs
${common_qt_libs} ${common_qt_libs}
lib/${qt_lib_prefix}Qt5Core lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledFreetype
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/platforms/${qt_lib_prefix}qcocoa
plugins/tls/${qt_lib_prefix}qsecuretransportbackend
plugins/networkinformation/${qt_lib_prefix}qscnetworkreachability
)
list(APPEND qt_libs_list
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QSecureTransportBackendPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QSCNetworkReachabilityNetworkInformationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin_resources_1>
) )
foreach (lib ${qt_libs}) foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach() endforeach()
target_link_libraries(external_qt
INTERFACE
cups
)
else() else()
set(qt_libs_dbus)
set(qt_libs_dbus_support)
set(qt_libs_dbus_plugins)
set(qt_libs_dbus_bearers)
if (Qt5DBus_FOUND)
set(qt_libs_dbus lib/${qt_lib_prefix}Qt5DBus)
set(qt_libs_dbus_support lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport)
set(qt_libs_dbus_plugins
plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin
)
set(qt_libs_dbus_bearers
plugins/bearer/${qt_lib_prefix}qconnmanbearer
plugins/bearer/${qt_lib_prefix}qnmbearer
)
endif()
set(qt_libs_waylandclient)
set(qt_libs_waylandclient_plugins)
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
set(qt_libs_waylandclient lib/${qt_lib_prefix}Qt5WaylandClient)
set(qt_libs_waylandclient_plugins
plugins/platforms/${qt_lib_prefix}qwayland-generic
plugins/platforms/${qt_lib_prefix}qwayland-egl
plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl
plugins/wayland-decoration-client/${qt_lib_prefix}bradient
)
endif()
set(qt_libs set(qt_libs
plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin
${qt_libs_dbus_plugins}
${qt_libs_waylandclient_plugins}
plugins/platformthemes/${qt_lib_prefix}qgtk3
plugins/platforms/${qt_lib_prefix}qxcb plugins/platforms/${qt_lib_prefix}qxcb
plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration
plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration
plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin
plugins/iconengines/${qt_lib_prefix}qsvgicon plugins/iconengines/${qt_lib_prefix}qsvgicon
lib/${qt_lib_prefix}Qt5XcbQpa plugins/platformthemes/${qt_lib_prefix}qgtk3
lib/${qt_lib_prefix}Qt5EglSupport plugins/tls/${qt_lib_prefix}qopensslbackend
lib/${qt_lib_prefix}Qt5GlxSupport plugins/networkinformation/${qt_lib_prefix}qglib
lib/${qt_lib_prefix}Qt5ServiceSupport lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}XcbQpa
lib/${qt_lib_prefix}Qt5EdidSupport
lib/${qt_lib_prefix}Qt5XkbCommonSupport
${qt_libs_dbus_support}
${qt_libs_dbus_bearers}
${qt_libs_waylandclient}
lib/${qt_lib_prefix}Qt5ServiceSupport
${common_qt_libs} ${common_qt_libs}
${qt_libs_dbus}
lib/${qt_lib_prefix}Qt5Core
lib/${qt_lib_prefix}qtpcre2
) )
list(APPEND qt_libs_list
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QXcbIntegrationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QXcbEglIntegrationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QXcbGlxIntegrationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QComposePlatformInputContextPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QSvgIconPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QGtk3ThemePlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QTlsBackendOpenSSLPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QGlibNetworkInformationPlugin_init>
)
if (TARGET Qt::DBus)
list(PREPEND qt_libs
plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin
plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal
)
list(APPEND qt_libs
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}DBus
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core
)
list(APPEND qt_libs_list
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QIbusPlatformInputContextPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QXdgDesktopPortalThemePlugin_init>
)
endif()
if (TARGET Qt::WaylandClient)
list(PREPEND qt_libs
plugins/platforms/${qt_lib_prefix}qwayland-generic
plugins/platforms/${qt_lib_prefix}qwayland-egl
plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl
plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell
plugins/wayland-decoration-client/${qt_lib_prefix}bradient
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandEglClientHwIntegration
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandClient
)
list(APPEND qt_libs_list
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QWaylandIntegrationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QWaylandEglPlatformIntegrationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QWaylandEglClientBufferPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QWaylandXdgShellIntegrationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QWaylandBradientDecorationPlugin_init>
)
endif()
if (TARGET Qt::WaylandCompositor)
list(PREPEND qt_libs
plugins/wayland-graphics-integration-server/${qt_lib_prefix}qt-wayland-compositor-wayland-egl
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandEglCompositorHwIntegration
lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandCompositor
)
list(APPEND qt_libs_list
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::QWaylandEglClientBufferIntegrationPlugin_init>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::WaylandCompositor_resources_1>
)
endif()
foreach (lib ${qt_libs}) foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach() endforeach()
endif() endif()
if (QT_VERSION_MAJOR GREATER_EQUAL 6)
list(APPEND qt_libs_list
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::Gui_resources_1>
$<$<TARGET_EXISTS:Qt${QT_VERSION_MAJOR}::Gui_resources_2>:$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::Gui_resources_2>>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::Widgets_resources_1>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::Widgets_resources_2>
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::Widgets_resources_3>
)
if (TARGET Qt::Quick)
list(APPEND qt_libs_list
$<TARGET_OBJECTS:Qt${QT_VERSION_MAJOR}::Quick_resources_2>
)
endif()
endif()
target_link_libraries(external_qt target_link_libraries(external_qt
INTERFACE INTERFACE
${qt_libs_list} ${qt_libs_list}
@ -263,21 +288,45 @@ INTERFACE
$<TARGET_FILE:desktop-app::external_openssl_ssl> $<TARGET_FILE:desktop-app::external_openssl_ssl>
$<TARGET_FILE:desktop-app::external_openssl_crypto> $<TARGET_FILE:desktop-app::external_openssl_crypto>
$<LINK_ONLY:desktop-app::external_jpeg> $<LINK_ONLY:desktop-app::external_jpeg>
$<TARGET_FILE:desktop-app::external_jpeg>
$<LINK_ONLY:desktop-app::external_zlib> $<LINK_ONLY:desktop-app::external_zlib>
$<TARGET_FILE:desktop-app::external_zlib> $<TARGET_FILE:desktop-app::external_zlib>
) )
if (LINUX) if (WIN32)
if (build_win64)
set(libwebp_release_folder x64)
else()
set(libwebp_release_folder x86)
endif()
set(webp_lib_loc ${libs_loc}/libwebp/out/$<IF:$<CONFIG:Debug>,debug,release>-static/${libwebp_release_folder}/lib)
target_link_libraries(external_qt
INTERFACE
${webp_lib_loc}/libwebp$<$<CONFIG:Debug>:_debug>.lib
${webp_lib_loc}/libwebpdemux$<$<CONFIG:Debug>:_debug>.lib
${webp_lib_loc}/libwebpmux$<$<CONFIG:Debug>:_debug>.lib
)
elseif (APPLE)
target_link_libraries(external_qt
INTERFACE
${libs_loc}/local/lib/libwebp.a
${libs_loc}/local/lib/libwebpdemux.a
${libs_loc}/local/lib/libwebpmux.a
${libs_loc}/local/lib/libsharpyuv.a
)
elseif (LINUX)
target_include_directories(external_qt SYSTEM target_include_directories(external_qt SYSTEM
INTERFACE INTERFACE
${qt_loc}/mkspecs/linux-g++ ${qt_loc}/mkspecs/linux-g++
) )
target_link_static_libraries(external_qt target_link_static_libraries(external_qt
INTERFACE INTERFACE
proxy lcms2
epoxy
xkbcommon xkbcommon
xkbcommon-x11 xkbcommon-x11
xcb-cursor
xcb-glx xcb-glx
xcb-xkb xcb-xkb
xcb-randr xcb-randr
@ -286,27 +335,49 @@ if (LINUX)
xcb-render xcb-render
xcb-image xcb-image
xcb-xfixes xcb-xfixes
xcb-xinerama
xcb-xinput
xcb-shape xcb-shape
xcb-sync xcb-sync
xcb-util xcb-util
xcb-render-util xcb-render-util
xcb-keysyms xcb-keysyms
webpmux
webpdemux
webp
sharpyuv
) )
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) if (TARGET Qt::WaylandClient)
target_link_libraries(external_qt target_link_optional_libraries(external_qt
INTERFACE INTERFACE
desktop-app::linux_wayland_helper wayland-egl
wayland-cursor
wayland-client
) )
endif() endif()
if (TARGET Qt::WaylandCompositor)
target_link_optional_libraries(external_qt
INTERFACE
wayland-server
)
endif()
target_link_optional_libraries(external_qt
INTERFACE
gtk-3
gdk-3
gdk_pixbuf-2.0
pango-1.0
EGL
GL
X11-xcb
xcb
)
target_link_libraries(external_qt target_link_libraries(external_qt
INTERFACE INTERFACE
desktop-app::linux_xcb_helper
fontconfig fontconfig
freetype freetype
xcb
X11 X11
X11-xcb gio-2.0
gobject-2.0
glib-2.0
rt
) )
endif() endif()

View file

@ -5,10 +5,12 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
if (NOT DESKTOP_APP_USE_PACKAGED) if (NOT DESKTOP_APP_USE_PACKAGED)
if (DESKTOP_APP_QT6) if (DEFINED ENV{QT})
set(qt_version 6.2.2) set(qt_version $ENV{QT} CACHE STRING "Qt version" FORCE)
else() endif()
set(qt_version 5.15.2)
if (NOT DEFINED qt_version)
message(FATAL_ERROR "Qt version is unknown, set `QT' environment variable")
endif() endif()
if (WIN32) if (WIN32)
@ -19,39 +21,40 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
set(qt_loc /usr/local/desktop-app/Qt-${qt_version}) set(qt_loc /usr/local/desktop-app/Qt-${qt_version})
endif() endif()
set(CMAKE_PREFIX_PATH ${qt_loc}) set(CMAKE_PREFIX_PATH ${qt_loc} ${libs_loc}/local)
endif() endif()
if (DESKTOP_APP_QT6) if (NOT DEFINED QT_VERSION_MAJOR)
find_package(Qt6 COMPONENTS Core Core5Compat Gui OpenGL Widgets OpenGLWidgets Network Svg REQUIRED) if (NOT WIN32)
else() find_package(QT NAMES Qt6 COMPONENTS Core)
find_package(Qt5 COMPONENTS Core Gui Widgets Network Svg REQUIRED) endif()
if (NOT QT_FOUND)
find_package(QT NAMES Qt5 COMPONENTS Core)
endif()
if (NOT QT_FOUND)
message(FATAL_ERROR "Neither Qt6 nor Qt5 is found")
endif()
endif() endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Quick QuickWidgets QUIET)
set(qt_version_6_5_or_greater 0)
if (QT_VERSION_MAJOR GREATER_EQUAL 6)
if (QT_VERSION_MAJOR GREATER 6 OR Qt6_VERSION_MINOR GREATER_EQUAL 5)
set(qt_version_6_5_or_greater 1)
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED)
endif()
# QtWaylandScanner cmake integration from Qt 6 is used
cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; qt_version_6_5_or_greater" ON)
if (LINUX) if (LINUX)
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus WaylandClient WaylandCompositor QUIET)
if (DESKTOP_APP_QT6)
find_package(Qt6 COMPONENTS WaylandClient REQUIRED)
else()
find_package(Qt5 COMPONENTS WaylandClient REQUIRED)
find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET)
endif()
endif()
if ((NOT DESKTOP_APP_USE_PACKAGED if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
OR (DESKTOP_APP_USE_PACKAGED AND DESKTOP_APP_USE_PACKAGED_LAZY)) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED)
AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
if (DESKTOP_APP_QT6)
find_package(Qt6 COMPONENTS DBus REQUIRED)
else()
find_package(Qt5 COMPONENTS DBus REQUIRED)
endif()
elseif (NOT DESKTOP_APP_USE_PACKAGED)
if (DESKTOP_APP_QT6)
find_package(Qt6 OPTIONAL_COMPONENTS DBus QUIET)
else()
find_package(Qt5 OPTIONAL_COMPONENTS DBus QUIET)
endif()
endif() endif()
endif() endif()

View file

@ -1,286 +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
add_library(external_qt INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_qt ALIAS external_qt)
if (DESKTOP_APP_USE_PACKAGED)
target_link_libraries(external_qt
INTERFACE
Qt6::Core
Qt6::Core5Compat
Qt6::Gui
Qt6::OpenGL
Qt6::Widgets
Qt6::OpenGLWidgets
Qt6::Network
Qt6::Svg
)
target_include_directories(external_qt SYSTEM
INTERFACE
${Qt6Core_PRIVATE_INCLUDE_DIRS}
${Qt6Gui_PRIVATE_INCLUDE_DIRS}
)
if (Qt6DBus_FOUND)
target_link_libraries(external_qt INTERFACE Qt6::DBus)
endif()
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_link_libraries(external_qt INTERFACE Qt6::WaylandClient)
target_include_directories(external_qt SYSTEM
INTERFACE
${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS}
)
endif()
return()
endif()
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/include
${qt_loc}/include/QtCore
${qt_loc}/include/QtCore5Compat
${qt_loc}/include/QtGui
${qt_loc}/include/QtOpenGL
${qt_loc}/include/QtWidgets
${qt_loc}/include/QtOpenGLWidgets
${qt_loc}/include/QtSvg
${qt_loc}/include/QtCore/${qt_version}
${qt_loc}/include/QtGui/${qt_version}
${qt_loc}/include/QtCore/${qt_version}/QtCore
${qt_loc}/include/QtGui/${qt_version}/QtGui
)
if (Qt6DBus_FOUND)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/include/QtDBus
)
endif()
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/include/QtWaylandClient
${qt_loc}/include/QtWaylandClient/${qt_version}
${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient
)
endif()
target_compile_definitions(external_qt
INTERFACE
_REENTRANT
QT_STATICPLUGIN
QT_PLUGIN
QT_SVG_LIB
QT_NETWORK_LIB
QT_OPENGLWIDGETS_LIB
QT_WIDGETS_LIB
QT_OPENGL_LIB
QT_GUI_LIB
QT_CORE5COMPAT_LIB
QT_CORE_LIB
)
if (Qt6DBus_FOUND)
target_compile_definitions(external_qt
INTERFACE
QT_DBUS_LIB
)
endif()
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_compile_definitions(external_qt
INTERFACE
QT_WAYLANDCLIENT_LIB
)
endif()
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()
if (LINUX)
set(qt_lib_objects objects-RelWithDebInfo)
else()
set(qt_lib_objects objects-$<IF:$<CONFIG:Debug>,Debug,RelWithDebInfo>)
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}Qt6Svg
lib/${qt_lib_prefix}Qt6Network
lib/${qt_lib_prefix}Qt6OpenGLWidgets
lib/${qt_lib_prefix}Qt6Widgets
lib/${qt_lib_prefix}Qt6OpenGL
lib/${qt_lib_prefix}Qt6Gui
lib/${qt_lib_prefix}Qt6Core5Compat
lib/${qt_lib_prefix}Qt6Core
lib/${qt_lib_prefix}Qt6BundledHarfbuzz
lib/${qt_lib_prefix}Qt6BundledLibpng
lib/${qt_lib_prefix}Qt6BundledPcre2
)
set(qt_libs_list "")
if (WIN32)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/mkspecs/win32-msvc
)
set(qt_libs
${common_qt_libs}
lib/${qt_lib_prefix}Qt6WindowsUIAutomationSupport
lib/${qt_lib_prefix}qtmain
lib/${qt_lib_prefix}Qt6BundledFreetype
plugins/platforms/${qt_lib_prefix}qwindows
plugins/tls/${qt_lib_prefix}qopensslbackend
)
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_angle
)
elseif (APPLE)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/mkspecs/macx-clang
)
set(qt_libs
${common_qt_libs}
lib/${qt_lib_prefix}Qt6BundledFreetype
plugins/platforms/${qt_lib_prefix}qcocoa
plugins/tls/${qt_lib_prefix}qsecuretransportbackend
plugins/networkinformation/${qt_lib_prefix}qscnetworkreachability
)
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach()
list(APPEND qt_libs_list
"${qt_loc}/lib/${qt_lib_objects}/QCocoaIntegrationPlugin_resources_1/.rcc/qrc_qcocoaresources.cpp.o"
)
else()
set(qt_libs_dbus)
set(qt_libs_dbus_plugins)
if (Qt6DBus_FOUND)
set(qt_libs_dbus
lib/${qt_lib_prefix}Qt6DBus
lib/${qt_lib_prefix}Qt6Core
)
set(qt_libs_dbus_plugins
plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin
)
endif()
set(qt_libs_waylandclient)
set(qt_libs_waylandclient_plugins)
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
set(qt_libs_waylandclient
lib/${qt_lib_prefix}Qt6WaylandEglClientHwIntegration
lib/${qt_lib_prefix}Qt6WaylandClient
)
set(qt_libs_waylandclient_plugins
plugins/platforms/${qt_lib_prefix}qwayland-generic
plugins/platforms/${qt_lib_prefix}qwayland-egl
plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl
plugins/wayland-decoration-client/${qt_lib_prefix}bradient
)
endif()
set(qt_libs
plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin
${qt_libs_dbus_plugins}
${qt_libs_waylandclient_plugins}
plugins/platformthemes/${qt_lib_prefix}qgtk3
plugins/platforms/${qt_lib_prefix}qxcb
plugins/tls/${qt_lib_prefix}qopensslbackend
plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration
plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration
plugins/iconengines/${qt_lib_prefix}qsvgicon
lib/${qt_lib_prefix}Qt6XcbQpa
${qt_libs_waylandclient}
${common_qt_libs}
${qt_libs_dbus}
)
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach()
endif()
list(APPEND qt_libs_list
"${qt_loc}/lib/${qt_lib_objects}/Gui_resources_1/.rcc/qrc_qpdf.cpp.o"
"${qt_loc}/lib/${qt_lib_objects}/Widgets_resources_1/.rcc/qrc_qstyle.cpp.o"
"${qt_loc}/lib/${qt_lib_objects}/Widgets_resources_2/.rcc/qrc_qstyle1.cpp.o"
"${qt_loc}/lib/${qt_lib_objects}/Widgets_resources_3/.rcc/qrc_qmessagebox.cpp.o"
)
target_link_libraries(external_qt
INTERFACE
${qt_libs_list}
$<LINK_ONLY:desktop-app::external_openssl>
$<TARGET_FILE:desktop-app::external_openssl_ssl>
$<TARGET_FILE:desktop-app::external_openssl_crypto>
$<LINK_ONLY:desktop-app::external_jpeg>
$<LINK_ONLY:desktop-app::external_zlib>
$<TARGET_FILE:desktop-app::external_zlib>
)
if (LINUX)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/mkspecs/linux-g++
)
target_link_static_libraries(external_qt
INTERFACE
proxy
epoxy
xkbcommon
xkbcommon-x11
xcb-glx
xcb-xkb
xcb-randr
xcb-icccm
xcb-shm
xcb-render
xcb-image
xcb-xfixes
xcb-xinput
xcb-shape
xcb-sync
xcb-util
xcb-render-util
xcb-keysyms
)
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_link_libraries(external_qt
INTERFACE
desktop-app::linux_wayland_helper
)
endif()
target_link_libraries(external_qt
INTERFACE
desktop-app::linux_xcb_helper
fontconfig
freetype
xcb
X11
X11-xcb
)
endif()

View file

@ -16,26 +16,27 @@ PRIVATE
target_link_libraries(external_qt_static_plugins target_link_libraries(external_qt_static_plugins
PUBLIC PUBLIC
desktop-app::external_qt desktop-app::external_qt
desktop-app::external_kimageformats
) )
if (DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(external_qt_static_plugins
PRIVATE
QT_STATIC_PLUGINS_USE_PACKAGED
)
endif()
if (LINUX) if (LINUX)
target_link_libraries(external_qt_static_plugins target_link_libraries(external_qt_static_plugins
PUBLIC PUBLIC
desktop-app::external_nimf_qt5 desktop-app::external_nimf_qt5
) )
if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) if (TARGET Qt::DBus AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
target_link_libraries(external_qt_static_plugins target_link_libraries(external_qt_static_plugins
PUBLIC PUBLIC
desktop-app::external_fcitx_qt5 desktop-app::external_fcitx5_qt
) )
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
target_link_libraries(external_qt_static_plugins
PUBLIC
desktop-app::external_fcitx5_qt
)
endif()
endif() endif()
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)

View file

@ -7,62 +7,10 @@ https://github.com/desktop-app/legal/blob/master/LEGAL
*/ */
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
#ifndef DESKTOP_APP_USE_PACKAGED #if !defined QT_STATIC_PLUGINS_USE_PACKAGED && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined Q_OS_WIN
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef Q_OS_MAC
Q_IMPORT_PLUGIN(QSecureTransportBackend)
Q_IMPORT_PLUGIN(QSCNetworkReachabilityNetworkInformationBackendFactory)
#else // Q_OS_MAC
Q_IMPORT_PLUGIN(QTlsBackendOpenSSL)
#endif // Q_OS_MAC
#else // Qt >= 6.0.0
Q_IMPORT_PLUGIN(QGenericEnginePlugin) Q_IMPORT_PLUGIN(QGenericEnginePlugin)
#endif // Qt < 6.0.0
Q_IMPORT_PLUGIN(QWebpPlugin) Q_IMPORT_PLUGIN(QWebpPlugin)
Q_IMPORT_PLUGIN(QJpegPlugin) Q_IMPORT_PLUGIN(QJpegPlugin)
Q_IMPORT_PLUGIN(QGifPlugin) Q_IMPORT_PLUGIN(QGifPlugin)
#ifdef Q_OS_WIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
#elif defined Q_OS_MAC // Q_OS_WIN #endif // !QT_STATIC_PLUGINS_USE_PACKAGED && Qt < 6.0.0 && Q_OS_WIN
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
#elif defined Q_OS_UNIX // Q_OS_WIN | Q_OS_MAC
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
Q_IMPORT_PLUGIN(QXcbEglIntegrationPlugin)
Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin)
Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QSvgIconPlugin)
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
#endif // Qt < 6.0.0
Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandEglClientBufferPlugin)
Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin)
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
Q_IMPORT_PLUGIN(QGtk3ThemePlugin)
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_UNIX
#endif // !DESKTOP_APP_USE_PACKAGED
#if defined Q_OS_UNIX && !defined Q_OS_MAC
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY
Q_IMPORT_PLUGIN(NimfInputContextPlugin)
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin)
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY
#endif // Q_OS_UNIX && !Q_OS_MAC

View file

@ -42,8 +42,8 @@ else()
INTERFACE INTERFACE
/usr/local/include /usr/local/include
) )
find_library(RNNOISE_LIBRARY librnnoise.a REQUIRED) find_library(DESKTOP_APP_RNNOISE_LIBRARIES librnnoise.a REQUIRED)
set_target_properties(external_rnnoise PROPERTIES set_target_properties(external_rnnoise PROPERTIES
IMPORTED_LOCATION "${RNNOISE_LIBRARY}" IMPORTED_LOCATION "${DESKTOP_APP_RNNOISE_LIBRARIES}"
) )
endif() endif()

35
external/scudo/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,35 @@
# 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_scudo STATIC)
add_library(desktop-app::external_scudo ALIAS external_scudo)
init_target(external_scudo "(external)")
set(scudo_loc ${third_party_loc}/scudo)
# https://llvm.org/docs/ScudoHardenedAllocator.html#library
file(GLOB scudo_srcs ${scudo_loc}/*.cpp)
target_sources(external_scudo
PRIVATE
${scudo_srcs}
)
target_include_directories(external_scudo SYSTEM
PRIVATE
${scudo_loc}/include
)
add_library(external_scudo_options INTERFACE)
target_compile_options(external_scudo_options
INTERFACE
-fno-lto
-Wno-unused-result
)
target_link_libraries(external_scudo
PRIVATE
external_scudo_options
)

View file

@ -8,11 +8,11 @@ add_library(external_variant INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_variant ALIAS external_variant) add_library(desktop-app::external_variant ALIAS external_variant)
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
find_path(VARIANT_INCLUDE_DIRS mapbox/variant.hpp) find_path(DESKTOP_APP_VARIANT_INCLUDE_DIRS mapbox/variant.hpp)
if (VARIANT_INCLUDE_DIRS) if (DESKTOP_APP_VARIANT_INCLUDE_DIRS)
target_include_directories(external_variant SYSTEM target_include_directories(external_variant SYSTEM
INTERFACE INTERFACE
${VARIANT_INCLUDE_DIRS} ${DESKTOP_APP_VARIANT_INCLUDE_DIRS}
) )
return() return()
endif() endif()

View file

@ -46,8 +46,8 @@ else()
INTERFACE INTERFACE
/usr/local/include /usr/local/include
) )
find_library(VPX_LIBRARY libvpx.a REQUIRED) find_library(DESKTOP_APP_VPX_LIBRARIES libvpx.a REQUIRED)
set_target_properties(external_vpx PROPERTIES set_target_properties(external_vpx PROPERTIES
IMPORTED_LOCATION "${VPX_LIBRARY}" IMPORTED_LOCATION "${DESKTOP_APP_VPX_LIBRARIES}"
) )
endif() endif()

16
external/wayland_client/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,16 @@
# 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_wayland_client INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_wayland_client ALIAS external_wayland_client)
if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client)
target_link_libraries(external_wayland_client INTERFACE PkgConfig::WAYLAND_CLIENT)
else()
target_link_optional_libraries(external_wayland_client INTERFACE wayland-client)
endif()

View file

@ -26,7 +26,8 @@ INTERFACE
WEBRTC_USE_BUILTIN_ISAC_FLOAT WEBRTC_USE_BUILTIN_ISAC_FLOAT
WEBRTC_LIBRARY_IMPL WEBRTC_LIBRARY_IMPL
WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1 WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1
WEBRTC_HAVE_USRSCTP WEBRTC_HAVE_DCSCTP
WEBRTC_HAVE_SCTP
ABSL_ALLOCATOR_NOTHROW=1 ABSL_ALLOCATOR_NOTHROW=1
) )
@ -62,6 +63,11 @@ else()
) )
endif() endif()
if (NOT EXISTS ${libs_loc}/tg_owt/out/Debug/${webrtc_lib_prefix}tg_owt${webrtc_lib_suffix})
set(webrtc_build_loc ${libs_loc}/tg_owt/out/Release)
target_compile_definitions(external_webrtc INTERFACE $<$<CONFIG:Debug>:NDEBUG>)
endif()
target_include_directories(external_webrtc SYSTEM target_include_directories(external_webrtc SYSTEM
INTERFACE INTERFACE
${webrtc_loc} ${webrtc_loc}
@ -89,6 +95,7 @@ INTERFACE
${webrtc_libs_list} ${webrtc_libs_list}
$<LINK_ONLY:desktop-app::external_openssl> $<LINK_ONLY:desktop-app::external_openssl>
$<LINK_ONLY:desktop-app::external_jpeg> $<LINK_ONLY:desktop-app::external_jpeg>
$<TARGET_FILE:desktop-app::external_jpeg>
$<LINK_ONLY:desktop-app::external_opus> $<LINK_ONLY:desktop-app::external_opus>
$<TARGET_FILE:desktop-app::external_opus> $<TARGET_FILE:desktop-app::external_opus>
$<LINK_ONLY:desktop-app::external_vpx> $<LINK_ONLY:desktop-app::external_vpx>

View file

@ -16,5 +16,5 @@ if (DESKTOP_APP_USE_PACKAGED)
pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb) pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb)
target_link_libraries(external_xcb INTERFACE PkgConfig::XCB) target_link_libraries(external_xcb INTERFACE PkgConfig::XCB)
else() else()
target_link_libraries(external_xcb INTERFACE xcb) target_link_optional_libraries(external_xcb INTERFACE xcb)
endif() endif()

View file

@ -17,25 +17,20 @@ add_library(external_zlib STATIC IMPORTED GLOBAL)
add_library(desktop-app::external_zlib ALIAS external_zlib) add_library(desktop-app::external_zlib ALIAS external_zlib)
if (WIN32) if (WIN32)
set(zlib_lib_loc ${libs_loc}/zlib)
target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI) target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI)
target_include_directories(external_zlib SYSTEM INTERFACE ${libs_loc}/zlib) target_include_directories(external_zlib SYSTEM INTERFACE ${zlib_lib_loc})
if (build_win64)
set(zlib_config_folder x64)
else()
set(zlib_config_folder x86)
endif()
set(zlib_lib_loc ${libs_loc}/zlib/contrib/vstudio/vc14/${zlib_config_folder})
set_target_properties(external_zlib PROPERTIES set_target_properties(external_zlib PROPERTIES
IMPORTED_LOCATION "${zlib_lib_loc}/ZlibStatReleaseWithoutAsm/zlibstat.lib" IMPORTED_LOCATION "${zlib_lib_loc}/Release/zlibstatic.lib"
IMPORTED_LOCATION_DEBUG "${zlib_lib_loc}/ZlibStatDebug/zlibstat.lib" IMPORTED_LOCATION_DEBUG "${zlib_lib_loc}/Debug/zlibstaticd.lib"
) )
elseif (APPLE) elseif (APPLE)
set_target_properties(external_zlib PROPERTIES set_target_properties(external_zlib PROPERTIES
IMPORTED_LOCATION ${libs_loc}/local/lib/libz.a IMPORTED_LOCATION ${libs_loc}/local/lib/libz.a
) )
else() else()
find_library(ZLIB_LIBRARY libz.a REQUIRED) find_library(DESKTOP_APP_ZLIB_LIBRARIES libz.a REQUIRED)
set_target_properties(external_zlib PROPERTIES set_target_properties(external_zlib PROPERTIES
IMPORTED_LOCATION "${ZLIB_LIBRARY}" IMPORTED_LOCATION "${DESKTOP_APP_ZLIB_LIBRARIES}"
) )
endif() endif()

View file

@ -8,7 +8,12 @@ function(generate_target parent_name postfix generated_timestamp generated_files
add_custom_target(${parent_name}_${postfix} DEPENDS ${generated_timestamp}) add_custom_target(${parent_name}_${postfix} DEPENDS ${generated_timestamp})
init_target_folder(${parent_name}_${postfix} "(gen)") init_target_folder(${parent_name}_${postfix} "(gen)")
add_dependencies(${parent_name} ${parent_name}_${postfix}) add_dependencies(${parent_name} ${parent_name}_${postfix})
target_sources(${parent_name} PRIVATE ${generated_files}) get_target_property(parent_type ${parent_name} TYPE)
target_include_directories(${parent_name} PUBLIC ${gen_dst}) if (${parent_type} STREQUAL "INTERFACE_LIBRARY")
target_include_directories(${parent_name} SYSTEM INTERFACE ${gen_dst})
else()
target_include_directories(${parent_name} SYSTEM PUBLIC ${gen_dst})
target_sources(${parent_name} PRIVATE ${generated_files})
endif()
source_group("(gen)" FILES ${generated_files}) source_group("(gen)" FILES ${generated_files})
endfunction() endfunction()

View file

@ -12,49 +12,50 @@ function(init_target_folder target_name folder_name)
endif() endif()
endfunction() endfunction()
function(init_target target_name) # init_target(my_target folder_name) function(init_target target_name) # init_target(my_target [cxx_std_..] folder_name)
if (ARGC GREATER 1) set(standard ${MAXIMUM_CXX_STANDARD})
if (${ARGV1} STREQUAL cxx_std_14 OR ${ARGV1} STREQUAL cxx_std_11 OR ${ARGV1} STREQUAL cxx_std_17) foreach (entry ${ARGN})
target_compile_features(${target_name} PRIVATE ${ARGV1}) if (${entry} STREQUAL cxx_std_14 OR ${entry} STREQUAL cxx_std_11 OR ${entry} STREQUAL cxx_std_17)
set(standard ${entry})
else() else()
target_compile_features(${target_name} PRIVATE ${MAXIMUM_CXX_STANDARD}) init_target_folder(${target_name} ${entry})
init_target_folder(${target_name} ${ARGV1})
endif() endif()
else() endforeach()
target_compile_features(${target_name} PRIVATE ${MAXIMUM_CXX_STANDARD}) target_compile_features(${target_name} PRIVATE ${standard})
if (WIN32 AND DESKTOP_APP_SPECIAL_TARGET)
set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$<IF:$<CONFIG:Debug>,,/LTCG>")
endif() endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set_target_properties(${target_name} PROPERTIES if (LINUX AND NOT DESKTOP_APP_DISABLE_SCUDO AND NOT target_name STREQUAL external_scudo)
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") add_dependencies(${target_name} desktop-app::external_scudo)
target_link_options(${target_name}
PRIVATE
-Wl,--push-state,--whole-archive,$<TARGET_FILE:desktop-app::external_scudo>,--pop-state
)
endif() endif()
target_link_libraries(${target_name} PRIVATE desktop-app::common_options) target_link_libraries(${target_name} PRIVATE 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
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
MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>
) )
if (DESKTOP_APP_SPECIAL_TARGET OR DESKTOP_APP_WITH_LTO) if (DESKTOP_APP_SPECIAL_TARGET)
set_target_properties(${target_name} PROPERTIES set_target_properties(${target_name} PROPERTIES
XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL $<IF:$<CONFIG:Debug>,0,fast> XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL $<IF:$<CONFIG:Debug>,0,fast>
XCODE_ATTRIBUTE_LLVM_LTO $<IF:$<CONFIG:Debug>,NO,YES> XCODE_ATTRIBUTE_LLVM_LTO $<IF:$<CONFIG:Debug>,NO,YES>
) )
endif() endif()
if (DESKTOP_APP_WITH_LTO OR (DESKTOP_APP_SPECIAL_TARGET AND WIN32 AND NOT build_win64))
set_target_properties(${target_name} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE True
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True
INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True
)
endif()
endfunction() endfunction()
# This code is not supposed to run on build machine, only on target machine. # This code is not supposed to run on build machine, only on target machine.
function(init_non_host_target target_name) function(init_non_host_target target_name)
init_target(${target_name}) init_target(${ARGV})
set_target_properties(${target_name} PROPERTIES if (APPLE)
OSX_ARCHITECTURES "${DESKTOP_APP_MAC_ARCH}" set_target_properties(${target_name} PROPERTIES
) OSX_ARCHITECTURES "${DESKTOP_APP_MAC_ARCH}"
)
endif()
endfunction() endfunction()

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
add_library(linux_jemalloc_helper OBJECT)
init_target(linux_jemalloc_helper "(external)")
add_library(desktop-app::linux_jemalloc_helper ALIAS linux_jemalloc_helper)
nice_target_sources(linux_jemalloc_helper ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
linux_jemalloc_helper.cpp
)
target_link_libraries(linux_jemalloc_helper
PRIVATE
desktop-app::external_jemalloc
)

View file

@ -1,25 +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
//
#ifdef __FreeBSD__
#include <malloc_np.h>
#else // __FreeBSD__
#include <jemalloc/jemalloc.h>
#endif // !__FreeBSD__
namespace {
class JemallocInitializer {
public:
JemallocInitializer() {
auto backgroundThread = true;
mallctl("background_thread", nullptr, nullptr, &backgroundThread, sizeof(bool));
}
};
static const JemallocInitializer initializer;
} // namespace

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
add_library(linux_wayland_helper STATIC)
init_target(linux_wayland_helper "(external)")
add_library(desktop-app::linux_wayland_helper ALIAS linux_wayland_helper)
nice_target_sources(linux_wayland_helper ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
linux_wayland_helper.cpp
)
target_link_libraries(linux_wayland_helper
PRIVATE
desktop-app::external_gsl
)

View file

@ -1,701 +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
//
#include <dlfcn.h>
#include <errno.h>
#include <gsl/gsl>
#include <wayland-egl.h>
#include <wayland-cursor.h>
#include <iostream>
#define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func)
#define LOAD_SYMBOL_SILENT(handle, func) LoadSymbol(handle, #func, func, true)
namespace Wayland {
namespace {
constexpr auto WL_CLOSURE_MAX_ARGS = 20;
struct wl_egl_window *(*wl_egl_window_create)(
struct wl_surface *surface,
int width,
int height);
void (*wl_egl_window_destroy)(struct wl_egl_window *egl_window);
void (*wl_egl_window_resize)(
struct wl_egl_window *egl_window,
int width,
int height,
int dx,
int dy);
void (*wl_egl_window_get_attached_size)(
struct wl_egl_window *egl_window,
int *width,
int *height);
struct wl_buffer *(*wl_cursor_image_get_buffer)(
struct wl_cursor_image *image);
struct wl_cursor_theme *(*wl_cursor_theme_load)(
const char *name,
int size,
struct wl_shm *shm);
void (*wl_cursor_theme_destroy)(struct wl_cursor_theme *theme);
struct wl_cursor *(*wl_cursor_theme_get_cursor)(
struct wl_cursor_theme *theme,
const char *name);
int (*wl_cursor_frame_and_duration)(
struct wl_cursor *cursor,
uint32_t time,
uint32_t *duration);
void (*wl_proxy_destroy)(struct wl_proxy *proxy);
uint32_t (*wl_proxy_get_version)(struct wl_proxy *proxy);
void (*wl_array_init)(struct wl_array *array);
void (*wl_array_release)(struct wl_array *array);
void *(*wl_array_add)(struct wl_array *array, size_t size);
int (*wl_proxy_add_listener)(
struct wl_proxy *proxy,
void (**implementation)(void),
void *data);
void (*wl_proxy_set_user_data)(struct wl_proxy *proxy, void *user_data);
void *(*wl_proxy_get_user_data)(struct wl_proxy *proxy);
int (*wl_display_get_fd)(struct wl_display *display);
int (*wl_display_get_error)(struct wl_display *display);
int (*wl_display_dispatch)(struct wl_display *display);
struct wl_event_queue *(*wl_display_create_queue)(struct wl_display *display);
int (*wl_display_dispatch_queue_pending)(
struct wl_display *display,
struct wl_event_queue *queue);
int (*wl_display_prepare_read_queue)(
struct wl_display *display,
struct wl_event_queue *queue);
int (*wl_display_flush)(struct wl_display *display);
void (*wl_display_cancel_read)(struct wl_display *display);
int (*wl_display_read_events)(struct wl_display *display);
void (*wl_event_queue_destroy)(struct wl_event_queue *queue);
int (*wl_display_prepare_read)(struct wl_display *display);
int (*wl_display_dispatch_pending)(struct wl_display *display);
struct wl_display *(*wl_display_connect)(const char *name);
struct wl_display *(*wl_display_connect_to_fd)(int fd);
void (*wl_display_disconnect)(struct wl_display *display);
void *(*wl_proxy_create_wrapper)(void *proxy);
void (*wl_proxy_wrapper_destroy)(void *proxy_wrapper);
void (*wl_proxy_set_queue)(struct wl_proxy *proxy, struct wl_event_queue *queue);
int (*wl_display_roundtrip)(struct wl_display *display);
struct wl_proxy *(*wl_proxy_marshal_array_constructor)(
struct wl_proxy *proxy,
uint32_t opcode,
union wl_argument *args,
const struct wl_interface *interface);
struct wl_proxy *(*wl_proxy_marshal_array_constructor_versioned)(
struct wl_proxy *proxy,
uint32_t opcode,
union wl_argument *args,
const struct wl_interface *interface,
uint32_t version);
struct wl_proxy *(*wl_proxy_marshal_array_flags)(
struct wl_proxy *proxy,
uint32_t opcode,
const struct wl_interface *interface,
uint32_t version,
uint32_t flags,
union wl_argument *args);
uint32_t (*wl_proxy_get_id)(struct wl_proxy *proxy);
const void *(*wl_proxy_get_listener)(struct wl_proxy *proxy);
struct argument_details {
char type;
int nullable;
};
const char *get_next_argument(
const char *signature,
struct argument_details *details) {
details->nullable = 0;
for(; *signature; ++signature) {
switch(*signature) {
case 'i':
case 'u':
case 'f':
case 's':
case 'o':
case 'n':
case 'a':
case 'h':
details->type = *signature;
return signature + 1;
case '?':
details->nullable = 1;
}
}
details->type = '\0';
return signature;
}
void wl_argument_from_va_list(
const char *signature,
union wl_argument *args,
int count,
va_list ap) {
int i;
const char *sig_iter;
struct argument_details arg;
sig_iter = signature;
for (i = 0; i < count; i++) {
sig_iter = get_next_argument(sig_iter, &arg);
switch(arg.type) {
case 'i':
args[i].i = va_arg(ap, int32_t);
break;
case 'u':
args[i].u = va_arg(ap, uint32_t);
break;
case 'f':
args[i].f = va_arg(ap, wl_fixed_t);
break;
case 's':
args[i].s = va_arg(ap, const char *);
break;
case 'o':
args[i].o = va_arg(ap, struct wl_object *);
break;
case 'n':
args[i].o = va_arg(ap, struct wl_object *);
break;
case 'a':
args[i].a = va_arg(ap, struct wl_array *);
break;
case 'h':
args[i].h = va_arg(ap, int32_t);
break;
case '\0':
return;
}
}
}
struct HandleDeleter {
void operator()(void *handle) {
dlclose(handle);
}
};
using Handle = std::unique_ptr<void, HandleDeleter>;
bool LoadLibrary(Handle &handle, const char *name) {
handle = Handle(dlopen(name, RTLD_LAZY | RTLD_NODELETE));
if (handle) {
return true;
}
std::cerr << dlerror() << std::endl;
return false;
}
template <typename Function>
inline bool LoadSymbol(
const Handle &handle,
const char *name,
Function &func,
bool silent = false) {
func = handle
? reinterpret_cast<Function>(dlsym(handle.get(), name))
: nullptr;
if (const auto error = dlerror(); error && !silent) {
std::cerr << error << std::endl;
}
return (func != nullptr);
}
bool Resolve() {
static const auto loaded = [] {
auto egl = Handle();
auto cursor = Handle();
auto client = Handle();
const auto required = LoadLibrary(egl, "libwayland-egl.so.1")
&& LOAD_SYMBOL(egl, wl_egl_window_create)
&& LOAD_SYMBOL(egl, wl_egl_window_destroy)
&& LOAD_SYMBOL(egl, wl_egl_window_resize)
&& LOAD_SYMBOL(egl, wl_egl_window_get_attached_size)
&& LoadLibrary(cursor, "libwayland-cursor.so.0")
&& LOAD_SYMBOL(cursor, wl_cursor_image_get_buffer)
&& LOAD_SYMBOL(cursor, wl_cursor_theme_load)
&& LOAD_SYMBOL(cursor, wl_cursor_theme_destroy)
&& LOAD_SYMBOL(cursor, wl_cursor_theme_get_cursor)
&& LOAD_SYMBOL(cursor, wl_cursor_frame_and_duration)
&& LoadLibrary(client, "libwayland-client.so.0")
&& LOAD_SYMBOL(client, wl_proxy_destroy)
&& LOAD_SYMBOL(client, wl_proxy_get_version)
&& LOAD_SYMBOL(client, wl_array_init)
&& LOAD_SYMBOL(client, wl_array_release)
&& LOAD_SYMBOL(client, wl_array_add)
&& LOAD_SYMBOL(client, wl_proxy_add_listener)
&& LOAD_SYMBOL(client, wl_proxy_set_user_data)
&& LOAD_SYMBOL(client, wl_proxy_get_user_data)
&& LOAD_SYMBOL(client, wl_display_get_fd)
&& LOAD_SYMBOL(client, wl_display_get_error)
&& LOAD_SYMBOL(client, wl_display_dispatch)
&& LOAD_SYMBOL(client, wl_display_create_queue)
&& LOAD_SYMBOL(client, wl_display_dispatch_queue_pending)
&& LOAD_SYMBOL(client, wl_display_prepare_read_queue)
&& LOAD_SYMBOL(client, wl_display_flush)
&& LOAD_SYMBOL(client, wl_display_cancel_read)
&& LOAD_SYMBOL(client, wl_display_read_events)
&& LOAD_SYMBOL(client, wl_event_queue_destroy)
&& LOAD_SYMBOL(client, wl_display_prepare_read)
&& LOAD_SYMBOL(client, wl_display_dispatch_pending)
&& LOAD_SYMBOL(client, wl_display_connect)
&& LOAD_SYMBOL(client, wl_display_connect_to_fd)
&& LOAD_SYMBOL(client, wl_display_disconnect)
&& LOAD_SYMBOL(client, wl_proxy_create_wrapper)
&& LOAD_SYMBOL(client, wl_proxy_wrapper_destroy)
&& LOAD_SYMBOL(client, wl_proxy_set_queue)
&& LOAD_SYMBOL(client, wl_display_roundtrip)
&& LOAD_SYMBOL(client, wl_proxy_marshal_array_constructor)
&& LOAD_SYMBOL(client, wl_proxy_marshal_array_constructor_versioned)
&& LOAD_SYMBOL(client, wl_proxy_get_id)
&& LOAD_SYMBOL(client, wl_proxy_get_listener);
LOAD_SYMBOL_SILENT(client, wl_proxy_marshal_array_flags);
return required;
}();
return loaded;
}
} // namespace
} // namespace Wayland
namespace W = Wayland;
extern "C" {
struct wl_egl_window *wl_egl_window_create(
struct wl_surface *surface,
int width,
int height) {
Expects(W::wl_egl_window_create != nullptr);
return W::wl_egl_window_create(surface, width, height);
}
void wl_egl_window_destroy(struct wl_egl_window *egl_window) {
Expects(W::wl_egl_window_destroy != nullptr);
W::wl_egl_window_destroy(egl_window);
}
void wl_egl_window_resize(
struct wl_egl_window *egl_window,
int width,
int height,
int dx,
int dy) {
Expects(W::wl_egl_window_resize != nullptr);
W::wl_egl_window_resize(egl_window, width, height, dx, dy);
}
void wl_egl_window_get_attached_size(
struct wl_egl_window *egl_window,
int *width,
int *height) {
Expects(W::wl_egl_window_get_attached_size != nullptr);
W::wl_egl_window_get_attached_size(egl_window, width, height);
}
struct wl_buffer *wl_cursor_image_get_buffer(struct wl_cursor_image *image) {
Expects(W::wl_cursor_image_get_buffer != nullptr);
return W::wl_cursor_image_get_buffer(image);
}
struct wl_cursor_theme *wl_cursor_theme_load(
const char *name,
int size,
struct wl_shm *shm) {
Expects(W::wl_cursor_theme_load != nullptr);
return W::wl_cursor_theme_load(name, size, shm);
}
void wl_cursor_theme_destroy(struct wl_cursor_theme *theme) {
Expects(W::wl_cursor_theme_destroy != nullptr);
W::wl_cursor_theme_destroy(theme);
}
struct wl_cursor *wl_cursor_theme_get_cursor(
struct wl_cursor_theme *theme,
const char *name) {
Expects(W::wl_cursor_theme_get_cursor != nullptr);
return W::wl_cursor_theme_get_cursor(theme, name);
}
int wl_cursor_frame_and_duration(
struct wl_cursor *cursor,
uint32_t time,
uint32_t *duration) {
Expects(W::wl_cursor_frame_and_duration != nullptr);
return W::wl_cursor_frame_and_duration(cursor, time, duration);
}
void wl_proxy_destroy(struct wl_proxy *proxy) {
Expects(W::wl_proxy_destroy != nullptr);
W::wl_proxy_destroy(proxy);
}
uint32_t wl_proxy_get_version(struct wl_proxy *proxy) {
Expects(W::wl_proxy_get_version != nullptr);
return W::wl_proxy_get_version(proxy);
}
void wl_array_init(struct wl_array *array) {
Expects(W::wl_array_init != nullptr);
W::wl_array_init(array);
}
void wl_array_release(struct wl_array *array) {
Expects(W::wl_array_release != nullptr);
W::wl_array_release(array);
}
void *wl_array_add(struct wl_array *array, size_t size) {
Expects(W::wl_array_add != nullptr);
return W::wl_array_add(array, size);
}
int wl_proxy_add_listener(
struct wl_proxy *proxy,
void (**implementation)(void),
void *data) {
Expects(W::wl_proxy_add_listener != nullptr);
return W::wl_proxy_add_listener(proxy, implementation, data);
}
void wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data) {
Expects(W::wl_proxy_set_user_data != nullptr);
W::wl_proxy_set_user_data(proxy, user_data);
}
void *wl_proxy_get_user_data(struct wl_proxy *proxy) {
Expects(W::wl_proxy_get_user_data != nullptr);
return W::wl_proxy_get_user_data(proxy);
}
int wl_display_get_fd(struct wl_display *display) {
Expects(W::wl_display_get_fd != nullptr);
return W::wl_display_get_fd(display);
}
int wl_display_get_error(struct wl_display *display) {
Expects(W::wl_display_get_error != nullptr);
return W::wl_display_get_error(display);
}
int wl_display_dispatch(struct wl_display *display) {
Expects(W::wl_display_dispatch != nullptr);
return W::wl_display_dispatch(display);
}
struct wl_event_queue *wl_display_create_queue(struct wl_display *display) {
Expects(W::wl_display_create_queue != nullptr);
return W::wl_display_create_queue(display);
}
int wl_display_dispatch_queue_pending(
struct wl_display *display,
struct wl_event_queue *queue) {
Expects(W::wl_display_dispatch_queue_pending != nullptr);
return W::wl_display_dispatch_queue_pending(display, queue);
}
int wl_display_prepare_read_queue(
struct wl_display *display,
struct wl_event_queue *queue) {
Expects(W::wl_display_prepare_read_queue != nullptr);
return W::wl_display_prepare_read_queue(display, queue);
}
int wl_display_flush(struct wl_display *display) {
Expects(W::wl_display_flush != nullptr);
return W::wl_display_flush(display);
}
void wl_display_cancel_read(struct wl_display *display) {
Expects(W::wl_display_cancel_read != nullptr);
W::wl_display_cancel_read(display);
}
int wl_display_read_events(struct wl_display *display) {
Expects(W::wl_display_read_events != nullptr);
return W::wl_display_read_events(display);
}
void wl_event_queue_destroy(struct wl_event_queue *queue) {
Expects(W::wl_event_queue_destroy != nullptr);
W::wl_event_queue_destroy(queue);
}
int wl_display_prepare_read(struct wl_display *display) {
Expects(W::wl_display_prepare_read != nullptr);
return W::wl_display_prepare_read(display);
}
int wl_display_dispatch_pending(struct wl_display *display) {
Expects(W::wl_display_dispatch_pending != nullptr);
return W::wl_display_dispatch_pending(display);
}
struct wl_display *wl_display_connect(const char *name) {
if (!W::Resolve()) {
errno = ENOENT;
return nullptr;
}
return W::wl_display_connect(name);
}
struct wl_display *wl_display_connect_to_fd(int fd) {
if (!W::Resolve()) {
errno = ENOENT;
return nullptr;
}
return W::wl_display_connect_to_fd(fd);
}
void wl_display_disconnect(struct wl_display *display) {
Expects(W::wl_display_disconnect != nullptr);
W::wl_display_disconnect(display);
}
void *wl_proxy_create_wrapper(void *proxy) {
Expects(W::wl_proxy_create_wrapper != nullptr);
return W::wl_proxy_create_wrapper(proxy);
}
void wl_proxy_wrapper_destroy(void *proxy_wrapper) {
Expects(W::wl_proxy_wrapper_destroy != nullptr);
W::wl_proxy_wrapper_destroy(proxy_wrapper);
}
void wl_proxy_set_queue(
struct wl_proxy *proxy,
struct wl_event_queue *queue) {
Expects(W::wl_proxy_set_queue != nullptr);
W::wl_proxy_set_queue(proxy, queue);
}
int wl_display_roundtrip(struct wl_display *display) {
Expects(W::wl_display_roundtrip != nullptr);
return W::wl_display_roundtrip(display);
}
struct wl_proxy *wl_proxy_marshal_array_constructor(
struct wl_proxy *proxy,
uint32_t opcode,
union wl_argument *args,
const struct wl_interface *interface) {
Expects(W::wl_proxy_marshal_array_constructor != nullptr);
return W::wl_proxy_marshal_array_constructor(
proxy,
opcode,
args,
interface);
}
struct wl_proxy *wl_proxy_marshal_array_constructor_versioned(
struct wl_proxy *proxy,
uint32_t opcode,
union wl_argument *args,
const struct wl_interface *interface,
uint32_t version) {
Expects(W::wl_proxy_marshal_array_constructor_versioned != nullptr);
return W::wl_proxy_marshal_array_constructor_versioned(
proxy,
opcode,
args,
interface,
version);
}
struct wl_proxy *wl_proxy_marshal_array_flags(
struct wl_proxy *proxy,
uint32_t opcode,
const struct wl_interface *interface,
uint32_t version,
uint32_t flags,
union wl_argument *args) {
Expects(W::wl_proxy_marshal_array_flags != nullptr);
return W::wl_proxy_marshal_array_flags(
proxy,
opcode,
interface,
version,
flags,
args);
}
uint32_t wl_proxy_get_id(struct wl_proxy *proxy) {
Expects(W::wl_proxy_get_id != nullptr);
return W::wl_proxy_get_id(proxy);
}
const void *wl_proxy_get_listener(struct wl_proxy *proxy) {
Expects(W::wl_proxy_get_listener != nullptr);
return W::wl_proxy_get_listener(proxy);
}
void wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...) {
union wl_argument args[W::WL_CLOSURE_MAX_ARGS];
va_list ap;
va_start(ap, opcode);
// wl_proxy { wl_object { wl_interface *, ... }, ... }
struct wl_object *object = (struct wl_object*)proxy;
struct wl_interface *interface = *((struct wl_interface**)object);
W::wl_argument_from_va_list(
interface->methods[opcode].signature,
args,
W::WL_CLOSURE_MAX_ARGS,
ap);
va_end(ap);
wl_proxy_marshal_array_constructor(proxy, opcode, args, nullptr);
}
struct wl_proxy *wl_proxy_marshal_constructor(
struct wl_proxy *proxy,
uint32_t opcode,
const struct wl_interface *interface,
...) {
union wl_argument args[W::WL_CLOSURE_MAX_ARGS];
va_list ap;
va_start(ap, interface);
// wl_proxy { wl_object { wl_interface *, ... }, ... }
struct wl_object *object = (struct wl_object*)proxy;
struct wl_interface *i = *((struct wl_interface**)object);
W::wl_argument_from_va_list(
i->methods[opcode].signature,
args,
W::WL_CLOSURE_MAX_ARGS,
ap);
va_end(ap);
return wl_proxy_marshal_array_constructor(proxy, opcode, args, interface);
}
struct wl_proxy *wl_proxy_marshal_constructor_versioned(
struct wl_proxy *proxy,
uint32_t opcode,
const struct wl_interface *interface,
uint32_t version,
...) {
union wl_argument args[W::WL_CLOSURE_MAX_ARGS];
va_list ap;
va_start(ap, version);
// wl_proxy { wl_object { wl_interface *, ... }, ... }
struct wl_object *object = (struct wl_object*)proxy;
struct wl_interface *i = *((struct wl_interface**)object);
W::wl_argument_from_va_list(
i->methods[opcode].signature,
args,
W::WL_CLOSURE_MAX_ARGS,
ap);
va_end(ap);
return wl_proxy_marshal_array_constructor_versioned(proxy, opcode,
args, interface,
version);
}
struct wl_proxy *wl_proxy_marshal_flags(
struct wl_proxy *proxy,
uint32_t opcode,
const struct wl_interface *interface,
uint32_t version,
uint32_t flags,
...) {
union wl_argument args[W::WL_CLOSURE_MAX_ARGS];
va_list ap;
va_start(ap, flags);
// wl_proxy { wl_object { wl_interface *, ... }, ... }
struct wl_object *object = (struct wl_object*)proxy;
struct wl_interface *i = *((struct wl_interface**)object);
W::wl_argument_from_va_list(
i->methods[opcode].signature,
args,
W::WL_CLOSURE_MAX_ARGS,
ap);
va_end(ap);
if (W::wl_proxy_marshal_array_flags == nullptr) {
const auto result = wl_proxy_marshal_array_constructor_versioned(
proxy,
opcode,
args,
interface,
version);
if (flags & WL_MARSHAL_FLAG_DESTROY) {
wl_proxy_destroy(proxy);
}
return result;
}
return wl_proxy_marshal_array_flags(
proxy,
opcode,
interface,
version,
flags,
args);
}
} // extern "C"

View file

@ -1,14 +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
add_library(linux_xcb_helper STATIC)
init_target(linux_xcb_helper "(external)")
add_library(desktop-app::linux_xcb_helper ALIAS linux_xcb_helper)
nice_target_sources(linux_xcb_helper ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
linux_xcb_helper.cpp
)

View file

@ -1,53 +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
//
#include <dlfcn.h>
#include <stdlib.h>
#include <xcb/xcb.h>
#include <xcb/xcbext.h>
unsigned int xcb_send_request_with_fds(
xcb_connection_t *c,
int flags,
struct iovec *vector,
const xcb_protocol_request_t *req,
unsigned int num_fds,
int *fds) {
const auto send_request_with_fds = reinterpret_cast<unsigned int(*)(
xcb_connection_t*,
int,
struct iovec*,
const xcb_protocol_request_t*,
unsigned int,
int*)>(dlsym(RTLD_NEXT, "xcb_send_request_with_fds"));
if (!dlerror()) {
return send_request_with_fds(c, flags, vector, req, num_fds, fds);
}
const auto send_fd = reinterpret_cast<void(*)(xcb_connection_t*, int)>(
dlsym(RTLD_NEXT, "xcb_send_fd"));
if (dlerror()) {
abort();
}
const auto send_request = reinterpret_cast<unsigned int(*)(
xcb_connection_t*,
int,
struct iovec*,
const xcb_protocol_request_t*)>(dlsym(RTLD_NEXT, "xcb_send_request"));
if (dlerror()) {
abort();
}
for (int i = 0; i != num_fds; ++i) {
send_fd(c, fds[i]);
}
return send_request(c, flags, vector, req);
}

View file

@ -5,9 +5,6 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
function(nice_target_sources target_name src_loc) function(nice_target_sources target_name src_loc)
set(list ${ARGV})
list(REMOVE_AT list 0 1)
set(writing_now "") set(writing_now "")
set(private_sources "") set(private_sources "")
set(public_sources "") set(public_sources "")
@ -15,7 +12,7 @@ function(nice_target_sources target_name src_loc)
set(not_win_sources "") set(not_win_sources "")
set(not_mac_sources "") set(not_mac_sources "")
set(not_linux_sources "") set(not_linux_sources "")
foreach (entry ${list}) foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry}) set(writing_now ${entry})
else() else()
@ -71,11 +68,8 @@ function(nice_target_sources target_name src_loc)
endfunction() endfunction()
function(remove_target_sources target_name src_loc) function(remove_target_sources target_name src_loc)
set(list ${ARGV})
list(REMOVE_AT list 0 1)
set(sources "") set(sources "")
foreach (entry ${list}) foreach (entry ${ARGN})
set(full_name ${src_loc}/${entry}) set(full_name ${src_loc}/${entry})
list(APPEND sources ${full_name}) list(APPEND sources ${full_name})
endforeach() endforeach()

View file

@ -8,7 +8,7 @@ function(nuget_add_package package_name package package_version)
get_property(nuget_exe_defined GLOBAL PROPERTY nuget_exe_path_property SET) get_property(nuget_exe_defined GLOBAL PROPERTY nuget_exe_path_property SET)
if (NOT nuget_exe_defined) if (NOT nuget_exe_defined)
# Thanks https://github.com/clarkezone/flutter_win_webview/blob/master/webview_popupauth/windows/CMakeLists.txt # Thanks https://github.com/clarkezone/flutter_win_webview/blob/master/webview_popupauth/windows/CMakeLists.txt
find_program(NUGET_EXE NAMES nuget) find_program(NUGET_EXE NAMES nuget PATHS "${CMAKE_SOURCE_DIR}/../ThirdParty/NuGet")
if (NOT NUGET_EXE) if (NOT NUGET_EXE)
message("NUGET.EXE not found.") message("NUGET.EXE not found.")
message(FATAL_ERROR "Please install this executable, and run CMake again.") message(FATAL_ERROR "Please install this executable, and run CMake again.")
@ -45,7 +45,7 @@ function(nuget_add_package package_name package package_version)
endfunction() endfunction()
function(nuget_add_webview target_name) function(nuget_add_webview target_name)
nuget_add_package(webview2 "Microsoft.Web.WebView2" 1.0.864.35) nuget_add_package(webview2 "Microsoft.Web.WebView2" 1.0.1901.177)
set(webview2_loc_native ${webview2_loc}/build/native) set(webview2_loc_native ${webview2_loc}/build/native)
# target_link_libraries(${target_name} # target_link_libraries(${target_name}
@ -77,7 +77,14 @@ function(nuget_add_winrt target_name)
set(gen_dst ${CMAKE_BINARY_DIR}/packages/gen) set(gen_dst ${CMAKE_BINARY_DIR}/packages/gen)
file(MAKE_DIRECTORY ${gen_dst}/winrt) file(MAKE_DIRECTORY ${gen_dst}/winrt)
set(winrt_sdk_version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}) set(winrt_sdk_version)
if (NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
endif()
# https://gitlab.kitware.com/cmake/cmake/-/blob/89cfb90b9c0893133983b4f25896671c4f07497c/Modules/InstallRequiredSystemLibraries.cmake#L381
if (";${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION};$ENV{UCRTVersion};$ENV{WindowsSDKVersion};" MATCHES [=[;([0-9.]+)[;\]]=])
set(winrt_sdk_version ${CMAKE_MATCH_1})
endif()
set(winrt_version_key ${gen_dst}/winrt/version_key) set(winrt_version_key ${gen_dst}/winrt/version_key)
set(winrt_version_test ${winrt_version_key}_test) set(winrt_version_test ${winrt_version_key}_test)
set(sdk_version_key ${gen_dst}/winrt/sdk_version_key) set(sdk_version_key ${gen_dst}/winrt/sdk_version_key)

View file

@ -13,22 +13,9 @@ INTERFACE
QT_NO_KEYWORDS QT_NO_KEYWORDS
QT_NO_CAST_FROM_BYTEARRAY QT_NO_CAST_FROM_BYTEARRAY
QT_IMPLICIT_QCHAR_CONSTRUCTION QT_IMPLICIT_QCHAR_CONSTRUCTION
QT_DEPRECATED_WARNINGS_SINCE=0x051500
) )
if (DESKTOP_APP_DISABLE_CRASH_REPORTS)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_DISABLE_CRASH_REPORTS
)
endif()
if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_DISABLE_DBUS_INTEGRATION
)
endif()
if (DESKTOP_APP_DISABLE_X11_INTEGRATION) if (DESKTOP_APP_DISABLE_X11_INTEGRATION)
target_compile_definitions(common_options target_compile_definitions(common_options
INTERFACE INTERFACE
@ -36,48 +23,6 @@ if (DESKTOP_APP_DISABLE_X11_INTEGRATION)
) )
endif() endif()
if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
)
endif()
if (DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_USE_PACKAGED
)
endif()
if (DESKTOP_APP_USE_PACKAGED_LAZY)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_USE_PACKAGED_LAZY
)
endif()
if (DESKTOP_APP_USE_PACKAGED_FONTS)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_USE_PACKAGED_FONTS
)
endif()
if (DESKTOP_APP_USE_PACKAGED_RLOTTIE)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_USE_PACKAGED_RLOTTIE
)
endif()
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_SPECIAL_TARGET=${DESKTOP_APP_SPECIAL_TARGET}
)
endif()
if (WIN32) if (WIN32)
include(cmake/options_win.cmake) include(cmake/options_win.cmake)
elseif (APPLE) elseif (APPLE)

View file

@ -6,68 +6,97 @@
target_compile_options(common_options target_compile_options(common_options
INTERFACE INTERFACE
-fstack-protector-all
-fstack-clash-protection
-fPIC -fPIC
$<IF:$<CONFIG:Debug>,,-fno-strict-aliasing> $<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing>
-pipe -pipe
)
target_compile_options_if_exists(common_options
INTERFACE
-Wall -Wall
-W -Wextra
-Wno-unused-parameter -Wno-unused-parameter
-Wno-switch -Wno-switch
-Wno-maybe-uninitialized
-Wno-missing-field-initializers -Wno-missing-field-initializers
-Wno-sign-compare -Wno-sign-compare
-Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20 -Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20
) )
target_compile_definitions(common_options target_link_options_if_exists(common_options
INTERFACE
$<IF:$<CONFIG:Debug>,,_FORTIFY_SOURCE=2>
_GLIBCXX_ASSERTIONS
)
target_link_options(common_options
INTERFACE INTERFACE
-Wno-alloc-size-larger-than # Qt + LTO
-Wno-stringop-overflow # Qt + LTO
-Wno-odr # Qt + LTO
-Wno-inline # OpenAL + LTO
-pthread
-Wl,--as-needed -Wl,--as-needed
) )
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(common_options
INTERFACE
-Wno-maybe-uninitialized
)
endif()
# TODO: Remove when there will be no Qt 5 support
if (DESKTOP_APP_QT6)
target_compile_options(common_options
INTERFACE
-Wno-deprecated-declarations
)
endif()
if (DESKTOP_APP_SPECIAL_TARGET) if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_options(common_options target_compile_options(common_options
INTERFACE INTERFACE
$<IF:$<CONFIG:Debug>,,-Ofast>
-Werror -Werror
$<$<NOT:$<CONFIG:Debug>>:-g>
$<$<NOT:$<CONFIG:Debug>>:-flto=auto>
) )
target_link_options(common_options target_link_options(common_options
INTERFACE INTERFACE
$<IF:$<CONFIG:Debug>,,-Ofast> $<$<NOT:$<CONFIG:Debug>>:-flto=auto>
$<$<NOT:$<CONFIG:Debug>>:-fwhole-program>
) )
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>)
endif() endif()
target_link_libraries(common_options if (NOT DESKTOP_APP_USE_PACKAGED)
INTERFACE if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
$<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> target_link_options(common_options
$<LINK_ONLY:desktop-app::external_jemalloc> INTERFACE
${CMAKE_DL_LIBS} -static-libstdc++
) )
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_static_libraries(common_options
INTERFACE
c++
c++abi
)
target_link_options(common_options
INTERFACE
-nostdlib++
)
endif()
set(interprocedural_optimization_config $<TARGET_PROPERTY:INTERPROCEDURAL_OPTIMIZATION_$<UPPER_CASE:$<CONFIG>>>)
set(interprocedural_optimization_value_on -fwhole-program)
set(interprocedural_optimization_value_off -fuse-ld=lld -fno-use-linker-plugin)
set(interprocedural_optimization_values ${interprocedural_optimization_value_on},$<$<OR:$<NOT:$<BOOL:${DESKTOP_APP_SPECIAL_TARGET}>>,$<CONFIG:Debug>>:${interprocedural_optimization_value_off}>)
target_link_options(common_options
INTERFACE
$<IF:$<NOT:$<STREQUAL:${interprocedural_optimization_config},>>,$<IF:$<BOOL:${interprocedural_optimization_config}>,${interprocedural_optimization_values}>,$<IF:$<BOOL:$<TARGET_PROPERTY:INTERPROCEDURAL_OPTIMIZATION>>,${interprocedural_optimization_values}>>
-rdynamic
-Wl,-z,muldefs
)
endif()
if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET)
target_compile_options_if_exists(common_options
INTERFACE
-fno-omit-frame-pointer
-fstack-protector-all
-fstack-clash-protection
-fcf-protection
)
target_link_options(common_options
INTERFACE
-Wl,-z,relro
-Wl,-z,now
-Wl,-z,noexecstack
-pie
)
target_compile_definitions(common_options
INTERFACE
$<$<NOT:$<CONFIG:Debug>>:_FORTIFY_SOURCE=3>
_GLIBCXX_ASSERTIONS
)
endif()
if (DESKTOP_APP_USE_ALLOCATION_TRACER) if (DESKTOP_APP_USE_ALLOCATION_TRACER)
target_link_options(common_options target_link_options(common_options
@ -92,38 +121,7 @@ if (DESKTOP_APP_USE_ALLOCATION_TRACER)
) )
endif() endif()
if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(common_options
set(THREADS_PREFER_PTHREAD_FLAG ON) INTERFACE
find_package(Threads REQUIRED) ${CMAKE_DL_LIBS}
target_link_libraries(common_options )
INTERFACE
Threads::Threads
)
else()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_options(common_options
INTERFACE
-static-libstdc++
-static-libgcc
)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_static_libraries(common_options
INTERFACE
c++
c++abi
)
target_link_options(common_options
INTERFACE
-nostdlib++
)
endif()
target_link_options(common_options
INTERFACE
-pthread
-rdynamic
-fwhole-program
-Wl,-z,relro
-Wl,-z,now
# -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601
)
endif()

View file

@ -22,12 +22,11 @@ target_compile_options(common_options
INTERFACE INTERFACE
-pipe -pipe
-Wall -Wall
-W -Wextra
-fPIE -fPIE
$<$<COMPILE_LANGUAGE:OBJC,OBJCXX>:-fobjc-weak> $<$<COMPILE_LANGUAGE:OBJC,OBJCXX>:-fobjc-weak>
-fvisibility-inlines-hidden -fvisibility-inlines-hidden
-fvisibility=hidden -fvisibility=hidden
-Wno-deprecated-declarations # temp for range-v3
-Wno-unused-variable -Wno-unused-variable
-Wno-unused-parameter -Wno-unused-parameter
-Wno-unused-function -Wno-unused-function
@ -37,6 +36,7 @@ INTERFACE
-Wno-sign-compare -Wno-sign-compare
-Wno-unknown-attributes -Wno-unknown-attributes
-Wno-pragma-system-header-outside-header -Wno-pragma-system-header-outside-header
-Wno-shorten-64-to-32
) )
if (DESKTOP_APP_SPECIAL_TARGET) if (DESKTOP_APP_SPECIAL_TARGET)
@ -47,11 +47,6 @@ if (DESKTOP_APP_SPECIAL_TARGET)
) )
endif() endif()
target_link_options(common_options
INTERFACE
-Wl,-no_compact_unwind
)
target_link_frameworks(common_options target_link_frameworks(common_options
INTERFACE INTERFACE
Cocoa Cocoa

View file

@ -7,9 +7,20 @@
target_compile_definitions(common_options target_compile_definitions(common_options
INTERFACE INTERFACE
WIN32 WIN32
WIN32_LEAN_AND_MEAN
_WINDOWS _WINDOWS
_SCL_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS
NOMINMAX NOMINMAX
NOSERVICE
NOMCX
NOIME
NOSOUND
NOCOMM
NOKANJI
NORPC
NOPROXYSTUB
NOIMAGE
NOTAPE
UNICODE UNICODE
_UNICODE _UNICODE
) )
@ -19,6 +30,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
/bigobj # scheme.cpp and history_widget.cpp has too many sections. /bigobj # scheme.cpp and history_widget.cpp has too many sections.
/permissive- /permissive-
# /Qspectre # /Qspectre
/utf-8
/W1 /W1
/WX /WX
/MP # Enable multi process build. /MP # Enable multi process build.
@ -38,8 +50,20 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
INTERFACE INTERFACE
$<IF:$<CONFIG:Debug>,/NODEFAULTLIB:LIBCMT,/DEBUG;/OPT:REF> $<IF:$<CONFIG:Debug>,/NODEFAULTLIB:LIBCMT,/DEBUG;/OPT:REF>
$<$<BOOL:${DESKTOP_APP_NO_PDB}>:/DEBUG:NONE> $<$<BOOL:${DESKTOP_APP_NO_PDB}>:/DEBUG:NONE>
/INCREMENTAL:NO
) )
if (DESKTOP_APP_ASAN)
target_compile_options(common_options INTERFACE /fsanitize=address)
# https://developercommunity.visualstudio.com/t/Linker-error-LNK2038-when-using-Parallel/10512721
target_compile_definitions(common_options
INTERFACE
_DISABLE_VECTOR_ANNOTATION
_DISABLE_STRING_ANNOTATION
)
endif()
if (NOT build_win64) if (NOT build_win64)
# target_compile_options(common_options # target_compile_options(common_options
# INTERFACE # INTERFACE
@ -50,6 +74,18 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
/LARGEADDRESSAWARE # Allow more than 2 GB in 32 bit application. /LARGEADDRESSAWARE # Allow more than 2 GB in 32 bit application.
) )
endif() endif()
if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_options(common_options
INTERFACE
$<IF:$<CONFIG:Debug>,,/GL>
)
target_link_options(common_options
INTERFACE
$<IF:$<CONFIG:Debug>,,/LTCG>
$<IF:$<CONFIG:Debug>,,/LTCGOUT:>
)
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_definitions(common_options target_compile_definitions(common_options
INTERFACE INTERFACE

View file

@ -11,25 +11,26 @@ def run(project, arguments, buildType=''):
basePath = scriptPath + '/../out/' + buildType basePath = scriptPath + '/../out/' + buildType
cmake = ['cmake'] cmake = ['cmake']
windowsArch = '' vsArch = ''
explicitGenerator = False explicitGenerator = False
for arg in arguments: for arg in arguments:
if arg == 'debug': if arg == 'debug':
cmake.append('-DCMAKE_BUILD_TYPE=Debug') cmake.append('-DCMAKE_BUILD_TYPE=Debug')
elif arg == 'x86' or arg == 'x64': elif arg == 'x86' or arg == 'x64':
windowsArch = arg vsArch = arg
elif arg != 'force': elif arg != 'force':
if arg.startswith('-G'): if arg.startswith('-G'):
explicitGenerator = True explicitGenerator = True
cmake.append(arg) cmake.append(arg)
if sys.platform == 'win32': if sys.platform == 'win32' and (vsArch == 'x64' or os.environ['Platform'] == 'x64'):
if windowsArch == 'x64': basePath = scriptPath + '/../out64/' + buildType
if sys.platform == 'win32' and not explicitGenerator:
if vsArch == 'x64':
cmake.append('-Ax64') cmake.append('-Ax64')
basePath = scriptPath + '/../out64/' + buildType
else: else:
cmake.append('-AWin32') # default cmake.append('-AWin32') # default
elif windowsArch != '': elif vsArch != '':
print("[ERROR] x86/x64 switch is supported only on Windows.") print("[ERROR] x86/x64 switch is supported only with Visual Studio.")
return 1 return 1
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
if not explicitGenerator: if not explicitGenerator:
@ -59,7 +60,8 @@ def run(project, arguments, buildType=''):
elif 'force' in arguments: elif 'force' in arguments:
paths = os.listdir(basePath) paths = os.listdir(basePath)
for path in paths: for path in paths:
if path.lower().startswith('cmake'): low = path.lower();
if not low.startswith('debug') and not low.startswith('release'):
full = basePath + '/' + path full = basePath + '/' + path
if os.path.isdir(full): if os.path.isdir(full):
shutil.rmtree(full, ignore_errors=False) shutil.rmtree(full, ignore_errors=False)
@ -67,6 +69,4 @@ def run(project, arguments, buildType=''):
os.remove(full) os.remove(full)
print('Cleared previous.') print('Cleared previous.')
os.chdir(basePath) os.chdir(basePath)
subprocess.call(command, shell=True) return subprocess.call(command, shell=True)
return 0

View file

@ -0,0 +1,43 @@
# 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
include(CheckCXXCompilerFlag)
function(target_compile_options_if_exists target_name)
set(writing_now "")
set(private_options "")
set(public_options "")
set(interface_options "")
foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry})
else()
string(MAKE_C_IDENTIFIER ${entry} entry_identifier)
check_cxx_compiler_flag(${entry} DESKTOP_APP_${entry_identifier}_EXISTS)
if (DESKTOP_APP_${entry_identifier}_EXISTS)
if ("${writing_now}" STREQUAL "PRIVATE")
list(APPEND private_options ${entry})
elseif ("${writing_now}" STREQUAL "PUBLIC")
list(APPEND public_options ${entry})
elseif ("${writing_now}" STREQUAL "INTERFACE")
list(APPEND interface_options ${entry})
else()
message(FATAL_ERROR "Unknown options scope for target ${target_name}")
endif()
endif()
endif()
endforeach()
if (NOT "${public_options}" STREQUAL "")
target_compile_options(${target_name} PUBLIC ${public_options})
endif()
if (NOT "${private_options}" STREQUAL "")
target_compile_options(${target_name} PRIVATE ${private_options})
endif()
if (NOT "${interface_options}" STREQUAL "")
target_compile_options(${target_name} INTERFACE ${interface_options})
endif()
endfunction()

View file

@ -4,19 +4,16 @@
# 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
function(target_link_frameworks target_name) function(target_link_frameworks_generic type target_name)
set(list ${ARGV})
list(REMOVE_AT list 0)
set(writing_now "") set(writing_now "")
set(private_frameworks "") set(private_frameworks "")
set(public_frameworks "") set(public_frameworks "")
set(interface_frameworks "") set(interface_frameworks "")
foreach (entry ${list}) foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry}) set(writing_now ${entry})
else() else()
set(full_argument "-framework ${entry}") set(full_argument "${type} ${entry}")
if ("${writing_now}" STREQUAL "PRIVATE") if ("${writing_now}" STREQUAL "PRIVATE")
list(APPEND private_frameworks ${full_argument}) list(APPEND private_frameworks ${full_argument})
elseif ("${writing_now}" STREQUAL "PUBLIC") elseif ("${writing_now}" STREQUAL "PUBLIC")
@ -39,3 +36,11 @@ function(target_link_frameworks target_name)
target_link_libraries(${target_name} INTERFACE ${interface_frameworks}) target_link_libraries(${target_name} INTERFACE ${interface_frameworks})
endif() endif()
endfunction() endfunction()
function(target_link_frameworks)
target_link_frameworks_generic("-framework" ${ARGN})
endfunction()
function(target_link_frameworks_weak)
target_link_frameworks_generic("-weak_framework" ${ARGN})
endfunction()

View file

@ -0,0 +1,87 @@
# 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(generate_implib)
find_package(Python3 REQUIRED)
set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen)
file(MAKE_DIRECTORY ${gen_dst})
foreach (lib ${ARGN})
string(MAKE_C_IDENTIFIER ${lib} lib_identifier)
find_library(DESKTOP_APP_${lib_identifier}_PATH ${lib} REQUIRED)
get_filename_component(lib_file ${DESKTOP_APP_${lib_identifier}_PATH} NAME)
set(gen_timestamp ${gen_dst}/implib_${lib_identifier}.timestamp)
set(gen_files
${gen_dst}/${lib_file}.init.c
${gen_dst}/${lib_file}.tramp.S
)
add_custom_command(
OUTPUT
${gen_timestamp}
BYPRODUCTS
${gen_files}
COMMAND
${Python3_EXECUTABLE}
${cmake_helpers_loc}/external/Implib.so/implib-gen.py
-q
-o
${gen_dst}
${DESKTOP_APP_${lib_identifier}_PATH}
COMMAND
echo 1> ${gen_timestamp}
COMMENT "Generating dlopen helper for ${lib_file}"
DEPENDS
${DESKTOP_APP_${lib_identifier}_PATH}
)
add_library(implib_${lib_identifier} STATIC)
init_target(implib_${lib_identifier} "(gen)")
generate_target(implib_${lib_identifier} timestamp ${gen_timestamp} "${gen_files}" ${gen_dst})
endforeach()
endfunction()
function(target_link_optional_libraries target_name)
set(writing_now "")
set(private_libs "")
set(public_libs "")
set(interface_libs "")
foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry})
else()
string(MAKE_C_IDENTIFIER ${entry} entry_identifier)
if (NOT TARGET implib_${entry_identifier})
generate_implib(${entry})
endif()
set(result
$<LINK_ONLY:implib_${entry_identifier}>
$<TARGET_FILE:implib_${entry_identifier}>
)
if ("${writing_now}" STREQUAL "PRIVATE")
list(APPEND private_libs ${result})
elseif ("${writing_now}" STREQUAL "PUBLIC")
list(APPEND public_libs ${result})
elseif ("${writing_now}" STREQUAL "INTERFACE")
list(APPEND interface_libs ${result})
else()
message(FATAL_ERROR "Unknown libraries scope for target ${target_name}")
endif()
endif()
endforeach()
if (NOT "${public_libs}" STREQUAL "")
target_link_libraries(${target_name} PUBLIC ${public_libs})
endif()
if (NOT "${private_libs}" STREQUAL "")
target_link_libraries(${target_name} PRIVATE ${private_libs})
endif()
if (NOT "${interface_libs}" STREQUAL "")
target_link_libraries(${target_name} INTERFACE ${interface_libs})
endif()
endfunction()

View file

@ -0,0 +1,43 @@
# 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
include(CheckLinkerFlag)
function(target_link_options_if_exists target_name)
set(writing_now "")
set(private_options "")
set(public_options "")
set(interface_options "")
foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry})
else()
string(MAKE_C_IDENTIFIER ${entry} entry_identifier)
check_linker_flag(CXX ${entry} DESKTOP_APP_${entry_identifier}_EXISTS)
if (DESKTOP_APP_${entry_identifier}_EXISTS)
if ("${writing_now}" STREQUAL "PRIVATE")
list(APPEND private_options ${entry})
elseif ("${writing_now}" STREQUAL "PUBLIC")
list(APPEND public_options ${entry})
elseif ("${writing_now}" STREQUAL "INTERFACE")
list(APPEND interface_options ${entry})
else()
message(FATAL_ERROR "Unknown options scope for target ${target_name}")
endif()
endif()
endif()
endforeach()
if (NOT "${public_options}" STREQUAL "")
target_link_options(${target_name} PUBLIC ${public_options})
endif()
if (NOT "${private_options}" STREQUAL "")
target_link_options(${target_name} PRIVATE ${private_options})
endif()
if (NOT "${interface_options}" STREQUAL "")
target_link_options(${target_name} INTERFACE ${interface_options})
endif()
endfunction()

View file

@ -5,14 +5,11 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
function(target_link_static_libraries target_name) function(target_link_static_libraries target_name)
set(list ${ARGV})
list(REMOVE_AT list 0)
set(writing_now "") set(writing_now "")
set(private_libs "") set(private_libs "")
set(public_libs "") set(public_libs "")
set(interface_libs "") set(interface_libs "")
foreach (entry ${list}) foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry}) set(writing_now ${entry})
else() else()
@ -24,7 +21,7 @@ function(target_link_static_libraries target_name)
elseif ("${writing_now}" STREQUAL "INTERFACE") elseif ("${writing_now}" STREQUAL "INTERFACE")
list(APPEND interface_libs ${link_option}) list(APPEND interface_libs ${link_option})
else() else()
message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}") message(FATAL_ERROR "Unknown libraries scope for target ${target_name}")
endif() endif()
endif() endif()
endforeach() endforeach()

View file

@ -5,8 +5,7 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
function(target_add_resource target_name) function(target_add_resource target_name)
set(list ${ARGV}) set(list ${ARGN})
list(REMOVE_AT list 0)
target_sources(${target_name} PRIVATE ${list}) target_sources(${target_name} PRIVATE ${list})
get_target_property(existing_resources ${target_name} RESOURCE) get_target_property(existing_resources ${target_name} RESOURCE)
if (NOT "${existing_resources}" STREQUAL "existing_resources-NOTFOUND") if (NOT "${existing_resources}" STREQUAL "existing_resources-NOTFOUND")
@ -23,25 +22,24 @@ function(target_prepare_qrc target_name)
else() else()
set(rcc_flags --binary "$<TARGET_PROPERTY:${target_name},AUTORCC_OPTIONS>") set(rcc_flags --binary "$<TARGET_PROPERTY:${target_name},AUTORCC_OPTIONS>")
set(qrc_files_all "$<FILTER:$<TARGET_PROPERTY:${target_name},SOURCES>,INCLUDE,\\.qrc$>") set(qrc_files)
if (WIN32) get_target_property(list ${target_name} SOURCES)
set(qrc_files "$<FILTER:${qrc_files_all},EXCLUDE,(mac|darwin|osx|linux|posix)\\.>") foreach (entry ${list})
elseif (APPLE) get_source_file_property(skip_autogen ${entry} SKIP_AUTOGEN)
set(qrc_files "$<FILTER:${qrc_files_all},EXCLUDE,(win|linux)\\.>") if (NOT ${entry} MATCHES "\\.qrc$" OR skip_autogen)
elseif (LINUX) continue()
set(qrc_files "$<FILTER:${qrc_files_all},EXCLUDE,(win|mac|darwin|osx)\\.>") endif()
list(APPEND qrc_files ${entry})
endforeach()
if (NOT qrc_files)
return()
endif() endif()
set(rcc_file ${target_name}.rcc) set(rcc_file ${target_name}.rcc)
set(rcc_path "${CMAKE_BINARY_DIR}/${rcc_file}") set(rcc_path "${CMAKE_BINARY_DIR}/${rcc_file}")
source_group(TREE ${CMAKE_BINARY_DIR} PREFIX Resources FILES ${rcc_path}) source_group(TREE ${CMAKE_BINARY_DIR} PREFIX Resources FILES ${rcc_path})
if (DESKTOP_APP_QT6)
set(rcc_binary Qt6::rcc)
else()
set(rcc_binary Qt5::rcc)
endif()
add_custom_command(OUTPUT ${rcc_path} add_custom_command(OUTPUT ${rcc_path}
DEPENDS ${qrc_files} DEPENDS ${qrc_files}
COMMAND ${rcc_binary} ${rcc_flags} -o ${rcc_path} ${qrc_files} COMMAND Qt::rcc ${rcc_flags} -o ${rcc_path} ${qrc_files}
COMMAND_EXPAND_LISTS VERBATIM COMMAND_EXPAND_LISTS VERBATIM
) )
target_add_resource(${target_name} ${rcc_path}) target_add_resource(${target_name} ${rcc_path})

View file

@ -21,7 +21,7 @@ function(validate_d3d_compiler target_name)
set(modules_hash_loc ${CMAKE_BINARY_DIR}/modules/${modules_subdir}) set(modules_hash_loc ${CMAKE_BINARY_DIR}/modules/${modules_subdir})
set(modules_debug_loc ${CMAKE_BINARY_DIR}/Debug/modules/${modules_subdir}) set(modules_debug_loc ${CMAKE_BINARY_DIR}/Debug/modules/${modules_subdir})
set(modules_release_loc ${CMAKE_BINARY_DIR}/Release/modules/${modules_subdir}) set(modules_release_loc ${CMAKE_BINARY_DIR}/Release/modules/${modules_subdir})
set(key_path ${modules_hash_loc}/d3d/d3dcompiler_47) set(key_path ${modules_hash_loc}/d3d/d3dcompiler_47)
set(module_debug_path ${modules_debug_loc}/d3d) set(module_debug_path ${modules_debug_loc}/d3d)
set(module_release_path ${modules_release_loc}/d3d) set(module_release_path ${modules_release_loc}/d3d)
@ -39,17 +39,17 @@ function(validate_d3d_compiler target_name)
if (NOT "${key_length}" STREQUAL "32" if (NOT "${key_length}" STREQUAL "32"
OR NOT EXISTS ${module_debug_path}/d3dcompiler_47.dll OR NOT EXISTS ${module_debug_path}/d3dcompiler_47.dll
OR NOT EXISTS ${module_release_path}/d3dcompiler_47.dll) OR NOT EXISTS ${module_release_path}/d3dcompiler_47.dll)
if ("${windows_sdk_loc}" STREQUAL "") if ("${windows_sdk_loc}" STREQUAL "")
validate_d3d_error("Could not find Windows SDK.") validate_d3d_error("Could not find Windows SDK.")
return() return()
endif() endif()
set(sdk_compiler ${windows_sdk_loc}/Redist/D3D/${modules_subdir}/d3dcompiler_47.dll) set(sdk_compiler ${windows_sdk_loc}/Redist/D3D/${modules_subdir}/d3dcompiler_47.dll)
find_package(Python REQUIRED) find_package(Python3 REQUIRED)
execute_process( execute_process(
COMMAND COMMAND
${Python_EXECUTABLE} ${Python3_EXECUTABLE}
${cmake_helpers_loc}/validate_d3d_compiler.py ${cmake_helpers_loc}/validate_d3d_compiler.py
${sdk_compiler} ${sdk_compiler}
OUTPUT_VARIABLE key OUTPUT_VARIABLE key
@ -66,7 +66,7 @@ function(validate_d3d_compiler target_name)
file(MAKE_DIRECTORY ${modules_release_loc}/d3d) file(MAKE_DIRECTORY ${modules_release_loc}/d3d)
file(COPY ${sdk_compiler} DESTINATION ${module_release_path}) file(COPY ${sdk_compiler} DESTINATION ${module_release_path})
file(MAKE_DIRECTORY ${modules_hash_loc}/d3d) file(MAKE_DIRECTORY ${modules_hash_loc}/d3d)
file(WRITE ${key_path} ${key}) file(WRITE ${key_path} ${key})
endif() endif()

View file

@ -25,7 +25,7 @@ if not os.path.exists(inputPath):
info = GetFileVersionInfo(inputPath, '\\') info = GetFileVersionInfo(inputPath, '\\')
version = [ info['FileVersionMS'] // 65536, info['FileVersionMS'] % 65536, info['FileVersionLS'] // 65536, info['FileVersionLS'] % 65536 ] version = [ info['FileVersionMS'] // 65536, info['FileVersionMS'] % 65536, info['FileVersionLS'] // 65536, info['FileVersionLS'] % 65536 ]
if (version != [10, 0, 22000, 194]): if (version != [10, 0, 22000, 832]):
error('Bad "d3dcompiler_47.dll" version: ' + '.'.join(str(x) for x in version)) error('Bad "d3dcompiler_47.dll" version: ' + '.'.join(str(x) for x in version))
bufferSize = 1024 * 1024 bufferSize = 1024 * 1024

View file

@ -4,19 +4,16 @@
# 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
include(CMakeDependentOption)
set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.") set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.")
set(no_special_target 0) get_filename_component(libs_loc "../Libraries" REALPATH)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") set(libs_loc_exists 0)
set(no_special_target 1) if (EXISTS ${libs_loc})
set(libs_loc_exists 1)
endif() endif()
option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ${no_special_target}) cmake_dependent_option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." OFF libs_loc_exists ON)
set(default_to_qt6 1)
if (WIN32)
set(default_to_qt6 0)
endif()
option(DESKTOP_APP_QT6 "Build with Qt 6" ${default_to_qt6})
function(report_bad_special_target) function(report_bad_special_target)
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
@ -25,11 +22,9 @@ function(report_bad_special_target)
endfunction() endfunction()
if (NOT DESKTOP_APP_USE_PACKAGED) if (NOT DESKTOP_APP_USE_PACKAGED)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS deployment version" FORCE) set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "Minimum macOS deployment version" FORCE)
if (DESKTOP_APP_QT6) if (NOT DEFINED CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE) set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE)
else()
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Target macOS architectures" FORCE)
endif() endif()
endif() endif()

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
include(CMakeDependentOption)
set(no_special_target 0) set(no_special_target 0)
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
set(no_special_target 1) set(no_special_target 1)
@ -18,35 +20,40 @@ if (DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
endif() endif()
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_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration (Linux only)." OFF) cmake_dependent_option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration." OFF LINUX ON)
option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration (Linux only)." OFF) cmake_dependent_option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer." OFF LINUX OFF)
option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration (Linux only)." OFF) cmake_dependent_option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages." OFF LINUX OFF)
option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer (Linux only)." OFF)
option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages. (Linux only)" OFF)
option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF) option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF)
option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bundled patched one." OFF) option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bundled patched one." OFF)
option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF)
option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target}) option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target})
option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate})
option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF)
option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell. (Linux only)" OFF) option(DESKTOP_APP_ASAN "Enable address sanitizer" OFF)
option(DESKTOP_APP_NO_PDB "Disable PDB file generation. (Windows only)" OFF) cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell." OFF LINUX OFF)
option(DESKTOP_APP_WITH_LTO "Forcibly enable link-time optimization." OFF) cmake_dependent_option(DESKTOP_APP_USE_CLD3 "Disable system text language recognition and use bundled cld3 only." OFF APPLE ON)
cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF)
cmake_dependent_option(DESKTOP_APP_DISABLE_SCUDO "Disable scudo, use system malloc." OFF LINUX OFF)
if (DESKTOP_APP_USE_PACKAGED AND DEFINED CMAKE_OSX_ARCHITECTURES) if (APPLE AND NOT DEFINED DESKTOP_APP_MAC_ARCH)
set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch. (macOS only)") if (DEFINED CMAKE_OSX_ARCHITECTURES)
else() set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.")
set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch. (macOS only)") else()
set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch.")
endif()
endif() endif()
set(add_hunspell_library 0) set(add_hunspell_library 0)
if ((WIN32 if (WIN32
OR (LINUX AND NOT DESKTOP_APP_USE_ENCHANT) OR (LINUX AND NOT DESKTOP_APP_USE_ENCHANT)
OR DESKTOP_APP_USE_HUNSPELL_ONLY) OR DESKTOP_APP_USE_HUNSPELL_ONLY)
AND NOT DESKTOP_APP_DISABLE_SPELLCHECK)
set(add_hunspell_library 1) set(add_hunspell_library 1)
endif() endif()
set(add_cld3_library 0)
if (LINUX OR DESKTOP_APP_USE_CLD3)
set(add_cld3_library 1)
endif()
set(build_macstore 0) set(build_macstore 0)
set(build_winstore 0) # 32 or 64 bit set(build_winstore 0) # 32 or 64 bit
set(build_win64 0) # normal or uwp set(build_win64 0) # normal or uwp
@ -82,6 +89,13 @@ else()
endif() endif()
endif() endif()
#if (DESKTOP_APP_ASAN AND WIN32)
# if (build_win64)
# get_filename_component(libs_loc "../Libraries64/asan" REALPATH)
# else()
# get_filename_component(libs_loc "../Libraries/asan" REALPATH)
# endif()
#elseif (build_win64)
if (build_win64) if (build_win64)
get_filename_component(libs_loc "../Libraries64" REALPATH) get_filename_component(libs_loc "../Libraries64" REALPATH)
else() else()

View file

@ -19,3 +19,10 @@ target_link_libraries(win_directx_helper
PUBLIC PUBLIC
desktop-app::external_openssl desktop-app::external_openssl
) )
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
target_compile_definitions(win_directx_helper
PRIVATE
WIN_DIRECTX_HELPER_SPECIAL_TARGET=${DESKTOP_APP_SPECIAL_TARGET}
)
endif()

View file

@ -173,9 +173,9 @@ bool ResolveD3DCompiler() {
if (FileSha256(path) == hash && ResolveD3DCompiler(path)) { if (FileSha256(path) == hash && ResolveD3DCompiler(path)) {
return true; return true;
} }
#elif defined DESKTOP_APP_SPECIAL_TARGET // DESKTOP_APP_D3DCOMPILER_HASH #elif defined WIN_DIRECTX_HELPER_SPECIAL_TARGET // DESKTOP_APP_D3DCOMPILER_HASH
#error "Special target build should have d3dcompiler hash." #error "Special target build should have d3dcompiler hash."
#endif // !DESKTOP_APP_D3DCOMPILER_HASH && DESKTOP_APP_SPECIAL_TARGET #endif // !DESKTOP_APP_D3DCOMPILER_HASH && WIN_DIRECTX_HELPER_SPECIAL_TARGET
return ResolveD3DCompiler(L"d3dcompiler_47.dll"); return ResolveD3DCompiler(L"d3dcompiler_47.dll");
}(); }();