├── .gitmodules ├── CMakeLists.txt ├── external ├── CMakeLists.txt ├── ada │ └── CMakeLists.txt ├── angle │ └── CMakeLists.txt ├── auto_updates │ ├── CMakeLists.txt │ ├── lzma │ │ └── CMakeLists.txt │ └── xz │ │ └── CMakeLists.txt ├── boost │ └── CMakeLists.txt ├── cld3 │ ├── CMakeLists.txt │ └── generate_protobuf.cmake ├── crash_reports │ ├── CMakeLists.txt │ ├── breakpad │ │ └── CMakeLists.txt │ └── crashpad │ │ └── CMakeLists.txt ├── dispatch │ └── CMakeLists.txt ├── expected │ └── CMakeLists.txt ├── ffmpeg │ └── CMakeLists.txt ├── glib │ ├── CMakeLists.txt │ ├── generate_cppgir.cmake │ ├── generate_dbus.cmake │ └── generate_gir.cmake ├── glibmm │ └── CMakeLists.txt ├── gsl │ └── CMakeLists.txt ├── hunspell │ └── CMakeLists.txt ├── iconv │ └── CMakeLists.txt ├── jemalloc │ └── CMakeLists.txt ├── jpeg │ └── CMakeLists.txt ├── kcoreaddons │ ├── CMakeLists.txt │ └── headers │ │ ├── private │ │ ├── config-kdirwatch.h │ │ ├── config-util.h │ │ └── kcoreaddons_debug.h │ │ └── public │ │ └── kcoreaddons_export.h ├── lz4 │ └── CMakeLists.txt ├── minizip │ └── CMakeLists.txt ├── openal │ └── CMakeLists.txt ├── openh264 │ └── CMakeLists.txt ├── openssl │ ├── CMakeLists.txt │ ├── openssl_common │ │ └── CMakeLists.txt │ ├── openssl_crypto │ │ └── CMakeLists.txt │ └── openssl_ssl │ │ └── CMakeLists.txt ├── opus │ └── CMakeLists.txt ├── qr_code_generator │ └── CMakeLists.txt ├── qt │ ├── CMakeLists.txt │ ├── package.cmake │ └── qt_static_plugins │ │ ├── CMakeLists.txt │ │ ├── fcitx5 │ │ ├── CMakeLists.txt │ │ ├── fcitx5_qt_dbusaddons │ │ │ └── CMakeLists.txt │ │ └── init.cpp │ │ ├── hime │ │ ├── CMakeLists.txt │ │ ├── hime_im_client │ │ │ ├── CMakeLists.txt │ │ │ └── hime_im_client_helper.cpp │ │ └── init.cpp │ │ ├── kimageformats │ │ ├── CMakeLists.txt │ │ └── init.cpp │ │ ├── nimf │ │ ├── CMakeLists.txt │ │ └── init.cpp │ │ └── qt_static_plugins.cpp ├── ranges │ └── CMakeLists.txt ├── rlottie │ ├── CMakeLists.txt │ └── config │ │ └── config.h ├── rnnoise │ └── CMakeLists.txt ├── tde2e │ └── CMakeLists.txt ├── ton │ └── CMakeLists.txt ├── variant │ └── CMakeLists.txt ├── vpx │ └── CMakeLists.txt ├── webrtc │ └── CMakeLists.txt ├── xcb │ ├── CMakeLists.txt │ ├── xcb_keysyms │ │ └── CMakeLists.txt │ ├── xcb_record │ │ └── CMakeLists.txt │ └── xcb_screensaver │ │ └── CMakeLists.txt ├── xxhash │ └── CMakeLists.txt └── zlib │ └── CMakeLists.txt ├── generate_target.cmake ├── init_target.cmake ├── linux_allocation_tracer ├── CMakeLists.txt ├── linux_allocation_trace_reader.cpp ├── linux_allocation_tracer.cpp └── linux_allocation_tracer.h ├── linux_jemalloc_helper ├── CMakeLists.txt └── linux_jemalloc_helper.cpp ├── nice_target_sources.cmake ├── nuget.cmake ├── options.cmake ├── options_linux.cmake ├── options_mac.cmake ├── options_win.cmake ├── run_cmake.py ├── target_compile_options_if_exists.cmake ├── target_link_frameworks.cmake ├── target_link_options_if_exists.cmake ├── target_prepare_qrc.cmake ├── validate_d3d_compiler.cmake ├── validate_d3d_compiler.py ├── validate_special_target.cmake ├── variables.cmake ├── version.cmake └── win_directx_helper ├── CMakeLists.txt ├── modules ├── x64 │ └── d3d │ │ └── d3dcompiler_47.dll └── x86 │ └── d3d │ └── d3dcompiler_47.dll └── win_directx_helper.cpp /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/glib/cppgir"] 2 | path = external/glib/cppgir 3 | url = https://gitlab.com/mnauw/cppgir.git 4 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_subdirectory(external) 8 | if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) 9 | add_subdirectory(linux_jemalloc_helper) 10 | endif() 11 | if (DESKTOP_APP_USE_ALLOCATION_TRACER) 12 | add_subdirectory(linux_allocation_tracer) 13 | endif() 14 | if (WIN32 AND QT_VERSION LESS 6) 15 | add_subdirectory(win_directx_helper) 16 | endif() 17 | -------------------------------------------------------------------------------- /external/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | macro(add_checked_subdirectory name) 8 | if (NOT DEFINED desktop_app_skip_libs 9 | OR NOT ${name} IN_LIST desktop_app_skip_libs) 10 | add_subdirectory(${name}) 11 | endif() 12 | endmacro() 13 | 14 | add_checked_subdirectory(ada) 15 | add_checked_subdirectory(angle) 16 | add_checked_subdirectory(auto_updates) 17 | add_checked_subdirectory(boost) 18 | if (add_cld3_library) 19 | add_checked_subdirectory(cld3) 20 | endif() 21 | add_checked_subdirectory(crash_reports) 22 | if (LINUX) 23 | add_checked_subdirectory(dispatch) 24 | endif() 25 | add_checked_subdirectory(expected) 26 | add_checked_subdirectory(ffmpeg) 27 | if (LINUX) 28 | add_checked_subdirectory(glib) 29 | add_checked_subdirectory(glibmm) 30 | endif() 31 | add_checked_subdirectory(gsl) 32 | if (add_hunspell_library) 33 | add_checked_subdirectory(hunspell) 34 | endif() 35 | add_checked_subdirectory(iconv) 36 | if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) 37 | add_checked_subdirectory(jemalloc) 38 | endif() 39 | add_checked_subdirectory(jpeg) 40 | add_checked_subdirectory(kcoreaddons) 41 | add_checked_subdirectory(lz4) 42 | add_checked_subdirectory(minizip) 43 | add_checked_subdirectory(openal) 44 | add_checked_subdirectory(openh264) 45 | add_checked_subdirectory(openssl) 46 | add_checked_subdirectory(opus) 47 | add_checked_subdirectory(qt) 48 | add_checked_subdirectory(qr_code_generator) 49 | add_checked_subdirectory(ranges) 50 | add_checked_subdirectory(rlottie) 51 | add_checked_subdirectory(rnnoise) 52 | add_checked_subdirectory(tde2e) 53 | add_checked_subdirectory(ton) 54 | add_checked_subdirectory(variant) 55 | add_checked_subdirectory(vpx) 56 | add_checked_subdirectory(webrtc) 57 | if (LINUX AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) 58 | add_checked_subdirectory(xcb) 59 | endif() 60 | add_checked_subdirectory(xxhash) 61 | add_checked_subdirectory(zlib) 62 | -------------------------------------------------------------------------------- /external/ada/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (DESKTOP_APP_USE_PACKAGED) 8 | add_library(external_ada INTERFACE IMPORTED GLOBAL) 9 | add_library(desktop-app::external_ada ALIAS external_ada) 10 | 11 | find_package(ada REQUIRED) 12 | target_link_libraries(external_ada INTERFACE ada::ada) 13 | return() 14 | endif() 15 | 16 | add_library(external_ada STATIC IMPORTED GLOBAL) 17 | add_library(desktop-app::external_ada ALIAS external_ada) 18 | 19 | if (WIN32) 20 | set(ada_lib_loc ${libs_loc}/ada/out/singleheader) 21 | target_include_directories(external_ada SYSTEM 22 | INTERFACE 23 | ${ada_lib_loc} 24 | ) 25 | set_target_properties(external_ada PROPERTIES 26 | IMPORTED_LOCATION "${ada_lib_loc}/Release/ada-singleheader-lib.lib" 27 | IMPORTED_LOCATION_DEBUG "${ada_lib_loc}/Debug/ada-singleheader-lib.lib" 28 | ) 29 | elseif (APPLE) 30 | target_include_directories(external_ada SYSTEM 31 | INTERFACE 32 | ${libs_loc}/local/include 33 | ) 34 | set_target_properties(external_ada PROPERTIES 35 | IMPORTED_LOCATION ${libs_loc}/local/lib/libada.a 36 | ) 37 | else() 38 | target_include_directories(external_ada SYSTEM 39 | INTERFACE 40 | /usr/local/include 41 | ) 42 | find_library(DESKTOP_APP_ADA_LIBRARIES libada.a REQUIRED) 43 | set_target_properties(external_ada PROPERTIES 44 | IMPORTED_LOCATION "${DESKTOP_APP_ADA_LIBRARIES}" 45 | ) 46 | endif() 47 | -------------------------------------------------------------------------------- /external/angle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_angle INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_angle ALIAS external_angle) 9 | 10 | if (WIN32) 11 | target_include_directories(external_angle SYSTEM 12 | INTERFACE 13 | ${libs_loc}/tg_angle/include 14 | ) 15 | target_link_libraries(external_angle 16 | INTERFACE 17 | ${libs_loc}/tg_angle/out/$,Debug,Release>/tg_angle.lib 18 | dxguid.lib 19 | ) 20 | target_link_libraries(external_angle 21 | INTERFACE 22 | desktop-app::win_directx_helper 23 | ) 24 | target_compile_definitions(external_angle 25 | INTERFACE 26 | KHRONOS_STATIC 27 | ) 28 | endif() 29 | -------------------------------------------------------------------------------- /external/auto_updates/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_auto_updates INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_auto_updates ALIAS external_auto_updates) 9 | 10 | if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE) 11 | if (WIN32 AND NOT DESKTOP_APP_USE_PACKAGED) 12 | add_subdirectory(lzma) 13 | target_link_libraries(external_auto_updates 14 | INTERFACE 15 | desktop-app::external_lzma 16 | ) 17 | else() 18 | add_subdirectory(xz) 19 | target_link_libraries(external_auto_updates 20 | INTERFACE 21 | desktop-app::external_xz 22 | ) 23 | endif() 24 | endif() 25 | -------------------------------------------------------------------------------- /external/auto_updates/lzma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_lzma INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_lzma ALIAS external_lzma) 9 | 10 | target_include_directories(external_lzma SYSTEM 11 | INTERFACE 12 | ${libs_loc}/lzma/C 13 | ) 14 | 15 | if (build_winarm) 16 | set(lzma_platform_dir ARM64/) 17 | elseif (build_win64) 18 | set(lzma_platform_dir x64/) 19 | else() 20 | set(lzma_platform_dir "") 21 | endif() 22 | 23 | set(lzma_lib_loc ${libs_loc}/lzma/C/Util/LzmaLib/${lzma_platform_dir}$,Debug,Release>) 24 | 25 | target_link_libraries(external_lzma 26 | INTERFACE 27 | ${lzma_lib_loc}/LzmaLib.lib 28 | ) 29 | -------------------------------------------------------------------------------- /external/auto_updates/xz/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_xz INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_xz ALIAS external_xz) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 11 | find_package(LibLZMA REQUIRED) 12 | target_link_libraries(external_xz INTERFACE LibLZMA::LibLZMA) 13 | elseif (APPLE) 14 | target_include_directories(external_xz SYSTEM 15 | INTERFACE 16 | ${libs_loc}/local/include 17 | ) 18 | target_link_libraries(external_xz 19 | INTERFACE 20 | ${libs_loc}/local/lib/liblzma.a 21 | ) 22 | endif() 23 | -------------------------------------------------------------------------------- /external/boost/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_boost_regex INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_boost_regex ALIAS external_boost_regex) 9 | 10 | target_compile_definitions(external_boost_regex 11 | INTERFACE 12 | BOOST_NO_INTRINSIC_WCHAR_T 13 | BOOST_REGEX_NO_W32 14 | ) 15 | 16 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 17 | find_package(Boost COMPONENTS regex REQUIRED) 18 | target_link_libraries(external_boost_regex INTERFACE Boost::regex) 19 | return() 20 | endif() 21 | 22 | target_include_directories(external_boost_regex SYSTEM 23 | INTERFACE 24 | ${libs_loc}/regex/include 25 | ) 26 | -------------------------------------------------------------------------------- /external/cld3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_cld3 INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_cld3 ALIAS external_cld3) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(protobuf CONFIG) 12 | find_library(DESKTOP_APP_CLD3_LIBRARIES NAMES cld3) 13 | find_path(DESKTOP_APP_CLD3_INCLUDE_DIRS NAMES nnet_language_identifier.h PATH_SUFFIXES cld3) 14 | if (protobuf_FOUND AND DESKTOP_APP_CLD3_LIBRARIES AND DESKTOP_APP_CLD3_INCLUDE_DIRS) 15 | list(APPEND DESKTOP_APP_CLD3_LIBRARIES protobuf::libprotobuf-lite) 16 | target_include_directories(external_cld3 SYSTEM INTERFACE ${DESKTOP_APP_CLD3_INCLUDE_DIRS}) 17 | target_link_libraries(external_cld3 INTERFACE ${DESKTOP_APP_CLD3_LIBRARIES}) 18 | return() 19 | endif() 20 | endif() 21 | 22 | add_library(external_cld3_bundled STATIC) 23 | init_target(external_cld3_bundled "(external)") 24 | 25 | set(cld3_loc ${third_party_loc}/cld3) 26 | set(cld3_src ${cld3_loc}/src) 27 | 28 | set(gen_loc ${CMAKE_CURRENT_BINARY_DIR}/gen) 29 | set(gen_dst ${gen_loc}/cld_3/protos) 30 | 31 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 32 | find_package(protobuf REQUIRED CONFIG) 33 | set(protoc_executable protobuf::protoc) 34 | set(protobuf_lib protobuf::libprotobuf-lite) 35 | elseif (WIN32) 36 | set(build_loc ${libs_loc}/protobuf/build/$,Debug,Release>) 37 | set(protoc_executable ${build_loc}/protoc.exe) 38 | set(protobuf_lib ${build_loc}/libprotobuf-lite.lib) 39 | else() 40 | set(protoc_executable ${libs_loc}/protobuf/build/protoc) 41 | set(protobuf_lib ${libs_loc}/protobuf/build/libprotobuf-lite.a) 42 | endif() 43 | if (PROTOBUF_PROTOC_EXECUTABLE) 44 | set(protoc_executable ${PROTOBUF_PROTOC_EXECUTABLE}) 45 | endif() 46 | 47 | include(generate_protobuf.cmake) 48 | 49 | function(generate protobuf_name) 50 | generate_single_protobuf( 51 | external_cld3_bundled 52 | ${gen_dst} 53 | ${protobuf_name} 54 | ${protoc_executable}) 55 | endfunction() 56 | 57 | generate(feature_extractor.proto) 58 | generate(sentence.proto) 59 | generate(task_spec.proto) 60 | 61 | nice_target_sources(external_cld3_bundled ${cld3_src} 62 | PRIVATE 63 | feature_extractor.proto 64 | sentence.proto 65 | task_spec.proto 66 | 67 | base.cc 68 | embedding_feature_extractor.cc 69 | embedding_network.cc 70 | feature_extractor.cc 71 | feature_extractor.h 72 | feature_types.cc 73 | fml_parser.cc 74 | language_identifier_features.cc 75 | lang_id_nn_params.cc 76 | nnet_language_identifier.cc 77 | registry.cc 78 | relevant_script_feature.cc 79 | sentence_features.cc 80 | task_context.cc 81 | task_context_params.cc 82 | unicodetext.cc 83 | utils.cc 84 | workspace.cc 85 | 86 | script_span/generated_entities.cc 87 | script_span/getonescriptspan.cc 88 | script_span/getonescriptspan.h 89 | script_span/utf8statetable.cc 90 | script_span/offsetmap.cc 91 | script_span/text_processing.cc 92 | script_span/text_processing.h 93 | script_span/fixunicodevalue.cc 94 | ) 95 | 96 | target_compile_definitions(external_cld3_bundled 97 | PUBLIC 98 | $<$>:NDEBUG> 99 | ) 100 | 101 | if (NOT MSVC) 102 | target_compile_options_if_exists(external_cld3_bundled 103 | PRIVATE 104 | -Wno-implicit-fallthrough 105 | ) 106 | endif() 107 | 108 | target_include_directories(external_cld3_bundled 109 | PUBLIC 110 | ${cld3_src} 111 | ${gen_loc} 112 | ) 113 | 114 | if (NOT DESKTOP_APP_USE_PACKAGED AND NOT LINUX) 115 | target_include_directories(external_cld3_bundled 116 | PUBLIC 117 | ${libs_loc}/protobuf/src 118 | ${libs_loc}/protobuf/third_party/abseil-cpp 119 | ) 120 | endif() 121 | 122 | target_link_libraries(external_cld3_bundled 123 | PUBLIC 124 | ${protobuf_lib} 125 | ) 126 | 127 | target_link_libraries(external_cld3 128 | INTERFACE 129 | external_cld3_bundled 130 | ) 131 | -------------------------------------------------------------------------------- /external/cld3/generate_protobuf.cmake: -------------------------------------------------------------------------------- 1 | function(generate_single_protobuf target_name gen_dst protobuf_name executable) 2 | file(MAKE_DIRECTORY ${gen_dst}) 3 | 4 | # Copied from myprotobuf.cmake. 5 | if (PROTOBUF_GENERATE_CPP_APPEND_PATH) 6 | # Create an include path for each file specified 7 | set(FIL ${cld3_src}/${protobuf_name}) 8 | get_filename_component(ABS_FIL ${FIL} ABSOLUTE) 9 | get_filename_component(ABS_PATH ${ABS_FIL} PATH) 10 | list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) 11 | if (${_contains_already} EQUAL -1) 12 | list(APPEND _protobuf_include_path -I ${ABS_PATH}) 13 | endif() 14 | else() 15 | set(_protobuf_include_path -I ${cld3_src}) 16 | endif() 17 | 18 | if (DEFINED PROTOBUF_IMPORT_DIRS) 19 | foreach (DIR ${PROTOBUF_IMPORT_DIRS}) 20 | get_filename_component(ABS_PATH ${DIR} ABSOLUTE) 21 | list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) 22 | if (${_contains_already} EQUAL -1) 23 | list(APPEND _protobuf_include_path -I ${ABS_PATH}) 24 | endif() 25 | endforeach() 26 | endif() 27 | # 28 | 29 | get_filename_component(protobuf_name_we ${protobuf_name} NAME_WE) 30 | 31 | set(gen_timestamp ${gen_dst}/${protobuf_name}.timestamp) 32 | set(gen_files 33 | ${gen_dst}/${protobuf_name_we}.pb.cc 34 | ${gen_dst}/${protobuf_name_we}.pb.h 35 | ) 36 | 37 | set(gen_src ${cld3_src}/${protobuf_name}) 38 | add_custom_command( 39 | OUTPUT 40 | ${gen_timestamp} 41 | BYPRODUCTS 42 | ${gen_files} 43 | COMMAND 44 | ${executable} 45 | --cpp_out 46 | ${gen_dst} 47 | ${_protobuf_include_path} 48 | ${gen_src} 49 | COMMAND 50 | echo 1> ${gen_timestamp} 51 | COMMENT "Generating protobuf ${protobuf_name} (${target_name})" 52 | DEPENDS 53 | ${executable} 54 | ${gen_src} 55 | VERBATIM 56 | ) 57 | generate_target(${target_name} ${protobuf_name} ${gen_timestamp} "${gen_files}" ${gen_dst}) 58 | endfunction() 59 | -------------------------------------------------------------------------------- /external/crash_reports/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_crash_reports INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_crash_reports ALIAS external_crash_reports) 9 | 10 | if (NOT DESKTOP_APP_DISABLE_CRASH_REPORTS) 11 | if (WIN32 OR LINUX OR build_macstore) 12 | add_subdirectory(breakpad) 13 | target_link_libraries(external_crash_reports 14 | INTERFACE 15 | desktop-app::external_breakpad 16 | ) 17 | else() 18 | add_subdirectory(crashpad) 19 | target_link_libraries(external_crash_reports 20 | INTERFACE 21 | desktop-app::external_crashpad 22 | ) 23 | endif() 24 | endif() 25 | -------------------------------------------------------------------------------- /external/crash_reports/breakpad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_breakpad INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_breakpad ALIAS external_breakpad) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 11 | find_package(PkgConfig REQUIRED) 12 | pkg_check_modules(DESKTOP_APP_BREAKPAD REQUIRED IMPORTED_TARGET breakpad-client) 13 | target_link_libraries(external_breakpad INTERFACE PkgConfig::DESKTOP_APP_BREAKPAD) 14 | return() 15 | endif() 16 | 17 | target_include_directories(external_breakpad SYSTEM 18 | INTERFACE 19 | ${libs_loc}/breakpad/src 20 | ) 21 | 22 | if (build_winarm) 23 | set(breakpad_config_add _ARM64) 24 | elseif (build_win64) 25 | set(breakpad_config_add _x64) 26 | else() 27 | set(breakpad_config_add "") 28 | endif() 29 | 30 | set(breakpad_lib_loc ${libs_loc}/breakpad/src/out/$,Debug${breakpad_config_add},Release${breakpad_config_add}>/obj/client) 31 | 32 | if (WIN32) 33 | target_link_libraries(external_breakpad 34 | INTERFACE 35 | ${breakpad_lib_loc}/windows/common.lib 36 | ${breakpad_lib_loc}/windows/handler/exception_handler.lib 37 | ${breakpad_lib_loc}/windows/crash_generation/crash_generation_client.lib 38 | ) 39 | endif() 40 | -------------------------------------------------------------------------------- /external/crash_reports/crashpad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_crashpad INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_crashpad ALIAS external_crashpad) 9 | 10 | target_include_directories(external_crashpad SYSTEM 11 | INTERFACE 12 | ${libs_loc}/crashpad 13 | ${libs_loc}/crashpad/gen 14 | ${libs_loc}/crashpad/third_party/mini_chromium 15 | ) 16 | 17 | set(crashpad_lib_loc ${libs_loc}/crashpad/out/$,Debug,Release>) 18 | 19 | target_link_libraries(external_crashpad 20 | INTERFACE 21 | ${crashpad_lib_loc}/libcrashpad_client.a 22 | bsm 23 | ) 24 | -------------------------------------------------------------------------------- /external/dispatch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | set(dispatch_loc ${third_party_loc}/dispatch) 8 | set(dispatch_prefix ${CMAKE_CURRENT_BINARY_DIR}/dispatch-prefix) 9 | set(dispatch_binary_dir ${dispatch_prefix}/src/dispatch-build) 10 | 11 | if (DESKTOP_APP_USE_PACKAGED) 12 | find_library(DESKTOP_APP_DISPATCH_LIBRARIES dispatch) 13 | find_path(DESKTOP_APP_DISPATCH_INCLUDE_DIRS dispatch/dispatch.h) 14 | endif() 15 | 16 | if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) 17 | execute_process( 18 | COMMAND ${CMAKE_COMMAND} ${dispatch_loc} 19 | -B ${dispatch_binary_dir} 20 | -GNinja 21 | -DCMAKE_BUILD_TYPE=Release 22 | -DCMAKE_C_COMPILER=clang 23 | -DCMAKE_CXX_COMPILER=clang++ 24 | -DCMAKE_C_FLAGS=-g 25 | -DCMAKE_CXX_FLAGS=-g 26 | -DBUILD_SHARED_LIBS=OFF 27 | -DBUILD_TESTING=OFF 28 | ) 29 | 30 | execute_process( 31 | COMMAND ${CMAKE_COMMAND} --build ${dispatch_binary_dir} --parallel 32 | ) 33 | 34 | if (NOT EXISTS ${dispatch_binary_dir}/src/libdispatch.a) 35 | if (DESKTOP_APP_SPECIAL_TARGET) 36 | message(FATAL_ERROR "Dispatch build failed") 37 | else() 38 | return() 39 | endif() 40 | endif() 41 | endif() 42 | 43 | add_library(external_dispatch INTERFACE IMPORTED GLOBAL) 44 | add_library(desktop-app::external_dispatch ALIAS external_dispatch) 45 | 46 | if (DESKTOP_APP_USE_PACKAGED AND DESKTOP_APP_DISPATCH_LIBRARIES AND DESKTOP_APP_DISPATCH_INCLUDE_DIRS) 47 | target_include_directories(external_dispatch SYSTEM INTERFACE ${DESKTOP_APP_DISPATCH_INCLUDE_DIRS}) 48 | target_link_libraries(external_dispatch INTERFACE ${DESKTOP_APP_DISPATCH_LIBRARIES}) 49 | return() 50 | endif() 51 | 52 | add_library(external_dispatch_bundled STATIC IMPORTED) 53 | 54 | set_target_properties(external_dispatch_bundled PROPERTIES 55 | IMPORTED_LOCATION "${dispatch_binary_dir}/src/libdispatch.a" 56 | ) 57 | 58 | target_include_directories(external_dispatch_bundled SYSTEM 59 | INTERFACE 60 | ${dispatch_loc} 61 | ) 62 | 63 | target_link_libraries(external_dispatch_bundled 64 | INTERFACE 65 | ${dispatch_binary_dir}/src/BlocksRuntime/libBlocksRuntime.a 66 | ) 67 | 68 | target_link_libraries(external_dispatch 69 | INTERFACE 70 | external_dispatch_bundled 71 | ) 72 | -------------------------------------------------------------------------------- /external/expected/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_expected INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_expected ALIAS external_expected) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(tl-expected QUIET) 12 | if (tl-expected_FOUND) 13 | target_link_libraries(external_expected INTERFACE tl::expected) 14 | return() 15 | endif() 16 | endif() 17 | 18 | target_include_directories(external_expected SYSTEM 19 | INTERFACE 20 | ${third_party_loc}/expected/include 21 | ) 22 | -------------------------------------------------------------------------------- /external/ffmpeg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_ffmpeg INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_ffmpeg ALIAS external_ffmpeg) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 11 | find_package(PkgConfig REQUIRED) 12 | pkg_check_modules(DESKTOP_APP_FFMPEG REQUIRED IMPORTED_TARGET 13 | libavcodec 14 | libavfilter 15 | libavformat 16 | libavutil 17 | libswresample 18 | libswscale 19 | ) 20 | target_link_libraries(external_ffmpeg INTERFACE PkgConfig::DESKTOP_APP_FFMPEG) 21 | return() 22 | endif() 23 | 24 | set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) 25 | 26 | target_include_directories(external_ffmpeg SYSTEM 27 | INTERFACE 28 | ${ffmpeg_lib_loc} 29 | ) 30 | 31 | target_link_libraries(external_ffmpeg 32 | INTERFACE 33 | ${ffmpeg_lib_loc}/libavfilter/libavfilter.a 34 | ${ffmpeg_lib_loc}/libavformat/libavformat.a 35 | ${ffmpeg_lib_loc}/libavcodec/libavcodec.a 36 | ${ffmpeg_lib_loc}/libswresample/libswresample.a 37 | ${ffmpeg_lib_loc}/libswscale/libswscale.a 38 | ${ffmpeg_lib_loc}/libavutil/libavutil.a 39 | $ 40 | $ 41 | $ 42 | $ 43 | $ 44 | $ 45 | ) 46 | 47 | if (APPLE) 48 | target_link_libraries(external_ffmpeg INTERFACE bz2) 49 | endif() 50 | -------------------------------------------------------------------------------- /external/glib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_glib INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_glib ALIAS external_glib) 9 | 10 | block() 11 | set(BUILD_TESTING OFF) 12 | set(BUILD_DOC OFF) 13 | set(BUILD_EXAMPLES OFF) 14 | add_subdirectory(cppgir EXCLUDE_FROM_ALL) 15 | endblock() 16 | 17 | include(generate_cppgir.cmake) 18 | generate_cppgir(external_glib Gio-2.0) 19 | 20 | find_package(PkgConfig REQUIRED) 21 | pkg_check_modules(DESKTOP_APP_GLIB2 REQUIRED IMPORTED_TARGET glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0) 22 | 23 | target_link_libraries(external_glib 24 | INTERFACE 25 | PkgConfig::DESKTOP_APP_GLIB2 26 | ) 27 | 28 | target_compile_definitions(external_glib 29 | INTERFACE 30 | GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56 31 | GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_56 32 | ) 33 | -------------------------------------------------------------------------------- /external/glib/generate_cppgir.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(generate_cppgir target_name gir) 8 | set(cppgir_loc ${cmake_helpers_loc}/external/glib/cppgir) 9 | 10 | # cppgir generates all the dependent headers everytime, better to have a global folder 11 | set(gen_dst ${CMAKE_BINARY_DIR}/gen) 12 | file(MAKE_DIRECTORY ${gen_dst}) 13 | 14 | set(gen_timestamp ${gen_dst}/${target_name}_cppgir.timestamp) 15 | 16 | set(ignore_files 17 | ${cppgir_loc}/data/cppgir.ignore 18 | ${cppgir_loc}/data/cppgir_unix.ignore 19 | ) 20 | 21 | add_custom_command( 22 | OUTPUT 23 | ${gen_timestamp} 24 | COMMAND 25 | CppGir::cppgir 26 | --debug 27 | 1 28 | --class 29 | --class-full 30 | --expected 31 | --ignore 32 | "$" 33 | --output 34 | ${gen_dst} 35 | ${gir} 36 | COMMAND 37 | echo 1> ${gen_timestamp} 38 | COMMENT "Generating C++ wrapper for ${gir} (${target_name})" 39 | DEPENDS 40 | CppGir::cppgir 41 | ${ignore_files} 42 | $<$:${gir}> 43 | ) 44 | generate_target(${target_name} cppgir ${gen_timestamp} "" ${gen_dst}) 45 | 46 | get_target_property(target_type ${target_name} TYPE) 47 | if (${target_type} STREQUAL "INTERFACE_LIBRARY") 48 | target_link_libraries(${target_name} INTERFACE CppGir::gi) 49 | target_compile_definitions(${target_name} INTERFACE GI_INLINE) 50 | else() 51 | target_link_libraries(${target_name} PUBLIC CppGir::gi) 52 | target_compile_definitions(${target_name} PUBLIC GI_INLINE) 53 | endif() 54 | endfunction() 55 | -------------------------------------------------------------------------------- /external/glib/generate_dbus.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | include(${cmake_helpers_loc}/external/glib/generate_gir.cmake) 8 | include(${cmake_helpers_loc}/external/glib/generate_cppgir.cmake) 9 | 10 | function(generate_dbus target_name interface_prefix namespace interface_file) 11 | find_program(DESKTOP_APP_GDBUSCODEGEN gdbus-codegen REQUIRED) 12 | 13 | set(gen_loc ${CMAKE_CURRENT_BINARY_DIR}/gen) 14 | set(gen_dst ${gen_loc}/dbus) 15 | file(MAKE_DIRECTORY ${gen_dst}) 16 | 17 | set(gen_timestamp ${gen_dst}/${target_name}_${namespace}_dbus.timestamp) 18 | set(gen_files 19 | ${gen_dst}/${target_name}_${namespace}_dbus.c 20 | ${gen_dst}/${target_name}_${namespace}_dbus.h 21 | ) 22 | 23 | add_custom_command( 24 | OUTPUT 25 | ${gen_timestamp} 26 | BYPRODUCTS 27 | ${gen_files} 28 | COMMAND 29 | ${DESKTOP_APP_GDBUSCODEGEN} 30 | --interface-prefix 31 | ${interface_prefix} 32 | --generate-c-code 33 | ${gen_dst}/${target_name}_${namespace}_dbus 34 | --c-namespace 35 | ${namespace} 36 | --c-generate-object-manager 37 | ${interface_file} 38 | COMMAND 39 | echo 1> ${gen_timestamp} 40 | COMMENT "Generating D-Bus C code for ${namespace} (${target_name})" 41 | DEPENDS 42 | ${DESKTOP_APP_GDBUSCODEGEN} 43 | ${interface_file} 44 | ) 45 | 46 | add_library(${target_name}_${namespace}_dbus STATIC) 47 | init_target(${target_name}_${namespace}_dbus "(gen)") 48 | target_link_libraries(${target_name}_${namespace}_dbus PUBLIC desktop-app::external_glib) 49 | generate_target(${target_name}_${namespace}_dbus timestamp ${gen_timestamp} "${gen_files}" ${gen_loc}) 50 | 51 | add_library(${target_name}_${namespace} INTERFACE) 52 | init_target_folder(${target_name}_${namespace} "(gen)") 53 | target_link_libraries(${target_name}_${namespace} INTERFACE ${target_name}_${namespace}_dbus) 54 | generate_gir(${target_name}_${namespace} ${namespace} Gio-2.0 ${target_name}_${namespace}_dbus) 55 | generate_cppgir(${target_name}_${namespace} ${CMAKE_CURRENT_BINARY_DIR}/gen/${target_name}_${namespace}.gir) 56 | add_dependencies(${target_name}_${namespace}_cppgir ${target_name}_${namespace}_gir) 57 | 58 | get_target_property(target_type ${target_name} TYPE) 59 | if (${target_type} STREQUAL "INTERFACE_LIBRARY") 60 | target_link_libraries(${target_name} INTERFACE ${target_name}_${namespace}) 61 | else() 62 | target_link_libraries(${target_name} PUBLIC ${target_name}_${namespace}) 63 | endif() 64 | endfunction() 65 | -------------------------------------------------------------------------------- /external/glib/generate_gir.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(generate_gir target_name namespace deps src_target_name) 8 | find_program(DESKTOP_APP_GIRSCANNER g-ir-scanner REQUIRED) 9 | 10 | set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen) 11 | file(MAKE_DIRECTORY ${gen_dst}) 12 | 13 | set(gen_timestamp ${gen_dst}/${target_name}_gir.timestamp) 14 | set(gen_file ${gen_dst}/${target_name}.gir) 15 | 16 | add_custom_command( 17 | OUTPUT 18 | ${gen_timestamp} 19 | BYPRODUCTS 20 | ${gen_file} 21 | COMMAND 22 | env 23 | $<$:LDFLAGS=-fsanitize=address> 24 | ${DESKTOP_APP_GIRSCANNER} 25 | --quiet 26 | -n 27 | ${namespace} 28 | --nsversion 29 | 1.0 30 | -l 31 | $ 32 | --c-include 33 | "$,INCLUDE,\\.h$>,$--c-include>" 34 | -i 35 | "$-i>" 36 | -o 37 | ${gen_file} 38 | "$" 39 | COMMAND 40 | echo 1> ${gen_timestamp} 41 | COMMAND_EXPAND_LISTS 42 | COMMENT "Generating GIR (${target_name})" 43 | DEPENDS 44 | ${DESKTOP_APP_GIRSCANNER} 45 | ${src_target_name} 46 | ) 47 | generate_target(${target_name} gir ${gen_timestamp} "${gen_file}" ${gen_dst}) 48 | endfunction() 49 | -------------------------------------------------------------------------------- /external/glibmm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_glibmm INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_glibmm ALIAS external_glibmm) 9 | 10 | find_package(PkgConfig REQUIRED) 11 | pkg_check_modules(DESKTOP_APP_GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.68>=2.77 giomm-2.68>=2.77) 12 | 13 | target_link_libraries(external_glibmm 14 | INTERFACE 15 | PkgConfig::DESKTOP_APP_GLIBMM 16 | ) 17 | -------------------------------------------------------------------------------- /external/gsl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_gsl INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_gsl ALIAS external_gsl) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(Microsoft.GSL 4.1.0 QUIET) 12 | if (Microsoft.GSL_FOUND) 13 | target_link_libraries(external_gsl INTERFACE Microsoft.GSL::GSL) 14 | return() 15 | endif() 16 | endif() 17 | 18 | # https://gitlab.kitware.com/cmake/cmake/-/issues/25222 19 | if (NOT EXISTS ${third_party_loc}/GSL/include) 20 | message(FATAL_ERROR "Guidelines Support Library is not found") 21 | endif() 22 | 23 | target_include_directories(external_gsl SYSTEM 24 | INTERFACE 25 | ${third_party_loc}/GSL/include 26 | ) 27 | -------------------------------------------------------------------------------- /external/hunspell/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_hunspell INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_hunspell ALIAS external_hunspell) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(PkgConfig) 12 | if (PkgConfig_FOUND) 13 | pkg_check_modules(DESKTOP_APP_HUNSPELL IMPORTED_TARGET hunspell) 14 | endif() 15 | 16 | if (DESKTOP_APP_HUNSPELL_FOUND) 17 | target_link_libraries(external_hunspell INTERFACE PkgConfig::DESKTOP_APP_HUNSPELL) 18 | return() 19 | endif() 20 | endif() 21 | 22 | add_library(external_hunspell_bundled STATIC) 23 | init_target(external_hunspell_bundled "(external)") 24 | 25 | set(hunspell_loc ${third_party_loc}/hunspell) 26 | set(hunspell_src ${hunspell_loc}/src) 27 | 28 | nice_target_sources(external_hunspell_bundled ${hunspell_src} 29 | PRIVATE 30 | hunspell/affentry.cxx 31 | hunspell/affentry.hxx 32 | hunspell/affixmgr.cxx 33 | hunspell/affixmgr.hxx 34 | hunspell/atypes.hxx 35 | hunspell/baseaffix.hxx 36 | hunspell/csutil.cxx 37 | hunspell/csutil.hxx 38 | hunspell/filemgr.cxx 39 | hunspell/filemgr.hxx 40 | hunspell/hashmgr.cxx 41 | hunspell/hashmgr.hxx 42 | hunspell/htypes.hxx 43 | hunspell/hunspell.cxx 44 | hunspell/hunspell.h 45 | hunspell/hunspell.hxx 46 | hunspell/hunvisapi.h 47 | hunspell/hunzip.cxx 48 | hunspell/hunzip.hxx 49 | hunspell/phonet.cxx 50 | hunspell/phonet.hxx 51 | hunspell/replist.cxx 52 | hunspell/replist.hxx 53 | hunspell/suggestmgr.cxx 54 | hunspell/suggestmgr.hxx 55 | hunspell/utf_info.hxx 56 | ) 57 | 58 | target_include_directories(external_hunspell_bundled 59 | PUBLIC 60 | ${hunspell_src} 61 | ${hunspell_src}/hunspell 62 | ) 63 | 64 | target_compile_definitions(external_hunspell_bundled 65 | PUBLIC 66 | HUNSPELL_STATIC 67 | MAXSUGGESTION=5 68 | ) 69 | 70 | if (WIN32) 71 | target_compile_definitions(external_hunspell_bundled 72 | PRIVATE 73 | _CRT_SECURE_NO_WARNINGS 74 | ) 75 | endif() 76 | 77 | target_link_libraries(external_hunspell 78 | INTERFACE 79 | external_hunspell_bundled 80 | ) 81 | -------------------------------------------------------------------------------- /external/iconv/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_iconv INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_iconv ALIAS external_iconv) 9 | 10 | if (APPLE AND DESKTOP_APP_USE_PACKAGED) 11 | find_package(Iconv REQUIRED) 12 | target_link_libraries(external_iconv INTERFACE Iconv::Iconv) 13 | elseif (APPLE) 14 | target_link_libraries(external_iconv 15 | INTERFACE 16 | ${libs_loc}/local/lib/libiconv.a 17 | ) 18 | endif() 19 | -------------------------------------------------------------------------------- /external/jemalloc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_jemalloc INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_jemalloc ALIAS external_jemalloc) 9 | 10 | if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") 11 | return() 12 | endif() 13 | 14 | if (DESKTOP_APP_USE_PACKAGED) 15 | find_package(PkgConfig) 16 | if (PkgConfig_FOUND) 17 | pkg_check_modules(DESKTOP_APP_JEMALLOC jemalloc) 18 | endif() 19 | 20 | if (DESKTOP_APP_JEMALLOC_FOUND) 21 | target_include_directories(external_jemalloc SYSTEM 22 | INTERFACE 23 | ${DESKTOP_APP_JEMALLOC_INCLUDE_DIRS} 24 | ) 25 | 26 | target_link_libraries(external_jemalloc 27 | INTERFACE 28 | -Wl,--push-state,--no-as-needed,--whole-archive,${DESKTOP_APP_JEMALLOC_LINK_LIBRARIES},--pop-state 29 | ) 30 | 31 | return() 32 | endif() 33 | endif() 34 | 35 | include(ProcessorCount) 36 | ProcessorCount(N) 37 | 38 | include(ExternalProject) 39 | ExternalProject_Add(jemalloc 40 | URL ${third_party_loc}/jemalloc 41 | CONFIGURE_COMMAND env 42 | "EXTRA_CFLAGS=-fno-lto -fno-use-linker-plugin" 43 | "EXTRA_CXXFLAGS=-fno-lto -fno-use-linker-plugin" 44 | ./autogen.sh --disable-shared 45 | BUILD_COMMAND make $<$>:-j${N}> 46 | BUILD_IN_SOURCE 1 47 | STEP_TARGETS build 48 | EXCLUDE_FROM_ALL TRUE 49 | BUILD_BYPRODUCTS /lib/libjemalloc_pic.a 50 | ) 51 | 52 | ExternalProject_Get_property(jemalloc SOURCE_DIR) 53 | file(MAKE_DIRECTORY "${SOURCE_DIR}/include") 54 | 55 | target_include_directories(external_jemalloc SYSTEM 56 | INTERFACE 57 | ${SOURCE_DIR}/include 58 | ) 59 | 60 | target_link_libraries(external_jemalloc 61 | INTERFACE 62 | -Wl,--push-state,--whole-archive,${SOURCE_DIR}/lib/libjemalloc_pic.a,--pop-state 63 | ) 64 | 65 | add_dependencies(external_jemalloc jemalloc-build) 66 | -------------------------------------------------------------------------------- /external/jpeg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (DESKTOP_APP_USE_PACKAGED) 8 | add_library(external_jpeg INTERFACE IMPORTED GLOBAL) 9 | add_library(desktop-app::external_jpeg ALIAS external_jpeg) 10 | 11 | find_package(JPEG REQUIRED) 12 | target_link_libraries(external_jpeg INTERFACE JPEG::JPEG) 13 | return() 14 | endif() 15 | 16 | add_library(external_jpeg STATIC IMPORTED GLOBAL) 17 | add_library(desktop-app::external_jpeg ALIAS external_jpeg) 18 | 19 | if (WIN32) 20 | set(jpeg_lib_loc ${libs_loc}/mozjpeg) 21 | target_include_directories(external_jpeg SYSTEM INTERFACE ${jpeg_lib_loc}) 22 | set_target_properties(external_jpeg PROPERTIES 23 | IMPORTED_LOCATION "${jpeg_lib_loc}/Release/jpeg-static.lib" 24 | IMPORTED_LOCATION_DEBUG "${jpeg_lib_loc}/Debug/jpeg-static.lib" 25 | ) 26 | elseif (APPLE) 27 | set_target_properties(external_jpeg PROPERTIES 28 | IMPORTED_LOCATION ${libs_loc}/local/lib/libjpeg.a 29 | ) 30 | else() 31 | find_library(DESKTOP_APP_JPEG_LIBRARIES libjpeg.a REQUIRED) 32 | set_target_properties(external_jpeg PROPERTIES 33 | IMPORTED_LOCATION "${DESKTOP_APP_JPEG_LIBRARIES}" 34 | ) 35 | endif() 36 | -------------------------------------------------------------------------------- /external/kcoreaddons/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_kcoreaddons INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(KF${QT_VERSION_MAJOR}CoreAddons QUIET) 12 | if (KF${QT_VERSION_MAJOR}CoreAddons_FOUND) 13 | target_link_libraries(external_kcoreaddons INTERFACE KF${QT_VERSION_MAJOR}::CoreAddons) 14 | return() 15 | endif() 16 | endif() 17 | 18 | add_library(external_kcoreaddons_bundled STATIC) 19 | init_target(external_kcoreaddons_bundled "(external)") 20 | 21 | set(kcoreaddons_loc ${third_party_loc}/kcoreaddons) 22 | set(kcoreaddons_src ${kcoreaddons_loc}/src/lib) 23 | 24 | nice_target_sources(external_kcoreaddons_bundled ${kcoreaddons_src} 25 | PRIVATE 26 | io/kurlmimedata.cpp 27 | io/kurlmimedata.h 28 | util/ksandbox.cpp 29 | util/ksandbox.h 30 | util/kshell.cpp 31 | util/kshell.h 32 | util/kshell_p.h 33 | util/kshell_unix.cpp 34 | util/kuser.h 35 | util/kuser_unix.cpp 36 | ) 37 | 38 | if (NOT LINUX) 39 | remove_target_sources(external_kcoreaddons_bundled ${kcoreaddons_src} 40 | util/kshell.cpp 41 | util/kshell.h 42 | util/kshell_p.h 43 | util/kshell_unix.cpp 44 | util/kuser.h 45 | util/kuser_unix.cpp 46 | ) 47 | endif() 48 | 49 | if (LINUX AND TARGET Qt::DBus) 50 | set_source_files_properties(${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml PROPERTIES INCLUDE ${kcoreaddons_src}/io/dbustypes_p.h) 51 | qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml org.freedesktop.portal.FileTransfer) 52 | 53 | set_source_files_properties(${kcoreaddons_src}/io/org.kde.KIOFuse.VFS.xml PROPERTIES NO_NAMESPACE TRUE) 54 | qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.kde.KIOFuse.VFS.xml org.kde.KIOFuse.VFS) 55 | 56 | target_sources(external_kcoreaddons_bundled PRIVATE ${_dbus_SRCS}) 57 | 58 | target_compile_definitions(external_kcoreaddons_bundled 59 | PRIVATE 60 | HAVE_QTDBUS 61 | ) 62 | endif() 63 | 64 | target_compile_definitions(external_kcoreaddons_bundled 65 | PUBLIC 66 | KCOREADDONS_EXPORT= 67 | PRIVATE 68 | ACCOUNTS_SERVICE_ICON_DIR="/var/lib/AccountsService/icons" 69 | ) 70 | 71 | target_include_directories(external_kcoreaddons_bundled SYSTEM 72 | PUBLIC 73 | ${kcoreaddons_src}/io 74 | ${kcoreaddons_src}/util 75 | ${CMAKE_CURRENT_SOURCE_DIR}/headers/public 76 | PRIVATE 77 | ${CMAKE_CURRENT_SOURCE_DIR}/headers/private 78 | ${CMAKE_CURRENT_BINARY_DIR} 79 | ) 80 | 81 | target_link_libraries(external_kcoreaddons_bundled 82 | PRIVATE 83 | desktop-app::external_qt 84 | ) 85 | 86 | target_link_libraries(external_kcoreaddons 87 | INTERFACE 88 | external_kcoreaddons_bundled 89 | ) 90 | -------------------------------------------------------------------------------- /external/kcoreaddons/headers/private/config-kdirwatch.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desktop-app/cmake_helpers/3fa88ebd4a7e66cc8fbedeb11af4b8380d8b64a1/external/kcoreaddons/headers/private/config-kdirwatch.h -------------------------------------------------------------------------------- /external/kcoreaddons/headers/private/config-util.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desktop-app/cmake_helpers/3fa88ebd4a7e66cc8fbedeb11af4b8380d8b64a1/external/kcoreaddons/headers/private/config-util.h -------------------------------------------------------------------------------- /external/kcoreaddons/headers/private/kcoreaddons_debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | static const QLoggingCategory KCOREADDONS_DEBUG("kf.coreaddons", QtInfoMsg); 4 | -------------------------------------------------------------------------------- /external/kcoreaddons/headers/public/kcoreaddons_export.h: -------------------------------------------------------------------------------- 1 | #define KCOREADDONS_ENABLE_DEPRECATED_SINCE(major, minor) 0 2 | -------------------------------------------------------------------------------- /external/lz4/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_lz4 INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_lz4 ALIAS external_lz4) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(lz4 QUIET) 12 | if (lz4_FOUND) 13 | target_link_libraries(external_lz4 INTERFACE LZ4::lz4) 14 | return() 15 | endif() 16 | 17 | find_package(PkgConfig) 18 | if (PkgConfig_FOUND) 19 | pkg_check_modules(DESKTOP_APP_LZ4 IMPORTED_TARGET liblz4) 20 | endif() 21 | 22 | if (DESKTOP_APP_LZ4_FOUND) 23 | target_link_libraries(external_lz4 INTERFACE PkgConfig::DESKTOP_APP_LZ4) 24 | return() 25 | endif() 26 | endif() 27 | 28 | add_library(external_lz4_bundled STATIC) 29 | init_target(external_lz4_bundled "(external)") 30 | 31 | set(lz4_loc ${third_party_loc}/lz4/lib) 32 | 33 | target_sources(external_lz4_bundled 34 | PRIVATE 35 | ${lz4_loc}/lz4.c 36 | ${lz4_loc}/lz4.h 37 | ${lz4_loc}/lz4frame.c 38 | ${lz4_loc}/lz4frame.h 39 | ${lz4_loc}/lz4frame_static.h 40 | ${lz4_loc}/lz4hc.c 41 | ${lz4_loc}/lz4hc.h 42 | ${lz4_loc}/xxhash.c 43 | ${lz4_loc}/xxhash.h 44 | ) 45 | 46 | target_include_directories(external_lz4_bundled 47 | PUBLIC 48 | ${lz4_loc} 49 | ) 50 | 51 | target_link_libraries(external_lz4 52 | INTERFACE 53 | external_lz4_bundled 54 | ) 55 | -------------------------------------------------------------------------------- /external/minizip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_minizip INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_minizip ALIAS external_minizip) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(PkgConfig) 12 | if (PkgConfig_FOUND) 13 | pkg_check_modules(DESKTOP_APP_MINIZIP IMPORTED_TARGET minizip<2.0.0) 14 | endif() 15 | 16 | if (DESKTOP_APP_MINIZIP_FOUND) 17 | target_link_libraries(external_minizip INTERFACE PkgConfig::DESKTOP_APP_MINIZIP) 18 | return() 19 | endif() 20 | endif() 21 | 22 | add_library(external_minizip_bundled STATIC) 23 | init_target(external_minizip_bundled "(external)") 24 | 25 | set(minizip_loc ${third_party_loc}/minizip) 26 | 27 | target_sources(external_minizip_bundled 28 | PRIVATE 29 | ${minizip_loc}/crypt.h 30 | ${minizip_loc}/ioapi.c 31 | ${minizip_loc}/ioapi.h 32 | ${minizip_loc}/zip.c 33 | ${minizip_loc}/zip.h 34 | ${minizip_loc}/unzip.c 35 | ${minizip_loc}/unzip.h 36 | ) 37 | 38 | target_include_directories(external_minizip_bundled SYSTEM 39 | PUBLIC 40 | ${minizip_loc} 41 | ) 42 | 43 | target_link_libraries(external_minizip_bundled 44 | PRIVATE 45 | desktop-app::external_zlib 46 | ) 47 | 48 | target_link_libraries(external_minizip 49 | INTERFACE 50 | external_minizip_bundled 51 | ) 52 | -------------------------------------------------------------------------------- /external/openal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_openal INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_openal ALIAS external_openal) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 11 | find_package(OpenAL REQUIRED CONFIG) 12 | target_link_libraries(external_openal INTERFACE OpenAL::OpenAL) 13 | return() 14 | elseif (WIN32) 15 | target_include_directories(external_openal SYSTEM 16 | INTERFACE 17 | ${libs_loc}/openal-soft/include 18 | ${libs_loc}/openal-soft/include/AL 19 | ) 20 | target_link_libraries(external_openal 21 | INTERFACE 22 | ${libs_loc}/openal-soft/build/$,Debug,RelWithDebInfo>/OpenAL32.lib 23 | ) 24 | elseif (APPLE) 25 | target_include_directories(external_openal SYSTEM 26 | INTERFACE 27 | ${libs_loc}/local/include 28 | ${libs_loc}/local/include/AL 29 | ) 30 | target_link_libraries(external_openal 31 | INTERFACE 32 | ${libs_loc}/local/lib/libopenal.a 33 | ) 34 | endif() 35 | 36 | target_compile_definitions(external_openal 37 | INTERFACE 38 | AL_LIBTYPE_STATIC 39 | ) 40 | -------------------------------------------------------------------------------- /external/openh264/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (DESKTOP_APP_USE_PACKAGED) 8 | add_library(external_openh264 INTERFACE IMPORTED GLOBAL) 9 | add_library(desktop-app::external_openh264 ALIAS external_openh264) 10 | 11 | find_package(PkgConfig) 12 | if (PkgConfig_FOUND) 13 | pkg_check_modules(DESKTOP_APP_OPENH264 IMPORTED_TARGET openh264) 14 | endif() 15 | 16 | target_link_libraries(external_openh264 INTERFACE PkgConfig::DESKTOP_APP_OPENH264) 17 | return() 18 | endif() 19 | 20 | add_library(external_openh264 STATIC IMPORTED GLOBAL) 21 | add_library(desktop-app::external_openh264 ALIAS external_openh264) 22 | 23 | if (WIN32) 24 | target_include_directories(external_openh264 SYSTEM 25 | INTERFACE 26 | ${libs_loc}/local/include 27 | ) 28 | set_target_properties(external_openh264 PROPERTIES 29 | IMPORTED_LOCATION "${libs_loc}/openh264/builddir-release/libopenh264.a" 30 | IMPORTED_LOCATION_DEBUG "${libs_loc}/openh264/builddir-debug/libopenh264.a" 31 | ) 32 | elseif (APPLE) 33 | target_include_directories(external_openh264 SYSTEM 34 | INTERFACE 35 | ${libs_loc}/local/include 36 | ) 37 | set_target_properties(external_openh264 PROPERTIES 38 | IMPORTED_LOCATION ${libs_loc}/local/lib/libopenh264.a 39 | ) 40 | else() 41 | find_library(DESKTOP_APP_OPENH264_LIBRARIES libopenh264.a REQUIRED) 42 | set_target_properties(external_openh264 PROPERTIES 43 | IMPORTED_LOCATION "${DESKTOP_APP_OPENH264_LIBRARIES}" 44 | ) 45 | endif() 46 | -------------------------------------------------------------------------------- /external/openssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_openssl INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_openssl ALIAS external_openssl) 9 | 10 | if (WIN32) 11 | set(openssl_lib_loc ${libs_loc}/openssl3/out) 12 | elseif (APPLE) 13 | set(openssl_lib_loc ${libs_loc}/openssl3) 14 | endif() 15 | 16 | add_subdirectory(openssl_common) 17 | add_subdirectory(openssl_ssl) 18 | add_subdirectory(openssl_crypto) 19 | 20 | target_link_libraries(external_openssl 21 | INTERFACE 22 | desktop-app::external_openssl_ssl 23 | desktop-app::external_openssl_crypto 24 | ) 25 | -------------------------------------------------------------------------------- /external/openssl/openssl_common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_openssl_common INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_openssl_common ALIAS external_openssl_common) 9 | 10 | if (NOT DESKTOP_APP_USE_PACKAGED AND NOT LINUX) 11 | target_include_directories(external_openssl_common SYSTEM 12 | INTERFACE 13 | ${libs_loc}/openssl3/include 14 | ) 15 | endif() 16 | 17 | # OpenSSL 3 deprecated AES_set_encrypt_key/decrypt_key/ige_encrypt/cbc_encrypt 18 | target_compile_options(external_openssl_common 19 | INTERFACE 20 | $,/wd4996,-Wno-deprecated-declarations> 21 | ) 22 | -------------------------------------------------------------------------------- /external/openssl/openssl_crypto/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_openssl_crypto INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_openssl_crypto ALIAS external_openssl_crypto) 9 | 10 | target_link_libraries(external_openssl_crypto 11 | INTERFACE 12 | desktop-app::external_openssl_common 13 | ) 14 | 15 | if (DESKTOP_APP_USE_PACKAGED) 16 | find_package(OpenSSL REQUIRED) 17 | target_link_libraries(external_openssl_crypto INTERFACE OpenSSL::Crypto) 18 | return() 19 | endif() 20 | 21 | add_library(external_openssl_crypto_bundled STATIC IMPORTED GLOBAL) 22 | add_library(desktop-app::external_openssl_crypto_bundled ALIAS external_openssl_crypto_bundled) 23 | 24 | if (WIN32) 25 | set_target_properties(external_openssl_crypto_bundled PROPERTIES 26 | IMPORTED_LOCATION "${openssl_lib_loc}/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}" 27 | IMPORTED_LOCATION_DEBUG "${openssl_lib_loc}.dbg/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}" 28 | ) 29 | elseif (APPLE) 30 | set_target_properties(external_openssl_crypto_bundled PROPERTIES 31 | IMPORTED_LOCATION "${openssl_lib_loc}/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}" 32 | ) 33 | else() 34 | find_library(DESKTOP_APP_CRYPTO_LIBRARIES libcrypto.a REQUIRED) 35 | set_target_properties(external_openssl_crypto_bundled PROPERTIES 36 | IMPORTED_LOCATION "${DESKTOP_APP_CRYPTO_LIBRARIES}" 37 | ) 38 | endif() 39 | 40 | target_link_libraries(external_openssl_crypto 41 | INTERFACE 42 | desktop-app::external_openssl_crypto_bundled 43 | ) 44 | -------------------------------------------------------------------------------- /external/openssl/openssl_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_openssl_ssl INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_openssl_ssl ALIAS external_openssl_ssl) 9 | 10 | target_link_libraries(external_openssl_ssl 11 | INTERFACE 12 | desktop-app::external_openssl_common 13 | ) 14 | 15 | if (DESKTOP_APP_USE_PACKAGED) 16 | find_package(OpenSSL REQUIRED) 17 | target_link_libraries(external_openssl_ssl INTERFACE OpenSSL::SSL) 18 | return() 19 | endif() 20 | 21 | add_library(external_openssl_ssl_bundled STATIC IMPORTED GLOBAL) 22 | add_library(desktop-app::external_openssl_ssl_bundled ALIAS external_openssl_ssl_bundled) 23 | 24 | if (WIN32) 25 | set_target_properties(external_openssl_ssl_bundled PROPERTIES 26 | IMPORTED_LOCATION "${openssl_lib_loc}/libssl${CMAKE_STATIC_LIBRARY_SUFFIX}" 27 | IMPORTED_LOCATION_DEBUG "${openssl_lib_loc}.dbg/libssl${CMAKE_STATIC_LIBRARY_SUFFIX}" 28 | ) 29 | elseif (APPLE) 30 | set_target_properties(external_openssl_ssl_bundled PROPERTIES 31 | IMPORTED_LOCATION "${openssl_lib_loc}/libssl${CMAKE_STATIC_LIBRARY_SUFFIX}" 32 | ) 33 | else() 34 | find_library(DESKTOP_APP_SSL_LIBRARIES libssl.a REQUIRED) 35 | set_target_properties(external_openssl_ssl_bundled PROPERTIES 36 | IMPORTED_LOCATION "${DESKTOP_APP_SSL_LIBRARIES}" 37 | ) 38 | endif() 39 | 40 | target_link_libraries(external_openssl_ssl 41 | INTERFACE 42 | desktop-app::external_openssl_ssl_bundled 43 | ) 44 | -------------------------------------------------------------------------------- /external/opus/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (DESKTOP_APP_USE_PACKAGED) 8 | add_library(external_opus INTERFACE IMPORTED GLOBAL) 9 | add_library(desktop-app::external_opus ALIAS external_opus) 10 | 11 | find_package(Opus QUIET) 12 | if (Opus_FOUND) 13 | target_link_libraries(external_opus INTERFACE Opus::opus) 14 | return() 15 | endif() 16 | 17 | find_package(PkgConfig REQUIRED) 18 | pkg_check_modules(DESKTOP_APP_OPUS IMPORTED_TARGET opus) 19 | 20 | target_link_libraries(external_opus INTERFACE PkgConfig::DESKTOP_APP_OPUS) 21 | return() 22 | endif() 23 | 24 | add_library(external_opus STATIC IMPORTED GLOBAL) 25 | add_library(desktop-app::external_opus ALIAS external_opus) 26 | 27 | if (WIN32) 28 | target_include_directories(external_opus SYSTEM 29 | INTERFACE 30 | ${libs_loc}/opus/include 31 | ) 32 | set(opus_lib_loc ${libs_loc}/opus/out) 33 | set_target_properties(external_opus PROPERTIES 34 | IMPORTED_LOCATION "${opus_lib_loc}/Release/opus.lib" 35 | IMPORTED_LOCATION_DEBUG "${opus_lib_loc}/Debug/opus.lib" 36 | ) 37 | elseif (APPLE) 38 | target_include_directories(external_opus SYSTEM 39 | INTERFACE 40 | ${libs_loc}/local/include/opus 41 | ) 42 | set_target_properties(external_opus PROPERTIES 43 | IMPORTED_LOCATION ${libs_loc}/local/lib/libopus.a 44 | ) 45 | else() 46 | target_include_directories(external_opus SYSTEM 47 | INTERFACE 48 | /usr/local/include/opus 49 | ) 50 | find_library(DESKTOP_APP_OPUS_LIBRARIES libopus.a REQUIRED) 51 | set_target_properties(external_opus PROPERTIES 52 | IMPORTED_LOCATION "${DESKTOP_APP_OPUS_LIBRARIES}" 53 | ) 54 | endif() 55 | -------------------------------------------------------------------------------- /external/qr_code_generator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qr_code_generator INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_qr_code_generator ALIAS external_qr_code_generator) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_library(DESKTOP_APP_QRCODE_LIBRARIES NAMES qrcodegencpp) 12 | find_path(DESKTOP_APP_QRCODE_INCLUDE_DIRS NAMES qrcodegen.hpp QrCode.hpp PATH_SUFFIXES qrcodegencpp qrcodegen) 13 | 14 | if (DESKTOP_APP_QRCODE_LIBRARIES AND DESKTOP_APP_QRCODE_INCLUDE_DIRS) 15 | target_include_directories(external_qr_code_generator SYSTEM INTERFACE ${DESKTOP_APP_QRCODE_INCLUDE_DIRS}) 16 | target_link_libraries(external_qr_code_generator INTERFACE ${DESKTOP_APP_QRCODE_LIBRARIES}) 17 | return() 18 | endif() 19 | endif() 20 | 21 | add_library(external_qr_code_generator_bundled STATIC) 22 | init_target(external_qr_code_generator_bundled "(external)") 23 | 24 | set(qr_loc ${third_party_loc}/QR) 25 | set(qr_src ${qr_loc}/cpp) 26 | 27 | nice_target_sources(external_qr_code_generator_bundled ${qr_src} 28 | PRIVATE 29 | qrcodegen.cpp 30 | qrcodegen.hpp 31 | ) 32 | 33 | target_include_directories(external_qr_code_generator_bundled 34 | PUBLIC 35 | ${qr_src} 36 | ) 37 | 38 | target_link_libraries(external_qr_code_generator 39 | INTERFACE 40 | external_qr_code_generator_bundled 41 | ) 42 | -------------------------------------------------------------------------------- /external/qt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qt INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_qt ALIAS external_qt) 9 | 10 | add_subdirectory(qt_static_plugins) 11 | 12 | if (DESKTOP_APP_USE_PACKAGED) 13 | target_link_libraries(external_qt 14 | INTERFACE 15 | Qt::Core 16 | Qt::CorePrivate 17 | Qt::Gui 18 | Qt::GuiPrivate 19 | Qt::Widgets 20 | Qt::WidgetsPrivate 21 | Qt::Network 22 | Qt::Svg 23 | ) 24 | 25 | if (TARGET Qt::OpenGL) 26 | target_link_libraries(external_qt INTERFACE Qt::OpenGL) 27 | endif() 28 | 29 | if (TARGET Qt::OpenGLWidgets) 30 | target_link_libraries(external_qt INTERFACE Qt::OpenGLWidgets) 31 | endif() 32 | 33 | if (TARGET Qt::DBus) 34 | target_link_libraries(external_qt INTERFACE Qt::DBus) 35 | endif() 36 | 37 | if (TARGET Qt::Quick) 38 | target_link_libraries(external_qt INTERFACE Qt::Quick) 39 | endif() 40 | 41 | if (TARGET Qt::QuickWidgets) 42 | target_link_libraries(external_qt INTERFACE Qt::QuickWidgets) 43 | endif() 44 | 45 | if (TARGET Qt::WaylandCompositor) 46 | target_link_libraries(external_qt INTERFACE Qt::WaylandCompositor) 47 | endif() 48 | 49 | return() 50 | endif() 51 | 52 | target_include_directories(external_qt SYSTEM 53 | INTERFACE 54 | ${qt_loc}/include 55 | ${qt_loc}/include/QtCore 56 | ${qt_loc}/include/QtGui 57 | $<$:${qt_loc}/include/QtOpenGL> 58 | ${qt_loc}/include/QtWidgets 59 | $<$:${qt_loc}/include/QtOpenGLWidgets> 60 | ${qt_loc}/include/QtSvg 61 | $<$:${qt_loc}/include/QtDBus> 62 | $<$:${qt_loc}/include/QtQuick> 63 | $<$:${qt_loc}/include/QtQuickWidgets> 64 | $<$:${qt_loc}/include/QtWaylandCompositor> 65 | ${qt_loc}/include/QtCore/${QT_VERSION} 66 | ${qt_loc}/include/QtGui/${QT_VERSION} 67 | ${qt_loc}/include/QtWidgets/${QT_VERSION} 68 | ${qt_loc}/include/QtCore/${QT_VERSION}/QtCore 69 | ${qt_loc}/include/QtGui/${QT_VERSION}/QtGui 70 | ${qt_loc}/include/QtWidgets/${QT_VERSION}/QtWidgets 71 | ) 72 | 73 | target_compile_definitions(external_qt 74 | INTERFACE 75 | _REENTRANT 76 | QT_STATICPLUGIN 77 | QT_PLUGIN 78 | QT_CORE_LIB 79 | QT_GUI_LIB 80 | $<$:QT_OPENGL_LIB> 81 | QT_WIDGETS_LIB 82 | $<$:QT_OPENGLWIDGETS_LIB> 83 | QT_NETWORK_LIB 84 | QT_SVG_LIB 85 | $<$:QT_DBUS_LIB> 86 | $<$:QT_QUICK_LIB> 87 | $<$:QT_QUICKWIDGETS_LIB> 88 | $<$:QT_WAYLANDCOMPOSITOR_LIB> 89 | ) 90 | 91 | if (WIN32) 92 | set(qt_lib_prefix "") 93 | set(qt_lib_suffix $<$:d>.lib) 94 | 95 | target_compile_definitions(external_qt 96 | INTERFACE 97 | _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING 98 | ) 99 | else() 100 | set(qt_lib_prefix lib) 101 | if (APPLE) 102 | set(qt_lib_suffix $<$:_debug>.a) 103 | else() 104 | set(qt_lib_suffix .a) 105 | endif() 106 | endif() 107 | 108 | set(common_qt_libs 109 | plugins/imageformats/${qt_lib_prefix}qwebp 110 | plugins/imageformats/${qt_lib_prefix}qgif 111 | plugins/imageformats/${qt_lib_prefix}qjpeg 112 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Svg 113 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Network 114 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Widgets 115 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Gui 116 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core 117 | ) 118 | 119 | if (TARGET Qt::OpenGL) 120 | list(PREPEND common_qt_libs 121 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}OpenGL 122 | ) 123 | endif() 124 | 125 | if (TARGET Qt::OpenGLWidgets) 126 | list(PREPEND common_qt_libs 127 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}OpenGLWidgets 128 | ) 129 | endif() 130 | 131 | if (TARGET Qt::Quick) 132 | list(PREPEND common_qt_libs 133 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Quick 134 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Qml 135 | ) 136 | endif() 137 | 138 | if (TARGET Qt::QuickWidgets) 139 | list(PREPEND common_qt_libs 140 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QuickWidgets 141 | ) 142 | endif() 143 | 144 | if (QT_VERSION_MAJOR GREATER_EQUAL 6) 145 | list(APPEND common_qt_libs 146 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledHarfbuzz 147 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledLibpng 148 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledPcre2 149 | ) 150 | else() 151 | list(APPEND common_qt_libs 152 | lib/${qt_lib_prefix}qtharfbuzz 153 | lib/${qt_lib_prefix}qtlibpng 154 | lib/${qt_lib_prefix}qtpcre2 155 | ) 156 | 157 | endif() 158 | 159 | set(qt_libs_list "") 160 | if (QT_VERSION_MAJOR GREATER_EQUAL 6) 161 | list(APPEND qt_libs_list 162 | $ 163 | $ 164 | $ 165 | ) 166 | endif() 167 | 168 | if (WIN32) 169 | target_include_directories(external_qt SYSTEM 170 | INTERFACE 171 | ${qt_loc}/mkspecs/win32-msvc 172 | ) 173 | set(qt_libs 174 | ${common_qt_libs} 175 | plugins/platforms/${qt_lib_prefix}qwindows 176 | ) 177 | if (QT_VERSION GREATER 6) 178 | list(APPEND qt_libs 179 | plugins/tls/${qt_lib_prefix}qschannelbackend 180 | plugins/networkinformation/${qt_lib_prefix}qnetworklistmanager 181 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledFreetype 182 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}EntryPoint 183 | ) 184 | list(APPEND qt_libs_list 185 | $ 186 | $ 187 | $ 188 | $ 189 | ) 190 | else() 191 | list(APPEND qt_libs 192 | plugins/bearer/${qt_lib_prefix}qgenericbearer 193 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}AccessibilitySupport 194 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}FontDatabaseSupport 195 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}EventDispatcherSupport 196 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}ThemeSupport 197 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WindowsUIAutomationSupport 198 | lib/${qt_lib_prefix}qtmain 199 | lib/${qt_lib_prefix}qtfreetype 200 | ) 201 | endif() 202 | foreach (lib ${qt_libs}) 203 | list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") 204 | endforeach() 205 | 206 | if (QT_VERSION GREATER 6) 207 | target_link_libraries(external_qt 208 | INTERFACE 209 | Authz 210 | Dwrite 211 | DXGI 212 | dxguid 213 | D3D9 214 | D3D11 215 | D3D12 216 | SetupAPI 217 | Shcore 218 | Synchronization 219 | WindowsApp 220 | ) 221 | else() 222 | target_link_libraries(external_qt 223 | INTERFACE 224 | desktop-app::external_angle 225 | ) 226 | endif() 227 | elseif (APPLE) 228 | target_include_directories(external_qt SYSTEM 229 | INTERFACE 230 | ${qt_loc}/mkspecs/macx-clang 231 | ) 232 | set(qt_libs 233 | ${common_qt_libs} 234 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledFreetype 235 | plugins/platforms/${qt_lib_prefix}qcocoa 236 | plugins/tls/${qt_lib_prefix}qsecuretransportbackend 237 | plugins/networkinformation/${qt_lib_prefix}qscnetworkreachability 238 | ) 239 | list(APPEND qt_libs_list 240 | $ 241 | $ 242 | $ 243 | $ 244 | ) 245 | foreach (lib ${qt_libs}) 246 | list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") 247 | endforeach() 248 | else() 249 | set(qt_libs 250 | plugins/platforms/${qt_lib_prefix}qwayland-generic 251 | plugins/platforms/${qt_lib_prefix}qwayland-egl 252 | plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl 253 | plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell 254 | plugins/wayland-decoration-client/${qt_lib_prefix}adwaita 255 | plugins/wayland-decoration-client/${qt_lib_prefix}bradient 256 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandEglClientHwIntegration 257 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandClient 258 | plugins/platforms/${qt_lib_prefix}qxcb 259 | plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration 260 | plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration 261 | plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin 262 | plugins/iconengines/${qt_lib_prefix}qsvgicon 263 | plugins/platformthemes/${qt_lib_prefix}qgtk3 264 | plugins/tls/${qt_lib_prefix}qopensslbackend 265 | plugins/networkinformation/${qt_lib_prefix}qglib 266 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}XcbQpa 267 | ${common_qt_libs} 268 | ) 269 | list(APPEND qt_libs_list 270 | $ 271 | $ 272 | $ 273 | $ 274 | $ 275 | $ 276 | $ 277 | $ 278 | $ 279 | $ 280 | $ 281 | $ 282 | $ 283 | $ 284 | ) 285 | if (TARGET Qt::DBus) 286 | list(PREPEND qt_libs 287 | plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin 288 | plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal 289 | ) 290 | list(APPEND qt_libs 291 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}DBus 292 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core 293 | ) 294 | list(APPEND qt_libs_list 295 | $ 296 | $ 297 | ) 298 | endif() 299 | if (TARGET Qt::WaylandCompositor) 300 | list(PREPEND qt_libs 301 | plugins/wayland-graphics-integration-server/${qt_lib_prefix}qt-wayland-compositor-wayland-egl 302 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandEglCompositorHwIntegration 303 | lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandCompositor 304 | ) 305 | list(APPEND qt_libs_list 306 | $ 307 | $ 308 | ) 309 | endif() 310 | foreach (lib ${qt_libs}) 311 | list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") 312 | endforeach() 313 | endif() 314 | 315 | if (QT_VERSION_MAJOR GREATER_EQUAL 6) 316 | list(APPEND qt_libs_list 317 | $ 318 | $<$:$> 319 | $ 320 | $ 321 | $ 322 | ) 323 | 324 | if (TARGET Qt::Quick) 325 | list(APPEND qt_libs_list 326 | $ 327 | ) 328 | endif() 329 | endif() 330 | 331 | target_link_libraries(external_qt 332 | INTERFACE 333 | ${qt_libs_list} 334 | $ 335 | $ 336 | $ 337 | $ 338 | $ 339 | $ 340 | $ 341 | ) 342 | 343 | if (WIN32) 344 | if (build_winarm) 345 | set(libwebp_release_folder ARM64) 346 | elseif (build_win64) 347 | set(libwebp_release_folder x64) 348 | else() 349 | set(libwebp_release_folder x86) 350 | endif() 351 | 352 | set(webp_lib_loc ${libs_loc}/libwebp/out/$,debug,release>-static/${libwebp_release_folder}/lib) 353 | 354 | target_link_libraries(external_qt 355 | INTERFACE 356 | ${webp_lib_loc}/libwebp$<$:_debug>.lib 357 | ${webp_lib_loc}/libwebpdemux$<$:_debug>.lib 358 | ${webp_lib_loc}/libwebpmux$<$:_debug>.lib 359 | ) 360 | 361 | if (QT_VERSION GREATER 6) 362 | set(lcms2_lib_loc ${libs_loc}/liblcms2/out/$,Debug,Release>/src) 363 | target_link_libraries(external_qt INTERFACE ${lcms2_lib_loc}/liblcms2.a) 364 | endif() 365 | elseif (APPLE) 366 | target_link_libraries(external_qt 367 | INTERFACE 368 | ${libs_loc}/local/lib/liblcms2.a 369 | ${libs_loc}/local/lib/libwebp.a 370 | ${libs_loc}/local/lib/libwebpdemux.a 371 | ${libs_loc}/local/lib/libwebpmux.a 372 | ${libs_loc}/local/lib/libsharpyuv.a 373 | ) 374 | elseif (LINUX) 375 | target_include_directories(external_qt SYSTEM 376 | INTERFACE 377 | ${qt_loc}/mkspecs/linux-g++ 378 | ) 379 | target_link_libraries(external_qt 380 | INTERFACE 381 | gtk-3 382 | gdk-3 383 | gdk_pixbuf-2.0 384 | pango-1.0 385 | lcms2 386 | fontconfig 387 | freetype 388 | EGL 389 | GL 390 | wayland-egl 391 | wayland-cursor 392 | wayland-client 393 | X11-xcb 394 | X11 395 | xkbcommon 396 | xkbcommon-x11 397 | xcb-cursor 398 | xcb-glx 399 | xcb-xkb 400 | xcb-randr 401 | xcb-icccm 402 | xcb-shm 403 | xcb-render 404 | xcb-image 405 | xcb-xfixes 406 | xcb-shape 407 | xcb-sync 408 | xcb-util 409 | xcb-render-util 410 | xcb-keysyms 411 | xcb 412 | gio-2.0 413 | gobject-2.0 414 | glib-2.0 415 | rt 416 | webpmux 417 | webpdemux 418 | webp 419 | sharpyuv 420 | ) 421 | if (TARGET Qt::WaylandCompositor) 422 | target_link_libraries(external_qt 423 | INTERFACE 424 | wayland-server 425 | ) 426 | endif() 427 | endif() 428 | -------------------------------------------------------------------------------- /external/qt/package.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (NOT DESKTOP_APP_USE_PACKAGED) 8 | if (DEFINED ENV{QT}) 9 | set(qt_requested $ENV{QT} CACHE STRING "Qt version" FORCE) 10 | endif() 11 | 12 | if (NOT LINUX AND NOT DEFINED qt_requested) 13 | message(FATAL_ERROR "Qt version is unknown, set `QT' environment variable") 14 | endif() 15 | 16 | if (WIN32) 17 | set(qt_loc ${libs_loc}/Qt-${qt_requested}) 18 | 19 | if (qt_requested GREATER 6) 20 | set(OPENSSL_FOUND 1) 21 | set(OPENSSL_INCLUDE_DIR ${libs_loc}/openssl3/include) 22 | set(LIB_EAY_DEBUG ${libs_loc}/openssl3/out.dbg/libcrypto.lib) 23 | set(SSL_EAY_DEBUG ${libs_loc}/openssl3/out.dbg/libssl.lib) 24 | set(LIB_EAY_RELEASE ${libs_loc}/openssl3/out/libcrypto.lib) 25 | set(SSL_EAY_RELEASE ${libs_loc}/openssl3/out/libssl.lib) 26 | set(JPEG_FOUND 1) 27 | set(JPEG_INCLUDE_DIR ${libs_loc}/mozjpeg) 28 | set(JPEG_LIBRARY_DEBUG ${libs_loc}/mozjpeg/Debug/jpeg-static.lib) 29 | set(JPEG_LIBRARY_RELEASE ${libs_loc}/mozjpeg/Release/jpeg-static.lib) 30 | set(ZLIB_FOUND 1) 31 | set(ZLIB_INCLUDE_DIR ${libs_loc}/zlib) 32 | set(ZLIB_LIBRARY_DEBUG ${libs_loc}/zlib/Debug/zlibstaticd.lib) 33 | set(ZLIB_LIBRARY_RELEASE ${libs_loc}/zlib/Release/zlibstatic.lib) 34 | set(WebP_INCLUDE_DIR ${libs_loc}/libwebp/src) 35 | set(WebP_demux_INCLUDE_DIR ${libs_loc}/libwebp/src) 36 | set(WebP_mux_INCLUDE_DIR ${libs_loc}/libwebp/src) 37 | set(WebP_LIBRARY ${libs_loc}/libwebp/out/release-static/x86/lib/webp.lib) 38 | set(WebP_demux_LIBRARY ${libs_loc}/libwebp/out/release-static/x86/lib/webpdemux.lib) 39 | set(WebP_mux_LIBRARY ${libs_loc}/libwebp/out/release-static/x86/lib/webpmux.lib) 40 | set(LCMS2_FOUND 1) 41 | set(LCMS2_INCLUDE_DIR ${libs_loc}/liblcms2/include) 42 | set(LCMS2_LIBRARIES ${libs_loc}/liblcms2/out/Release/src/liblcms2.a) 43 | endif() 44 | elseif (APPLE) 45 | set(qt_loc ${libs_loc}/local/Qt-${qt_requested}) 46 | else() 47 | set(qt_loc /usr/local) 48 | endif() 49 | 50 | list(APPEND CMAKE_PREFIX_PATH ${qt_loc} ${libs_loc}/local) 51 | endif() 52 | 53 | if (NOT DEFINED QT_VERSION_MAJOR) 54 | find_package(QT NAMES Qt6 COMPONENTS Core QUIET) 55 | if (NOT QT_FOUND) 56 | find_package(QT NAMES Qt5 COMPONENTS Core QUIET) 57 | endif() 58 | if (NOT QT_FOUND) 59 | message(FATAL_ERROR "Neither Qt6 nor Qt5 is found") 60 | endif() 61 | endif() 62 | 63 | if (NOT LINUX AND NOT DESKTOP_APP_USE_PACKAGED AND NOT qt_requested EQUAL QT_VERSION) 64 | message(FATAL_ERROR "Configured Qt version ${QT_VERSION} does not match requested version ${qt_requested}. Please reconfigure.") 65 | endif() 66 | 67 | find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED) 68 | find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Quick QuickWidgets QUIET) 69 | 70 | if (QT_VERSION_MAJOR GREATER_EQUAL 6) 71 | find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED) 72 | endif() 73 | 74 | if (LINUX) 75 | find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus WaylandCompositor QUIET) 76 | endif() 77 | 78 | set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "(gen)") 79 | set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "(gen)") 80 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qt_static_plugins OBJECT) 8 | add_library(desktop-app::external_qt_static_plugins ALIAS external_qt_static_plugins) 9 | init_target(external_qt_static_plugins "(external)") 10 | 11 | nice_target_sources(external_qt_static_plugins ${CMAKE_CURRENT_SOURCE_DIR} 12 | PRIVATE 13 | qt_static_plugins.cpp 14 | ) 15 | 16 | target_link_libraries(external_qt_static_plugins 17 | PUBLIC 18 | desktop-app::external_qt 19 | ) 20 | 21 | if (DESKTOP_APP_USE_PACKAGED) 22 | target_compile_definitions(external_qt_static_plugins 23 | PRIVATE 24 | QT_STATIC_PLUGINS_USE_PACKAGED 25 | ) 26 | endif() 27 | 28 | if (DESKTOP_APP_DISABLE_QT_PLUGINS) 29 | return() 30 | endif() 31 | 32 | add_checked_subdirectory(kimageformats) 33 | target_link_libraries(external_qt_static_plugins 34 | PUBLIC 35 | desktop-app::external_qt_static_plugins_kimageformats 36 | ) 37 | 38 | if (LINUX) 39 | add_checked_subdirectory(nimf) 40 | target_link_libraries(external_qt_static_plugins 41 | PUBLIC 42 | desktop-app::external_qt_static_plugins_nimf 43 | ) 44 | 45 | if (TARGET Qt::DBus) 46 | add_checked_subdirectory(fcitx5) 47 | target_link_libraries(external_qt_static_plugins 48 | PUBLIC 49 | desktop-app::external_qt_static_plugins_fcitx5 50 | ) 51 | endif() 52 | 53 | if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) 54 | add_checked_subdirectory(hime) 55 | target_link_libraries(external_qt_static_plugins 56 | PUBLIC 57 | desktop-app::external_qt_static_plugins_hime 58 | ) 59 | endif() 60 | endif() 61 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/fcitx5/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qt_static_plugins_fcitx5 STATIC) 8 | add_library(desktop-app::external_qt_static_plugins_fcitx5 ALIAS external_qt_static_plugins_fcitx5) 9 | init_target(external_qt_static_plugins_fcitx5 "(external)") 10 | 11 | set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt) 12 | set(fcitx5_qt_src ${fcitx5_qt_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext) 13 | 14 | set_target_properties(external_qt_static_plugins_fcitx5 PROPERTIES AUTOMOC ON) 15 | set(FCITX5_QT_EXTRA_PLUGIN_NAME "\"fcitx\",") 16 | 17 | configure_file("${fcitx5_qt_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json") 18 | 19 | nice_target_sources(external_qt_static_plugins_fcitx5 ${fcitx5_qt_src} 20 | PRIVATE 21 | fcitx4watcher.cpp 22 | fcitx4inputcontextproxy.cpp 23 | fcitx4inputcontextproxyimpl.cpp 24 | fcitx4inputmethodproxy.cpp 25 | hybridinputcontext.cpp 26 | qfcitxplatforminputcontext.cpp 27 | fcitxcandidatewindow.cpp 28 | fcitxtheme.cpp 29 | font.cpp 30 | qtkey.cpp 31 | main.cpp 32 | ) 33 | 34 | target_include_directories(external_qt_static_plugins_fcitx5 35 | PRIVATE 36 | ${fcitx5_qt_src} 37 | ${fcitx5_qt_loc}/common 38 | ) 39 | 40 | target_compile_definitions(external_qt_static_plugins_fcitx5 41 | PRIVATE 42 | QT_STATICPLUGIN 43 | FCITX_PLUGIN_DATA_FILE_PATH="${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json" 44 | ) 45 | 46 | find_package(PkgConfig REQUIRED) 47 | pkg_check_modules(DESKTOP_APP_XKBCOMMON REQUIRED IMPORTED_TARGET xkbcommon) 48 | 49 | add_subdirectory(fcitx5_qt_dbusaddons) 50 | target_link_libraries(external_qt_static_plugins_fcitx5 51 | PRIVATE 52 | desktop-app::external_qt_static_plugins_fcitx5_dbusaddons 53 | desktop-app::external_qt 54 | PkgConfig::DESKTOP_APP_XKBCOMMON 55 | ) 56 | 57 | if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) 58 | target_compile_definitions(external_qt_static_plugins_fcitx5 59 | PRIVATE 60 | ENABLE_X11 61 | ) 62 | 63 | target_link_libraries(external_qt_static_plugins_fcitx5 64 | PRIVATE 65 | desktop-app::external_xcb 66 | ) 67 | endif() 68 | 69 | add_library(external_qt_static_plugins_fcitx5_init OBJECT) 70 | add_library(desktop-app::external_qt_static_plugins_fcitx5_init ALIAS external_qt_static_plugins_fcitx5_init) 71 | init_target(external_qt_static_plugins_fcitx5_init "(external)") 72 | 73 | nice_target_sources(external_qt_static_plugins_fcitx5_init ${CMAKE_CURRENT_SOURCE_DIR} 74 | PRIVATE 75 | init.cpp 76 | ) 77 | 78 | target_link_libraries(external_qt_static_plugins_fcitx5_init 79 | PRIVATE 80 | desktop-app::external_qt 81 | ) 82 | 83 | target_link_libraries(external_qt_static_plugins_fcitx5 84 | INTERFACE 85 | external_qt_static_plugins_fcitx5_init 86 | $ 87 | ) 88 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/fcitx5/fcitx5_qt_dbusaddons/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qt_static_plugins_fcitx5_dbusaddons STATIC) 8 | add_library(desktop-app::external_qt_static_plugins_fcitx5_dbusaddons ALIAS external_qt_static_plugins_fcitx5_dbusaddons) 9 | init_target(external_qt_static_plugins_fcitx5_dbusaddons "(external)") 10 | 11 | set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt) 12 | set(fcitx5_qt_dbusaddons_src ${fcitx5_qt_loc}/qt${QT_VERSION_MAJOR}/dbusaddons) 13 | 14 | set_target_properties(external_qt_static_plugins_fcitx5_dbusaddons PROPERTIES AUTOMOC ON) 15 | 16 | nice_target_sources(external_qt_static_plugins_fcitx5_dbusaddons ${fcitx5_qt_dbusaddons_src} 17 | PRIVATE 18 | fcitxqtwatcher.cpp 19 | fcitxqtwatcher.h 20 | fcitxqtdbustypes.cpp 21 | fcitxqtdbustypes.h 22 | fcitxqtinputcontextproxy.cpp 23 | fcitxqtinputcontextproxy.h 24 | fcitxqtinputcontextproxyimpl.cpp 25 | fcitxqtinputmethodproxy.cpp 26 | fcitxqtinputmethodproxy.h 27 | fcitxqtcontrollerproxy.cpp 28 | fcitxqtcontrollerproxy.h 29 | ) 30 | 31 | include(GenerateExportHeader) 32 | generate_export_header(external_qt_static_plugins_fcitx5_dbusaddons BASE_NAME Fcitx5Qt${QT_VERSION_MAJOR}DBusAddons) 33 | 34 | target_include_directories(external_qt_static_plugins_fcitx5_dbusaddons 35 | PUBLIC 36 | ${fcitx5_qt_dbusaddons_src} 37 | "${CMAKE_CURRENT_BINARY_DIR}" 38 | ) 39 | 40 | if (QT_VERSION_MAJOR EQUAL 5) 41 | target_compile_definitions(external_qt_static_plugins_fcitx5_dbusaddons 42 | PRIVATE 43 | FCITX5QT5DBUSADDONS_STATIC_DEFINE 44 | ) 45 | endif() 46 | 47 | target_link_libraries(external_qt_static_plugins_fcitx5_dbusaddons 48 | PRIVATE 49 | desktop-app::external_qt 50 | ) 51 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/fcitx5/init.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Desktop App Toolkit, 3 | a set of libraries for developing nice desktop applications. 4 | 5 | For license and copyright information please follow this link: 6 | https://github.com/desktop-app/legal/blob/master/LEGAL 7 | */ 8 | #include 9 | 10 | Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) 11 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/hime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qt_static_plugins_hime STATIC) 8 | add_library(desktop-app::external_qt_static_plugins_hime ALIAS external_qt_static_plugins_hime) 9 | init_target(external_qt_static_plugins_hime "(external)") 10 | 11 | set(hime_loc ${third_party_loc}/hime) 12 | set(hime_qt_src ${hime_loc}/src/qt5-im) 13 | 14 | set_target_properties(external_qt_static_plugins_hime PROPERTIES AUTOMOC ON) 15 | 16 | nice_target_sources(external_qt_static_plugins_hime ${hime_qt_src} 17 | PRIVATE 18 | hime-imcontext-qt.cpp 19 | hime-imcontext-qt.h 20 | hime-qt.cpp 21 | hime-qt.h 22 | ) 23 | 24 | target_include_directories(external_qt_static_plugins_hime 25 | PRIVATE 26 | ${hime_qt_src} 27 | ) 28 | 29 | target_compile_definitions(external_qt_static_plugins_hime 30 | PRIVATE 31 | QT_STATICPLUGIN 32 | ) 33 | 34 | add_subdirectory(hime_im_client) 35 | target_link_libraries(external_qt_static_plugins_hime 36 | PRIVATE 37 | desktop-app::external_qt_static_plugins_hime_im_client 38 | desktop-app::external_qt 39 | ) 40 | 41 | add_library(external_qt_static_plugins_hime_init OBJECT) 42 | add_library(desktop-app::external_qt_static_plugins_hime_init ALIAS external_qt_static_plugins_hime_init) 43 | init_target(external_qt_static_plugins_hime_init "(external)") 44 | 45 | nice_target_sources(external_qt_static_plugins_hime_init ${CMAKE_CURRENT_SOURCE_DIR} 46 | PRIVATE 47 | init.cpp 48 | ) 49 | 50 | target_link_libraries(external_qt_static_plugins_hime_init 51 | PRIVATE 52 | desktop-app::external_qt 53 | ) 54 | 55 | target_link_libraries(external_qt_static_plugins_hime 56 | INTERFACE 57 | external_qt_static_plugins_hime_init 58 | $ 59 | ) 60 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/hime/hime_im_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qt_static_plugins_hime_im_client STATIC) 8 | add_library(desktop-app::external_qt_static_plugins_hime_im_client ALIAS external_qt_static_plugins_hime_im_client) 9 | init_target(external_qt_static_plugins_hime_im_client "(external)") 10 | 11 | set(hime_loc ${third_party_loc}/hime) 12 | set(hime_im_client_src ${hime_loc}/src/im-client) 13 | 14 | nice_target_sources(external_qt_static_plugins_hime_im_client ${CMAKE_CURRENT_SOURCE_DIR} 15 | PRIVATE 16 | hime_im_client_helper.cpp 17 | ) 18 | 19 | target_include_directories(external_qt_static_plugins_hime_im_client 20 | PUBLIC 21 | ${hime_im_client_src} 22 | ) 23 | 24 | target_link_libraries(external_qt_static_plugins_hime_im_client 25 | PRIVATE 26 | desktop-app::lib_base 27 | ) 28 | 29 | find_package(PkgConfig REQUIRED) 30 | pkg_check_modules(DESKTOP_APP_X11 REQUIRED x11) 31 | 32 | target_include_directories(external_qt_static_plugins_hime_im_client SYSTEM 33 | PRIVATE 34 | ${DESKTOP_APP_X11_INCLUDE_DIRS} 35 | ) 36 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/hime/hime_im_client/hime_im_client_helper.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Desktop App Toolkit, 2 | // a set of libraries for developing nice desktop applications. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/desktop-app/legal/blob/master/LEGAL 6 | // 7 | #include "base/platform/linux/base_linux_library.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace HimeHelper { 13 | namespace { 14 | 15 | void (*hime_im_client_close)(HIME_client_handle *handle); 16 | void (*hime_im_client_focus_in)(HIME_client_handle *handle); 17 | void (*hime_im_client_focus_out)(HIME_client_handle *handle); 18 | void (*hime_im_client_focus_out2)(HIME_client_handle *handle, char **rstr); 19 | int (*hime_im_client_forward_key_press)( 20 | HIME_client_handle *handle, 21 | const KeySym key, 22 | const uint32_t state, 23 | char **rstr); 24 | int (*hime_im_client_forward_key_release)( 25 | HIME_client_handle *handle, 26 | const KeySym key, 27 | const uint32_t state, 28 | char **rstr); 29 | int (*hime_im_client_get_preedit)( 30 | HIME_client_handle *handle, 31 | char **str, 32 | HIME_PREEDIT_ATTR att[], 33 | int *cursor, 34 | int *sub_comp_len); 35 | HIME_client_handle *(*hime_im_client_open)(Display *display); 36 | void (*hime_im_client_reset)(HIME_client_handle *handle); 37 | void (*hime_im_client_set_cursor_location)( 38 | HIME_client_handle *handle, 39 | const int x, 40 | const int y); 41 | void (*hime_im_client_set_flags)( 42 | HIME_client_handle *handle, 43 | const int flags, 44 | int *ret_flags); 45 | void (*hime_im_client_set_client_window)( 46 | HIME_client_handle *handle, 47 | const Window win); 48 | void (*hime_im_client_set_window)(HIME_client_handle *handle, Window win); 49 | 50 | bool Resolve() { 51 | static const auto loaded = [&] { 52 | const auto lib = base::Platform::LoadLibrary( 53 | "libhime-im-client.so.1", 54 | RTLD_NODELETE); 55 | return lib 56 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_close) 57 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_in) 58 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_out) 59 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_out2) 60 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_forward_key_press) 61 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_forward_key_release) 62 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_get_preedit) 63 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_open) 64 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_reset) 65 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_cursor_location) 66 | && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_flags) 67 | && (LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_client_window) 68 | || LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_window)); 69 | }(); 70 | return loaded; 71 | } 72 | 73 | } // namespace 74 | } // namespace HimeHelper 75 | 76 | void hime_im_client_close(HIME_client_handle *handle) { 77 | HimeHelper::Resolve(); 78 | HimeHelper::hime_im_client_close(handle); 79 | } 80 | 81 | void hime_im_client_focus_in(HIME_client_handle *handle) { 82 | HimeHelper::Resolve(); 83 | HimeHelper::hime_im_client_focus_in(handle); 84 | } 85 | 86 | void hime_im_client_focus_out(HIME_client_handle *handle) { 87 | HimeHelper::Resolve(); 88 | HimeHelper::hime_im_client_focus_out(handle); 89 | } 90 | 91 | void hime_im_client_focus_out2(HIME_client_handle *handle, char **rstr) { 92 | HimeHelper::Resolve(); 93 | HimeHelper::hime_im_client_focus_out2(handle, rstr); 94 | } 95 | 96 | int hime_im_client_forward_key_press( 97 | HIME_client_handle *handle, 98 | const KeySym key, 99 | const uint32_t state, 100 | char **rstr) { 101 | HimeHelper::Resolve(); 102 | return HimeHelper::hime_im_client_forward_key_press( 103 | handle, 104 | key, 105 | state, 106 | rstr); 107 | } 108 | 109 | int hime_im_client_forward_key_release( 110 | HIME_client_handle *handle, 111 | const KeySym key, 112 | const uint32_t state, 113 | char **rstr) { 114 | HimeHelper::Resolve(); 115 | return HimeHelper::hime_im_client_forward_key_release( 116 | handle, 117 | key, 118 | state, 119 | rstr); 120 | } 121 | 122 | int hime_im_client_get_preedit( 123 | HIME_client_handle *handle, 124 | char **str, 125 | HIME_PREEDIT_ATTR att[], 126 | int *cursor, 127 | int *sub_comp_len) { 128 | HimeHelper::Resolve(); 129 | return HimeHelper::hime_im_client_get_preedit( 130 | handle, 131 | str, 132 | att, 133 | cursor, 134 | sub_comp_len); 135 | } 136 | 137 | HIME_client_handle *hime_im_client_open(Display *display) { 138 | HimeHelper::Resolve(); 139 | return HimeHelper::hime_im_client_open(display); 140 | } 141 | 142 | void hime_im_client_reset(HIME_client_handle *handle) { 143 | HimeHelper::Resolve(); 144 | HimeHelper::hime_im_client_reset(handle); 145 | } 146 | 147 | void hime_im_client_set_cursor_location( 148 | HIME_client_handle *handle, 149 | const int x, 150 | const int y) { 151 | HimeHelper::Resolve(); 152 | HimeHelper::hime_im_client_set_cursor_location( 153 | handle, 154 | x, 155 | y); 156 | } 157 | 158 | void hime_im_client_set_flags( 159 | HIME_client_handle *handle, 160 | const int flags, 161 | int *ret_flags) { 162 | HimeHelper::Resolve(); 163 | HimeHelper::hime_im_client_set_flags( 164 | handle, 165 | flags, 166 | ret_flags); 167 | } 168 | 169 | void hime_im_client_set_client_window( 170 | HIME_client_handle *handle, 171 | const Window win) { 172 | HimeHelper::Resolve(); 173 | HimeHelper::hime_im_client_set_client_window(handle, win); 174 | } 175 | 176 | void hime_im_client_set_window(HIME_client_handle *handle, Window win) { 177 | HimeHelper::Resolve(); 178 | HimeHelper::hime_im_client_set_window(handle, win); 179 | } 180 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/hime/init.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Desktop App Toolkit, 3 | a set of libraries for developing nice desktop applications. 4 | 5 | For license and copyright information please follow this link: 6 | https://github.com/desktop-app/legal/blob/master/LEGAL 7 | */ 8 | #include 9 | 10 | Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) 11 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/kimageformats/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qt_static_plugins_kimageformats STATIC) 8 | add_library(desktop-app::external_qt_static_plugins_kimageformats ALIAS external_qt_static_plugins_kimageformats) 9 | init_target(external_qt_static_plugins_kimageformats "(external)") 10 | 11 | set(kimageformats_loc ${third_party_loc}/kimageformats) 12 | set(kimageformats_src ${kimageformats_loc}/src/imageformats) 13 | 14 | set_target_properties(external_qt_static_plugins_kimageformats PROPERTIES AUTOMOC ON) 15 | 16 | nice_target_sources(external_qt_static_plugins_kimageformats ${kimageformats_src} 17 | PRIVATE 18 | avif.cpp 19 | heif.cpp 20 | jxl.cpp 21 | qoi.cpp 22 | scanlineconverter.cpp 23 | ) 24 | 25 | target_compile_definitions(external_qt_static_plugins_kimageformats 26 | PRIVATE 27 | QT_STATICPLUGIN 28 | ) 29 | 30 | target_link_libraries(external_qt_static_plugins_kimageformats 31 | PRIVATE 32 | desktop-app::external_qt 33 | ) 34 | 35 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 36 | find_package(libavif QUIET) 37 | find_package(libheif QUIET) 38 | find_package(PkgConfig) 39 | if (PkgConfig_FOUND) 40 | if (NOT libavif_FOUND) 41 | pkg_check_modules(DESKTOP_APP_AVIF IMPORTED_TARGET libavif) 42 | endif() 43 | pkg_check_modules(DESKTOP_APP_JXL IMPORTED_TARGET libjxl libjxl_threads) 44 | endif() 45 | 46 | if (NOT libavif_FOUND AND NOT DESKTOP_APP_AVIF_FOUND) 47 | remove_target_sources(external_qt_static_plugins_kimageformats ${kimageformats_src} avif.cpp) 48 | endif() 49 | 50 | if (NOT libheif_FOUND) 51 | remove_target_sources(external_qt_static_plugins_kimageformats ${kimageformats_src} heif.cpp) 52 | endif() 53 | 54 | if (NOT DESKTOP_APP_JXL_FOUND) 55 | remove_target_sources(external_qt_static_plugins_kimageformats ${kimageformats_src} jxl.cpp) 56 | endif() 57 | 58 | target_link_libraries(external_qt_static_plugins_kimageformats 59 | PRIVATE 60 | $ 61 | $ 62 | $ 63 | $ 64 | ) 65 | elseif (WIN32) 66 | target_compile_definitions(external_qt_static_plugins_kimageformats 67 | PRIVATE 68 | JXL_STATIC_DEFINE 69 | JXL_THREADS_STATIC_DEFINE 70 | JXL_CMS_STATIC_DEFINE 71 | LIBHEIF_STATIC_BUILD 72 | ) 73 | 74 | target_include_directories(external_qt_static_plugins_kimageformats SYSTEM 75 | PRIVATE 76 | ${libs_loc}/local/include 77 | ) 78 | 79 | target_link_libraries(external_qt_static_plugins_kimageformats 80 | PRIVATE 81 | ${libs_loc}/libavif/$,Debug,Release>/avif.lib 82 | ${libs_loc}/libheif/libheif/$,Debug,Release>/heif.lib 83 | ${libs_loc}/libde265/libde265/$,Debug,Release>/libde265.lib 84 | ${libs_loc}/dav1d/builddir-$,debug,release>/src/libdav1d.a 85 | ${libs_loc}/libjxl/lib/$,Debug,Release>/jxl.lib 86 | ${libs_loc}/libjxl/lib/$,Debug,Release>/jxl_cms.lib 87 | ${libs_loc}/libjxl/lib/$,Debug,Release>/jxl_threads.lib 88 | ${libs_loc}/libjxl/third_party/highway/$,Debug,Release>/hwy.lib 89 | ${libs_loc}/libjxl/third_party/brotli/$,Debug,Release>/brotlidec.lib 90 | ${libs_loc}/libjxl/third_party/brotli/$,Debug,Release>/brotlienc.lib 91 | ${libs_loc}/libjxl/third_party/brotli/$,Debug,Release>/brotlicommon.lib 92 | ) 93 | elseif (APPLE) 94 | target_compile_definitions(external_qt_static_plugins_kimageformats 95 | PRIVATE 96 | JXL_STATIC_DEFINE 97 | JXL_THREADS_STATIC_DEFINE 98 | JXL_CMS_STATIC_DEFINE 99 | LIBHEIF_STATIC_BUILD 100 | ) 101 | 102 | target_include_directories(external_qt_static_plugins_kimageformats SYSTEM 103 | PRIVATE 104 | ${libs_loc}/local/include 105 | ) 106 | target_link_libraries(external_qt_static_plugins_kimageformats 107 | PRIVATE 108 | ${libs_loc}/local/lib/libavif.a 109 | ${libs_loc}/local/lib/libheif.a 110 | ${libs_loc}/local/lib/libde265.a 111 | ${libs_loc}/local/lib/libdav1d.a 112 | ${libs_loc}/local/lib/libjxl.a 113 | ${libs_loc}/local/lib/libjxl_cms.a 114 | ${libs_loc}/local/lib/libjxl_threads.a 115 | ${libs_loc}/local/lib/libhwy.a 116 | ${libs_loc}/local/lib/libbrotlidec.a 117 | ${libs_loc}/local/lib/libbrotlienc.a 118 | ${libs_loc}/local/lib/libbrotlicommon.a 119 | ${libs_loc}/local/lib/liblcms2.a 120 | ) 121 | endif() 122 | 123 | add_library(external_qt_static_plugins_kimageformats_init OBJECT) 124 | add_library(desktop-app::external_qt_static_plugins_kimageformats_init ALIAS external_qt_static_plugins_kimageformats_init) 125 | init_target(external_qt_static_plugins_kimageformats_init "(external)") 126 | 127 | nice_target_sources(external_qt_static_plugins_kimageformats_init ${CMAKE_CURRENT_SOURCE_DIR} 128 | PRIVATE 129 | init.cpp 130 | ) 131 | 132 | target_link_libraries(external_qt_static_plugins_kimageformats_init 133 | PRIVATE 134 | desktop-app::external_qt 135 | ) 136 | 137 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 138 | if (NOT libavif_FOUND AND NOT DESKTOP_APP_AVIF_FOUND) 139 | target_compile_definitions(external_qt_static_plugins_kimageformats_init PRIVATE QT_STATIC_PLUGINS_DISABLE_AVIF) 140 | endif() 141 | 142 | if (NOT libheif_FOUND) 143 | target_compile_definitions(external_qt_static_plugins_kimageformats_init PRIVATE QT_STATIC_PLUGINS_DISABLE_HEIF) 144 | endif() 145 | 146 | if (NOT DESKTOP_APP_JXL_FOUND) 147 | target_compile_definitions(external_qt_static_plugins_kimageformats_init PRIVATE QT_STATIC_PLUGINS_DISABLE_JXL) 148 | endif() 149 | endif() 150 | 151 | target_link_libraries(external_qt_static_plugins_kimageformats 152 | INTERFACE 153 | external_qt_static_plugins_kimageformats_init 154 | $ 155 | ) 156 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/kimageformats/init.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Desktop App Toolkit, 3 | a set of libraries for developing nice desktop applications. 4 | 5 | For license and copyright information please follow this link: 6 | https://github.com/desktop-app/legal/blob/master/LEGAL 7 | */ 8 | #include 9 | 10 | #ifndef QT_STATIC_PLUGINS_DISABLE_AVIF 11 | Q_IMPORT_PLUGIN(QAVIFPlugin) 12 | #endif // !QT_STATIC_PLUGINS_DISABLE_AVIF 13 | #ifndef QT_STATIC_PLUGINS_DISABLE_HEIF 14 | Q_IMPORT_PLUGIN(HEIFPlugin) 15 | #endif // !QT_STATIC_PLUGINS_DISABLE_HEIF 16 | #ifndef QT_STATIC_PLUGINS_DISABLE_JXL 17 | Q_IMPORT_PLUGIN(QJpegXLPlugin) 18 | #endif // !QT_STATIC_PLUGINS_DISABLE_JXL 19 | Q_IMPORT_PLUGIN(QOIPlugin) 20 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/nimf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_qt_static_plugins_nimf STATIC) 8 | add_library(desktop-app::external_qt_static_plugins_nimf ALIAS external_qt_static_plugins_nimf) 9 | init_target(external_qt_static_plugins_nimf "(external)") 10 | 11 | set(nimf_loc ${third_party_loc}/nimf) 12 | set(libnimf_src ${nimf_loc}/libnimf) 13 | set(nimf_qt5_src ${nimf_loc}/modules/clients/qt5) 14 | 15 | set_target_properties(external_qt_static_plugins_nimf PROPERTIES AUTOMOC ON) 16 | 17 | nice_target_sources(external_qt_static_plugins_nimf ${nimf_qt5_src} 18 | PRIVATE 19 | im-nimf-qt5.cpp 20 | ) 21 | 22 | find_package(PkgConfig REQUIRED) 23 | pkg_check_modules(DESKTOP_APP_GIO REQUIRED gio-2.0) 24 | 25 | target_include_directories(external_qt_static_plugins_nimf 26 | PRIVATE 27 | ${nimf_qt5_src} 28 | ${libnimf_src} 29 | ${DESKTOP_APP_GIO_INCLUDE_DIRS} 30 | ) 31 | 32 | target_compile_definitions(external_qt_static_plugins_nimf 33 | PRIVATE 34 | QT_STATICPLUGIN 35 | QT_NO_KEYWORDS 36 | G_LOG_DOMAIN="nimf" 37 | NIMF_COMPILATION 38 | USE_DLFCN 39 | ) 40 | 41 | target_link_libraries(external_qt_static_plugins_nimf 42 | PRIVATE 43 | desktop-app::external_qt 44 | ) 45 | 46 | add_library(external_qt_static_plugins_nimf_init OBJECT) 47 | add_library(desktop-app::external_qt_static_plugins_nimf_init ALIAS external_qt_static_plugins_nimf_init) 48 | init_target(external_qt_static_plugins_nimf_init "(external)") 49 | 50 | nice_target_sources(external_qt_static_plugins_nimf_init ${CMAKE_CURRENT_SOURCE_DIR} 51 | PRIVATE 52 | init.cpp 53 | ) 54 | 55 | target_link_libraries(external_qt_static_plugins_nimf_init 56 | PRIVATE 57 | desktop-app::external_qt 58 | ) 59 | 60 | target_link_libraries(external_qt_static_plugins_nimf 61 | INTERFACE 62 | external_qt_static_plugins_nimf_init 63 | $ 64 | ) 65 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/nimf/init.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Desktop App Toolkit, 3 | a set of libraries for developing nice desktop applications. 4 | 5 | For license and copyright information please follow this link: 6 | https://github.com/desktop-app/legal/blob/master/LEGAL 7 | */ 8 | #include 9 | 10 | Q_IMPORT_PLUGIN(NimfInputContextPlugin) 11 | -------------------------------------------------------------------------------- /external/qt/qt_static_plugins/qt_static_plugins.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Desktop App Toolkit, 3 | a set of libraries for developing nice desktop applications. 4 | 5 | For license and copyright information please follow this link: 6 | https://github.com/desktop-app/legal/blob/master/LEGAL 7 | */ 8 | #include 9 | 10 | #if !defined QT_STATIC_PLUGINS_USE_PACKAGED && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined Q_OS_WIN 11 | Q_IMPORT_PLUGIN(QGenericEnginePlugin) 12 | Q_IMPORT_PLUGIN(QWebpPlugin) 13 | Q_IMPORT_PLUGIN(QJpegPlugin) 14 | Q_IMPORT_PLUGIN(QGifPlugin) 15 | Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) 16 | #endif // !QT_STATIC_PLUGINS_USE_PACKAGED && Qt < 6.0.0 && Q_OS_WIN 17 | -------------------------------------------------------------------------------- /external/ranges/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_ranges INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_ranges ALIAS external_ranges) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(range-v3 QUIET) 12 | if (range-v3_FOUND) 13 | target_link_libraries(external_ranges INTERFACE range-v3::range-v3) 14 | return() 15 | endif() 16 | endif() 17 | 18 | target_include_directories(external_ranges SYSTEM 19 | INTERFACE 20 | ${third_party_loc}/range-v3/include 21 | ) -------------------------------------------------------------------------------- /external/rlottie/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_rlottie INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_rlottie ALIAS external_rlottie) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED_RLOTTIE) 11 | find_package(rlottie QUIET) 12 | if (rlottie_FOUND) 13 | target_link_libraries(external_rlottie INTERFACE rlottie::rlottie) 14 | return() 15 | endif() 16 | 17 | find_package(PkgConfig REQUIRED) 18 | pkg_check_modules(DESKTOP_APP_RLOTTIE REQUIRED IMPORTED_TARGET rlottie) 19 | target_link_libraries(external_rlottie INTERFACE PkgConfig::DESKTOP_APP_RLOTTIE) 20 | return() 21 | endif() 22 | 23 | add_library(external_rlottie_bundled STATIC) 24 | init_target(external_rlottie_bundled "(external)") 25 | 26 | get_filename_component(src_loc . REALPATH) 27 | set(rlottie_loc ${third_party_loc}/rlottie) 28 | 29 | target_sources(external_rlottie_bundled PRIVATE ${src_loc}/config/config.h) 30 | nice_target_sources(external_rlottie_bundled ${rlottie_loc} 31 | PRIVATE 32 | inc/rlottie.h 33 | inc/rlottie_capi.h 34 | inc/rlottiecommon.h 35 | 36 | src/lottie/lottieanimation.cpp 37 | src/lottie/lottieitem.cpp 38 | src/lottie/lottieitem.h 39 | src/lottie/lottiekeypath.cpp 40 | src/lottie/lottiekeypath.h 41 | src/lottie/lottieloader.cpp 42 | src/lottie/lottieloader.h 43 | src/lottie/lottiemodel.cpp 44 | src/lottie/lottiemodel.h 45 | src/lottie/lottieparser.cpp 46 | src/lottie/lottieparser.h 47 | src/lottie/lottieproxymodel.cpp 48 | src/lottie/lottieproxymodel.h 49 | 50 | src/vector/freetype/v_ft_math.cpp 51 | src/vector/freetype/v_ft_math.h 52 | src/vector/freetype/v_ft_raster.cpp 53 | src/vector/freetype/v_ft_raster.h 54 | src/vector/freetype/v_ft_stroker.cpp 55 | src/vector/freetype/v_ft_stroker.h 56 | src/vector/freetype/v_ft_types.h 57 | 58 | # src/vector/pixman/pixman-arm-neon-asm.h 59 | # src/vector/pixman/pixman-arm-neon-asm.S 60 | src/vector/pixman/vregion.cpp 61 | src/vector/pixman/vregion.h 62 | 63 | src/vector/vbezier.cpp 64 | src/vector/vbezier.h 65 | src/vector/vbitmap.cpp 66 | src/vector/vbitmap.h 67 | src/vector/vbrush.cpp 68 | src/vector/vbrush.h 69 | src/vector/vcompositionfunctions.cpp 70 | src/vector/vcowptr.h 71 | src/vector/vdasher.cpp 72 | src/vector/vdasher.h 73 | src/vector/vdebug.cpp 74 | src/vector/vdebug.h 75 | src/vector/vdrawable.cpp 76 | src/vector/vdrawable.h 77 | src/vector/vdrawhelper.cpp 78 | src/vector/vdrawhelper.h 79 | src/vector/vdrawhelper_neon.cpp 80 | src/vector/vdrawhelper_sse2.cpp 81 | src/vector/velapsedtimer.cpp 82 | src/vector/velapsedtimer.h 83 | src/vector/vglobal.h 84 | src/vector/vimageloader.cpp 85 | src/vector/vimageloader.h 86 | src/vector/vinterpolator.cpp 87 | src/vector/vinterpolator.h 88 | src/vector/vline.h 89 | src/vector/vmatrix.cpp 90 | src/vector/vmatrix.h 91 | src/vector/vpainter.cpp 92 | src/vector/vpainter.h 93 | src/vector/vpath.cpp 94 | src/vector/vpath.h 95 | src/vector/vpathmesure.cpp 96 | src/vector/vpathmesure.h 97 | src/vector/vpoint.h 98 | src/vector/vraster.cpp 99 | src/vector/vraster.h 100 | src/vector/vrect.cpp 101 | src/vector/vrect.h 102 | src/vector/vrle.cpp 103 | src/vector/vrle.h 104 | src/vector/vstackallocator.h 105 | src/vector/vtaskqueue.h 106 | ) 107 | 108 | target_compile_definitions(external_rlottie_bundled 109 | PUBLIC 110 | LOT_BUILD 111 | PRIVATE 112 | _USE_MATH_DEFINES 113 | "RAPIDJSON_ASSERT=(void)" 114 | LOTTIE_DISABLE_ARM_NEON 115 | ) 116 | 117 | target_include_directories(external_rlottie_bundled 118 | PUBLIC 119 | ${rlottie_loc}/inc 120 | PRIVATE 121 | ${src_loc}/config 122 | ${rlottie_loc}/src/lottie 123 | ${rlottie_loc}/src/vector 124 | ${rlottie_loc}/src/vector/pixman 125 | ${rlottie_loc}/src/vector/freetype 126 | ) 127 | 128 | if (MSVC) 129 | target_compile_options(external_rlottie_bundled 130 | PRIVATE 131 | /wd4251 # needs to have dll-interface to be used by clients of class 132 | /wd5054 # operator 'operator-name': deprecated between enumerations of different types 133 | ) 134 | endif() 135 | 136 | target_link_libraries(external_rlottie 137 | INTERFACE 138 | external_rlottie_bundled 139 | ) 140 | -------------------------------------------------------------------------------- /external/rlottie/config/config.h: -------------------------------------------------------------------------------- 1 | // This file is part of Desktop App Toolkit, 2 | // a set of libraries for developing nice desktop applications. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/desktop-app/legal/blob/master/LEGAL 6 | // 7 | #ifndef CONFIG_H 8 | #define CONFIG_H 9 | 10 | // enable threading 11 | #define LOTTIE_THREAD_SUPPORT 12 | 13 | //enable logging 14 | //#define LOTTIE_LOGGING_SUPPORT 15 | 16 | //enable module building of image loader 17 | //#define LOTTIE_IMAGE_MODULE_SUPPORT 18 | 19 | //enable lottie model caching 20 | //#define LOTTIE_CACHE_SUPPORT 21 | 22 | // disable image loader 23 | #define LOTTIE_IMAGE_MODULE_DISABLED 24 | 25 | #endif // CONFIG_H 26 | -------------------------------------------------------------------------------- /external/rnnoise/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (DESKTOP_APP_USE_PACKAGED) 8 | add_library(external_rnnoise INTERFACE IMPORTED GLOBAL) 9 | add_library(desktop-app::external_rnnoise ALIAS external_rnnoise) 10 | 11 | find_package(PkgConfig REQUIRED) 12 | pkg_check_modules(DESKTOP_APP_RNNOISE REQUIRED IMPORTED_TARGET rnnoise) 13 | 14 | target_link_libraries(external_rnnoise INTERFACE PkgConfig::DESKTOP_APP_RNNOISE) 15 | return() 16 | endif() 17 | 18 | add_library(external_rnnoise STATIC IMPORTED GLOBAL) 19 | add_library(desktop-app::external_rnnoise ALIAS external_rnnoise) 20 | 21 | set(rnnoise_lib_loc ${libs_loc}/rnnoise/out) 22 | if (WIN32) 23 | target_include_directories(external_rnnoise SYSTEM 24 | INTERFACE 25 | ${libs_loc}/rnnoise/include 26 | ) 27 | set_target_properties(external_rnnoise PROPERTIES 28 | IMPORTED_LOCATION "${rnnoise_lib_loc}/Release/rnnoise.lib" 29 | IMPORTED_LOCATION_DEBUG "${rnnoise_lib_loc}/Debug/rnnoise.lib" 30 | ) 31 | elseif (APPLE) 32 | target_include_directories(external_rnnoise SYSTEM 33 | INTERFACE 34 | ${libs_loc}/rnnoise/include 35 | ) 36 | set_target_properties(external_rnnoise PROPERTIES 37 | IMPORTED_LOCATION "${rnnoise_lib_loc}/Release/librnnoise.a" 38 | IMPORTED_LOCATION_DEBUG "${rnnoise_lib_loc}/Debug/librnnoise.a" 39 | ) 40 | else() 41 | find_library(DESKTOP_APP_RNNOISE_LIBRARIES librnnoise.a REQUIRED) 42 | set_target_properties(external_rnnoise PROPERTIES 43 | IMPORTED_LOCATION "${DESKTOP_APP_RNNOISE_LIBRARIES}" 44 | ) 45 | endif() 46 | -------------------------------------------------------------------------------- /external/tde2e/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_tde2e INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_tde2e ALIAS external_tde2e) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 11 | find_package(tde2e REQUIRED) 12 | target_link_libraries(external_tde2e INTERFACE tde2e::tde2e) 13 | return() 14 | endif() 15 | 16 | set(tde2e_loc ${libs_loc}/tde2e) 17 | set(tde2e_build_loc ${tde2e_loc}/out/$,Debug,Release>) 18 | if (WIN32) 19 | set(tde2e_lib_prefix $,Debug,Release>/) 20 | set(tde2e_lib_suffix .lib) 21 | else() 22 | set(tde2e_lib_prefix lib) 23 | set(tde2e_lib_suffix .a) 24 | endif() 25 | 26 | target_include_directories(external_tde2e 27 | INTERFACE 28 | ${tde2e_loc}/tde2e 29 | ) 30 | 31 | set(tde2e_libs 32 | tde2e/${tde2e_lib_prefix}tde2e 33 | tdutils/${tde2e_lib_prefix}tdutils 34 | ) 35 | foreach (lib ${tde2e_libs}) 36 | list(APPEND tde2e_libs_list "${tde2e_build_loc}/${lib}${tde2e_lib_suffix}") 37 | endforeach() 38 | 39 | target_link_libraries(external_tde2e 40 | INTERFACE 41 | ${tde2e_libs_list} 42 | ) 43 | 44 | if (WIN32) 45 | target_link_libraries(external_tde2e 46 | INTERFACE 47 | Psapi 48 | Normaliz 49 | ) 50 | endif() 51 | -------------------------------------------------------------------------------- /external/ton/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_ton INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_ton ALIAS external_ton) 9 | 10 | set(ton_loc ${libs_loc}/ton) 11 | set(ton_build_loc ${ton_loc}/build$<$:-debug>) 12 | if (WIN32) 13 | set(ton_lib_prefix $/) 14 | set(ton_lib_suffix .lib) 15 | else() 16 | set(ton_lib_prefix lib) 17 | set(ton_lib_suffix .a) 18 | endif() 19 | 20 | target_include_directories(external_ton SYSTEM 21 | INTERFACE 22 | ${ton_loc} 23 | ${ton_loc}/crypto 24 | ${ton_loc}/tdactor 25 | ${ton_loc}/tdutils 26 | ${ton_loc}/tonlib 27 | ${ton_loc}/tl 28 | ${ton_loc}/tl/generate 29 | ${ton_build_loc}/tdutils 30 | ) 31 | 32 | set(ton_libs 33 | tonlib/${ton_lib_prefix}tonlib 34 | tl/${ton_lib_prefix}tl_tonlib_api 35 | crypto/${ton_lib_prefix}smc-envelope 36 | lite-client/${ton_lib_prefix}lite-client-common 37 | crypto/${ton_lib_prefix}ton_block 38 | adnl/${ton_lib_prefix}adnllite 39 | tl-utils/${ton_lib_prefix}tl-lite-utils 40 | keys/${ton_lib_prefix}keys 41 | tl-utils/${ton_lib_prefix}tl-utils 42 | tl/${ton_lib_prefix}tl_api 43 | tl/${ton_lib_prefix}tl_lite_api 44 | tdnet/${ton_lib_prefix}tdnet 45 | tdactor/${ton_lib_prefix}tdactor 46 | crypto/${ton_lib_prefix}ton_crypto 47 | tdutils/${ton_lib_prefix}tdutils 48 | third-party/crc32c/${ton_lib_prefix}crc32c 49 | ) 50 | foreach (lib ${ton_libs}) 51 | list(APPEND ton_libs_list "${ton_build_loc}/${lib}${ton_lib_suffix}") 52 | endforeach() 53 | 54 | target_link_libraries(external_ton 55 | INTERFACE 56 | ${ton_libs_list} 57 | ) 58 | 59 | if (WIN32) 60 | target_link_libraries(external_ton 61 | INTERFACE 62 | Psapi 63 | Normaliz 64 | ) 65 | endif() 66 | -------------------------------------------------------------------------------- /external/variant/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_variant INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_variant ALIAS external_variant) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_path(DESKTOP_APP_VARIANT_INCLUDE_DIRS mapbox/variant.hpp) 12 | if (DESKTOP_APP_VARIANT_INCLUDE_DIRS) 13 | target_include_directories(external_variant SYSTEM 14 | INTERFACE 15 | ${DESKTOP_APP_VARIANT_INCLUDE_DIRS} 16 | ) 17 | return() 18 | endif() 19 | endif() 20 | 21 | target_include_directories(external_variant SYSTEM 22 | INTERFACE 23 | ${third_party_loc}/variant/include 24 | ) 25 | -------------------------------------------------------------------------------- /external/vpx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (DESKTOP_APP_USE_PACKAGED) 8 | add_library(external_vpx INTERFACE IMPORTED GLOBAL) 9 | add_library(desktop-app::external_vpx ALIAS external_vpx) 10 | 11 | find_package(PkgConfig) 12 | if (PkgConfig_FOUND) 13 | pkg_check_modules(DESKTOP_APP_VPX IMPORTED_TARGET vpx>=1.10.0) 14 | endif() 15 | 16 | target_link_libraries(external_vpx INTERFACE PkgConfig::DESKTOP_APP_VPX) 17 | return() 18 | endif() 19 | 20 | add_library(external_vpx STATIC IMPORTED GLOBAL) 21 | add_library(desktop-app::external_vpx ALIAS external_vpx) 22 | 23 | if (WIN32) 24 | target_include_directories(external_vpx SYSTEM 25 | INTERFACE 26 | ${libs_loc}/local/include 27 | ) 28 | if (build_winarm) 29 | set(libvpx_release_folder ARM64) 30 | elseif (build_win64) 31 | set(libvpx_release_folder x64) 32 | else() 33 | set(libvpx_release_folder Win32) 34 | endif() 35 | set(vpx_lib_loc ${libs_loc}/local/lib/${libvpx_release_folder}) 36 | set_target_properties(external_vpx PROPERTIES 37 | IMPORTED_LOCATION "${vpx_lib_loc}/vpxmt.lib" 38 | IMPORTED_LOCATION_DEBUG "${vpx_lib_loc}/vpxmt.lib" 39 | ) 40 | elseif (APPLE) 41 | target_include_directories(external_vpx SYSTEM 42 | INTERFACE 43 | ${libs_loc}/local/include 44 | ) 45 | set_target_properties(external_vpx PROPERTIES 46 | IMPORTED_LOCATION ${libs_loc}/local/lib/libvpx.a 47 | ) 48 | else() 49 | find_library(DESKTOP_APP_VPX_LIBRARIES libvpx.a REQUIRED) 50 | set_target_properties(external_vpx PROPERTIES 51 | IMPORTED_LOCATION "${DESKTOP_APP_VPX_LIBRARIES}" 52 | ) 53 | endif() 54 | -------------------------------------------------------------------------------- /external/webrtc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_webrtc INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_webrtc ALIAS external_webrtc) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED OR LINUX) 11 | find_package(tg_owt REQUIRED) 12 | target_link_libraries(external_webrtc INTERFACE tg_owt::tg_owt) 13 | return() 14 | endif() 15 | 16 | set(webrtc_loc ${libs_loc}/tg_owt/src) 17 | set(webrtc_build_loc ${libs_loc}/tg_owt/out/$,Debug,Release>) 18 | 19 | target_compile_definitions(external_webrtc 20 | INTERFACE 21 | WEBRTC_ENABLE_PROTOBUF=0 22 | WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE 23 | RTC_ENABLE_H265 24 | RTC_ENABLE_VP9 25 | HAVE_SCTP 26 | WEBRTC_USE_H264 27 | WEBRTC_USE_BUILTIN_ISAC_FLOAT 28 | WEBRTC_LIBRARY_IMPL 29 | WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1 30 | WEBRTC_HAVE_DCSCTP 31 | WEBRTC_HAVE_SCTP 32 | ABSL_ALLOCATOR_NOTHROW=1 33 | ) 34 | 35 | if (WIN32) 36 | set(webrtc_lib_prefix "") 37 | set(webrtc_lib_suffix .lib) 38 | 39 | target_compile_definitions(external_webrtc 40 | INTERFACE 41 | WEBRTC_WIN 42 | RTC_ENABLE_WIN_WGC 43 | ) 44 | else() 45 | set(webrtc_lib_prefix lib) 46 | set(webrtc_lib_suffix .a) 47 | 48 | if (APPLE) 49 | target_compile_definitions(external_webrtc 50 | INTERFACE 51 | WEBRTC_MAC 52 | ) 53 | endif() 54 | 55 | target_compile_definitions(external_webrtc 56 | INTERFACE 57 | WEBRTC_POSIX 58 | ) 59 | endif() 60 | 61 | target_include_directories(external_webrtc SYSTEM 62 | INTERFACE 63 | ${webrtc_loc} 64 | ${webrtc_loc}/third_party/abseil-cpp 65 | ${webrtc_loc}/third_party/libyuv/include 66 | ) 67 | 68 | set(webrtc_libs 69 | ${webrtc_lib_prefix}tg_owt 70 | ) 71 | if (APPLE) 72 | target_include_directories(external_webrtc SYSTEM 73 | INTERFACE 74 | ${webrtc_loc}/sdk/objc 75 | ${webrtc_loc}/sdk/objc/base 76 | ${webrtc_loc}/sdk/objc/components/video_codec 77 | ) 78 | endif() 79 | foreach (lib ${webrtc_libs}) 80 | list(APPEND webrtc_libs_list "${webrtc_build_loc}/${lib}${webrtc_lib_suffix}") 81 | endforeach() 82 | 83 | target_link_libraries(external_webrtc 84 | INTERFACE 85 | ${webrtc_libs_list} 86 | $ 87 | $ 88 | $ 89 | $ 90 | $ 91 | $ 92 | $ 93 | $ 94 | $ 95 | ) 96 | 97 | if (WIN32) 98 | target_link_libraries(external_webrtc 99 | INTERFACE 100 | Secur32.lib # Required for rtc_base/http_common.cc 101 | ) 102 | elseif (APPLE) 103 | target_link_libraries(external_webrtc 104 | INTERFACE 105 | -ObjC 106 | ) 107 | endif() 108 | -------------------------------------------------------------------------------- /external/xcb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_xcb INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_xcb ALIAS external_xcb) 9 | 10 | add_subdirectory(xcb_keysyms) 11 | add_subdirectory(xcb_record) 12 | add_subdirectory(xcb_screensaver) 13 | 14 | find_package(PkgConfig REQUIRED) 15 | pkg_check_modules(DESKTOP_APP_XCB REQUIRED IMPORTED_TARGET xcb) 16 | target_link_libraries(external_xcb INTERFACE PkgConfig::DESKTOP_APP_XCB) 17 | -------------------------------------------------------------------------------- /external/xcb/xcb_keysyms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_xcb_keysyms INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_xcb_keysyms ALIAS external_xcb_keysyms) 9 | 10 | find_package(PkgConfig REQUIRED) 11 | pkg_check_modules(DESKTOP_APP_XCB_KEYSYMS REQUIRED IMPORTED_TARGET xcb-keysyms) 12 | target_link_libraries(external_xcb_keysyms INTERFACE PkgConfig::DESKTOP_APP_XCB_KEYSYMS) 13 | -------------------------------------------------------------------------------- /external/xcb/xcb_record/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_xcb_record INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_xcb_record ALIAS external_xcb_record) 9 | 10 | find_package(PkgConfig REQUIRED) 11 | pkg_check_modules(DESKTOP_APP_XCB_RECORD REQUIRED IMPORTED_TARGET xcb-record) 12 | target_link_libraries(external_xcb_record INTERFACE PkgConfig::DESKTOP_APP_XCB_RECORD) 13 | -------------------------------------------------------------------------------- /external/xcb/xcb_screensaver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_xcb_screensaver INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_xcb_screensaver ALIAS external_xcb_screensaver) 9 | 10 | find_package(PkgConfig REQUIRED) 11 | pkg_check_modules(DESKTOP_APP_XCB_SCREENSAVER REQUIRED IMPORTED_TARGET xcb-screensaver) 12 | target_link_libraries(external_xcb_screensaver INTERFACE PkgConfig::DESKTOP_APP_XCB_SCREENSAVER) 13 | -------------------------------------------------------------------------------- /external/xxhash/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(external_xxhash INTERFACE IMPORTED GLOBAL) 8 | add_library(desktop-app::external_xxhash ALIAS external_xxhash) 9 | 10 | if (DESKTOP_APP_USE_PACKAGED) 11 | find_package(xxHash QUIET) 12 | if (xxHash_FOUND) 13 | target_link_libraries(external_xxhash INTERFACE xxHash::xxhash) 14 | return() 15 | endif() 16 | 17 | find_package(PkgConfig) 18 | if (PkgConfig_FOUND) 19 | pkg_check_modules(DESKTOP_APP_XXHASH IMPORTED_TARGET libxxhash) 20 | endif() 21 | 22 | if (DESKTOP_APP_XXHASH_FOUND) 23 | target_link_libraries(external_xxhash INTERFACE PkgConfig::DESKTOP_APP_XXHASH) 24 | return() 25 | endif() 26 | endif() 27 | 28 | target_include_directories(external_xxhash SYSTEM 29 | INTERFACE 30 | ${third_party_loc}/xxHash 31 | ) 32 | 33 | target_compile_definitions(external_xxhash 34 | INTERFACE 35 | XXH_INLINE_ALL 36 | ) 37 | -------------------------------------------------------------------------------- /external/zlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (DESKTOP_APP_USE_PACKAGED) 8 | add_library(external_zlib INTERFACE IMPORTED GLOBAL) 9 | add_library(desktop-app::external_zlib ALIAS external_zlib) 10 | 11 | find_package(ZLIB REQUIRED) 12 | target_link_libraries(external_zlib INTERFACE ZLIB::ZLIB) 13 | return() 14 | endif() 15 | 16 | add_library(external_zlib STATIC IMPORTED GLOBAL) 17 | add_library(desktop-app::external_zlib ALIAS external_zlib) 18 | 19 | if (WIN32) 20 | set(zlib_lib_loc ${libs_loc}/zlib) 21 | target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI) 22 | target_include_directories(external_zlib SYSTEM INTERFACE ${zlib_lib_loc}) 23 | set_target_properties(external_zlib PROPERTIES 24 | IMPORTED_LOCATION "${zlib_lib_loc}/Release/zlibstatic.lib" 25 | IMPORTED_LOCATION_DEBUG "${zlib_lib_loc}/Debug/zlibstaticd.lib" 26 | ) 27 | elseif (APPLE) 28 | set_target_properties(external_zlib PROPERTIES 29 | IMPORTED_LOCATION ${libs_loc}/local/lib/libz.a 30 | ) 31 | else() 32 | find_library(DESKTOP_APP_ZLIB_LIBRARIES libz.a REQUIRED) 33 | set_target_properties(external_zlib PROPERTIES 34 | IMPORTED_LOCATION "${DESKTOP_APP_ZLIB_LIBRARIES}" 35 | ) 36 | endif() 37 | -------------------------------------------------------------------------------- /generate_target.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(generate_target parent_name postfix generated_timestamp generated_files gen_dst) 8 | add_custom_target(${parent_name}_${postfix} DEPENDS ${generated_timestamp}) 9 | init_target_folder(${parent_name}_${postfix} "(gen)") 10 | add_dependencies(${parent_name} ${parent_name}_${postfix}) 11 | get_target_property(parent_type ${parent_name} TYPE) 12 | if (${parent_type} STREQUAL "INTERFACE_LIBRARY") 13 | target_include_directories(${parent_name} SYSTEM INTERFACE ${gen_dst}) 14 | else() 15 | target_include_directories(${parent_name} SYSTEM PUBLIC ${gen_dst}) 16 | target_sources(${parent_name} PRIVATE ${generated_files}) 17 | endif() 18 | source_group("(gen)" FILES ${generated_files}) 19 | endfunction() 20 | -------------------------------------------------------------------------------- /init_target.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | set(MAXIMUM_CXX_STANDARD cxx_std_20) 8 | 9 | function(init_target_folder target_name folder_name) 10 | if (NOT "${folder_name}" STREQUAL "") 11 | set_target_properties(${target_name} PROPERTIES FOLDER ${folder_name}) 12 | endif() 13 | endfunction() 14 | 15 | function(init_target target_name) # init_target(my_target [cxx_std_..] folder_name) 16 | set(standard ${MAXIMUM_CXX_STANDARD}) 17 | foreach (entry ${ARGN}) 18 | if (${entry} STREQUAL cxx_std_14 OR ${entry} STREQUAL cxx_std_11 OR ${entry} STREQUAL cxx_std_17) 19 | set(standard ${entry}) 20 | else() 21 | init_target_folder(${target_name} ${entry}) 22 | endif() 23 | endforeach() 24 | target_compile_features(${target_name} PRIVATE ${standard}) 25 | target_link_libraries(${target_name} PRIVATE desktop-app::common_options) 26 | set_target_properties(${target_name} PROPERTIES 27 | XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES 28 | ) 29 | if (DESKTOP_APP_USE_PACKAGED) 30 | get_target_property(target_type ${target_name} TYPE) 31 | if (QT_FOUND AND target_type STREQUAL "EXECUTABLE") 32 | cmake_language(EVAL CODE "cmake_language(DEFER CALL qt_finalize_target ${target_name})") 33 | if (LINUX) 34 | qt_import_plugins(${target_name} 35 | INCLUDE 36 | Qt::QGtk3ThemePlugin 37 | Qt::QComposePlatformInputContextPlugin 38 | Qt::QIbusPlatformInputContextPlugin 39 | Qt::QXdgDesktopPortalThemePlugin 40 | ) 41 | endif() 42 | endif() 43 | else() 44 | set_target_properties(${target_name} PROPERTIES 45 | MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug> 46 | ) 47 | endif() 48 | if (DESKTOP_APP_SPECIAL_TARGET) 49 | if (MSVC) 50 | set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$<$>:/LTCG>") 51 | elseif (APPLE) 52 | set_target_properties(${target_name} PROPERTIES 53 | XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL $,0,fast> 54 | XCODE_ATTRIBUTE_LLVM_LTO $,NO,YES> 55 | ) 56 | else() 57 | set_target_properties(${target_name} PROPERTIES 58 | INTERPROCEDURAL_OPTIMIZATION_RELEASE True 59 | INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True 60 | INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True 61 | ) 62 | endif() 63 | endif() 64 | endfunction() 65 | 66 | # This code is not supposed to run on build machine, only on target machine. 67 | function(init_non_host_target target_name) 68 | init_target(${ARGV}) 69 | if (DESKTOP_APP_MAC_ARCH) 70 | set_target_properties(${target_name} PROPERTIES 71 | OSX_ARCHITECTURES "${DESKTOP_APP_MAC_ARCH}" 72 | ) 73 | endif() 74 | endfunction() 75 | -------------------------------------------------------------------------------- /linux_allocation_tracer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(linux_allocation_tracer STATIC) 8 | add_library(desktop-app::linux_allocation_tracer ALIAS linux_allocation_tracer) 9 | 10 | nice_target_sources(linux_allocation_tracer ${CMAKE_CURRENT_SOURCE_DIR} 11 | PRIVATE 12 | linux_allocation_tracer.cpp 13 | linux_allocation_tracer.h 14 | ) 15 | 16 | add_executable(allocation_trace_reader WIN32) 17 | init_target(allocation_trace_reader) 18 | 19 | target_sources(allocation_trace_reader 20 | PRIVATE 21 | linux_allocation_trace_reader.cpp 22 | ) 23 | 24 | set_target_properties(allocation_trace_reader PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) 25 | -------------------------------------------------------------------------------- /linux_allocation_tracer/linux_allocation_trace_reader.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Desktop App Toolkit, 2 | // a set of libraries for developing nice desktop applications. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/desktop-app/legal/blob/master/LEGAL 6 | // 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | constexpr auto kBufferSize = 1024 * 1024; 16 | char Buffer[kBufferSize]; 17 | 18 | struct Fields { 19 | std::uint32_t time = 0; 20 | std::size_t mallocs = 0; 21 | std::size_t reallocs = 0; 22 | std::size_t frees = 0; 23 | std::size_t unknownReallocs = 0; 24 | std::size_t unknownFrees = 0; 25 | }; 26 | Fields State; 27 | std::unordered_map Map; 28 | std::vector Snapshots; 29 | 30 | void WriteTime(std::uint32_t time) { 31 | std::time_t t = std::time_t(time); 32 | const auto parsed = std::localtime(&t); 33 | std::cout 34 | << std::setw(2) << std::setfill('0') << parsed->tm_hour 35 | << ":" 36 | << std::setw(2) << std::setfill('0') << parsed->tm_min 37 | << ":" 38 | << std::setw(2) << std::setfill('0') << parsed->tm_sec; 39 | } 40 | 41 | void PrintState() { 42 | if (!State.time) { 43 | return; 44 | } 45 | WriteTime(State.time); 46 | auto full = std::uint64_t(0); 47 | for (const auto &[address, amount] : Map) { 48 | full += amount; 49 | } 50 | 51 | class NumPunct final : public std::numpunct { 52 | protected: 53 | char do_thousands_sep() const override { return '\''; } 54 | std::string do_grouping() const override { return "\03"; } 55 | }; 56 | 57 | const auto &locale = std::cout.getloc(); 58 | std::cout.imbue(std::locale(std::locale::classic(), new NumPunct())); 59 | std::cout 60 | << ": " 61 | << std::setw(13) << std::setfill(' ') << full 62 | << " (unknown: " 63 | << State.unknownFrees 64 | << ")" 65 | << std::endl; 66 | std::cout.imbue(locale); 67 | } 68 | 69 | void Add(std::uint64_t address, std::uint64_t size) { 70 | const auto i = Map.find(address); 71 | if (i != end(Map)) { 72 | std::cout 73 | << "WARNING: Repeated entry for " 74 | << address 75 | << " (size: " 76 | << size 77 | << ")." 78 | << std::endl; 79 | return; 80 | } 81 | Map.emplace(address, size); 82 | } 83 | 84 | void ParseMalloc(const char *buffer) { 85 | const auto size = *reinterpret_cast(buffer); 86 | const auto address = *reinterpret_cast(buffer + 8); 87 | Add(address, size); 88 | ++State.mallocs; 89 | } 90 | 91 | void ParseRealloc(const char *buffer) { 92 | const auto old = *reinterpret_cast(buffer); 93 | const auto size = *reinterpret_cast(buffer + 8); 94 | const auto address = *reinterpret_cast(buffer + 16); 95 | const auto i = Map.find(old); 96 | if (i == end(Map)) { 97 | ++State.unknownReallocs; 98 | Add(address, size); 99 | } else if (old != address) { 100 | Map.erase(i); 101 | Add(address, size); 102 | ++State.reallocs; 103 | } else { 104 | i->second = size; 105 | ++State.reallocs; 106 | } 107 | } 108 | 109 | void ParseFree(const char *buffer) { 110 | const auto address = *reinterpret_cast(buffer); 111 | const auto i = Map.find(address); 112 | if (i == end(Map)) { 113 | ++State.unknownFrees; 114 | } else { 115 | Map.erase(i); 116 | ++State.frees; 117 | } 118 | } 119 | 120 | long Parse(const char *buffer, const char *end) { 121 | auto result = 0; 122 | while (end > buffer) { 123 | const auto command = buffer[0]; 124 | auto entry = 0; 125 | switch (command) { 126 | case 1: entry = 5 + 2 * sizeof(std::uint64_t); break; 127 | case 2: entry = 5 + 3 * sizeof(std::uint64_t); break; 128 | case 3: entry = 5 + sizeof(std::uint64_t); break; 129 | default: 130 | std::cout 131 | << "WARNING: Garbage in trace file, command: " 132 | << int(command) 133 | << "." 134 | << std::endl; 135 | return -1; 136 | } 137 | if (end - buffer < entry) { 138 | break; 139 | } 140 | const auto time = *reinterpret_cast(++buffer); 141 | buffer += 4; 142 | if (time > State.time) { 143 | PrintState(); 144 | State.time = time; 145 | } else if (time < State.time) { 146 | std::cout 147 | << "WARNING: Time " 148 | << time 149 | << " after " 150 | << State.time 151 | << "." 152 | << std::endl; 153 | } 154 | switch (command) { 155 | case 1: ParseMalloc(buffer); break; 156 | case 2: ParseRealloc(buffer); break; 157 | case 3: ParseFree(buffer); break; 158 | } 159 | buffer += entry - 5; 160 | result += entry; 161 | } 162 | return result; 163 | } 164 | 165 | int main(int argc, char *argv[]) { 166 | if (argc != 2) { 167 | std::cout 168 | << "Usage 'allocation_trace_reader [trace_file_path]'." 169 | << std::endl; 170 | return -1; 171 | } 172 | const auto file = fopen(argv[1], "rb"); 173 | if (!file) { 174 | std::cout 175 | << "ERROR: Could not open '" 176 | << argv[1] 177 | << "'." 178 | << std::endl; 179 | return -1; 180 | } 181 | char *data = Buffer; 182 | while (true) { 183 | const auto read = fread(data, 1, Buffer + kBufferSize - data, file); 184 | if (read == 0) { 185 | if (data != Buffer) { 186 | std::cout 187 | << "WARNING: Trace file end is corrupt, could not parse: " 188 | << std::size_t(data - Buffer) 189 | << std::endl; 190 | } 191 | break; 192 | } 193 | data += read; 194 | const auto parsed = Parse(Buffer, data); 195 | if (parsed < 0) { 196 | break; 197 | } 198 | data -= parsed; 199 | if (data - Buffer > 0) { 200 | std::memmove(Buffer, Buffer + parsed, data - Buffer); 201 | } 202 | } 203 | PrintState(); 204 | std::cout << "Mallocs: " << State.mallocs << "." << std::endl; 205 | std::cout << "Reallocs: " << State.reallocs << "." << std::endl; 206 | std::cout << "Frees: " << State.frees << "." << std::endl; 207 | if (State.unknownReallocs) { 208 | std::cout 209 | << "Unknown realloc() calls: " 210 | << State.unknownReallocs 211 | << "." 212 | << std::endl; 213 | } 214 | return 0; 215 | } 216 | -------------------------------------------------------------------------------- /linux_allocation_tracer/linux_allocation_tracer.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Desktop App Toolkit, 2 | // a set of libraries for developing nice desktop applications. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/desktop-app/legal/blob/master/LEGAL 6 | // 7 | #include "linux_allocation_tracer.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace { 18 | 19 | std::atomic MallocLogger; 20 | std::atomic VallocLogger; 21 | std::atomic PVallocLogger; 22 | std::atomic CallocLogger; 23 | std::atomic ReallocLogger; 24 | std::atomic MemAlignLogger; 25 | std::atomic AlignedAllocLogger; 26 | std::atomic PosixMemAlignLogger; 27 | std::atomic FreeLogger; 28 | 29 | } // namespace 30 | 31 | extern "C" { 32 | 33 | //void *__real___malloc(size_t size); 34 | void *__real___libc_malloc(size_t size); 35 | 36 | void *__real_malloc(size_t size); 37 | void *__real_valloc(size_t size); 38 | void *__real_pvalloc(size_t size); 39 | void *__real_calloc(size_t num, size_t size); 40 | void *__real_realloc(void *ptr, size_t size); 41 | void *__real_memalign(size_t alignment, size_t size); 42 | void *__real_aligned_alloc(size_t alignment, size_t size); 43 | int __real_posix_memalign(void **memptr, size_t alignment, size_t size); 44 | void __real_free(void *ptr); 45 | 46 | // void *__wrap___malloc(size_t size) { 47 | // const auto result = __real___malloc(size); 48 | // if (const auto logger = MallocLogger.load()) { 49 | // logger(size, result); 50 | // } 51 | // return result; 52 | // } 53 | 54 | void *__wrap___libc_malloc(size_t size) { 55 | const auto result = __real___libc_malloc(size); 56 | if (const auto logger = MallocLogger.load()) { 57 | logger(size, result); 58 | } 59 | return result; 60 | } 61 | 62 | void *__wrap_malloc(size_t size) { 63 | const auto result = __real_malloc(size); 64 | if (const auto logger = MallocLogger.load()) { 65 | logger(size, result); 66 | } 67 | return result; 68 | } 69 | 70 | void *__wrap_valloc(size_t size) { 71 | const auto result = __real_valloc(size); 72 | if (const auto logger = VallocLogger.load()) { 73 | logger(size, result); 74 | } 75 | return result; 76 | } 77 | 78 | void *__wrap_pvalloc(size_t size) { 79 | const auto result = __real_pvalloc(size); 80 | if (const auto logger = PVallocLogger.load()) { 81 | logger(size, result); 82 | } 83 | return result; 84 | } 85 | 86 | void *__wrap_calloc(size_t num, size_t size) { 87 | const auto result = __real_calloc(num, size); 88 | if (const auto logger = CallocLogger.load()) { 89 | logger(num, size, result); 90 | } 91 | return result; 92 | } 93 | 94 | void *__wrap_realloc(void *ptr, size_t size) { 95 | const auto result = __real_realloc(ptr, size); 96 | if (const auto logger = ReallocLogger.load()) { 97 | logger(ptr, size, result); 98 | } 99 | return result; 100 | } 101 | 102 | void *__wrap_memalign(size_t alignment, size_t size) { 103 | const auto result = __real_memalign(alignment, size); 104 | if (const auto logger = MemAlignLogger.load()) { 105 | logger(alignment, size, result); 106 | } 107 | return result; 108 | } 109 | 110 | void *__wrap_aligned_alloc(size_t alignment, size_t size) { 111 | const auto result = __real_aligned_alloc(alignment, size); 112 | if (const auto logger = AlignedAllocLogger.load()) { 113 | logger(alignment, size, result); 114 | } 115 | return result; 116 | } 117 | 118 | int __wrap_posix_memalign(void **memptr, size_t alignment, size_t size) { 119 | const auto result = __real_posix_memalign(memptr, alignment, size); 120 | if (!result) { 121 | if (const auto logger = PosixMemAlignLogger.load()) { 122 | logger(alignment, size, *memptr); 123 | } 124 | } 125 | return result; 126 | } 127 | 128 | void __wrap_free(void *ptr) { 129 | if (const auto logger = FreeLogger.load()) { 130 | logger(ptr); 131 | } 132 | __real_free(ptr); 133 | } 134 | 135 | } // extern "C" 136 | 137 | void SetMallocLogger(void (*logger)(size_t, void *)) { 138 | MallocLogger = logger; 139 | } 140 | 141 | void SetVallocLogger(void (*logger)(size_t, void *)) { 142 | VallocLogger = logger; 143 | } 144 | 145 | void SetPVallocLogger(void (*logger)(size_t, void *)) { 146 | PVallocLogger = logger; 147 | } 148 | 149 | void SetCallocLogger(void (*logger)(size_t, size_t, void *)) { 150 | CallocLogger = logger; 151 | } 152 | 153 | void SetReallocLogger(void (*logger)(void *, size_t, void *)) { 154 | ReallocLogger = logger; 155 | } 156 | 157 | void SetMemAlignLogger(void (*logger)(size_t, size_t, void *)) { 158 | MemAlignLogger = logger; 159 | } 160 | 161 | void SetAlignedAllocLogger(void (*logger)(size_t, size_t, void *)) { 162 | AlignedAllocLogger = logger; 163 | } 164 | 165 | void SetPosixMemAlignLogger(void (*logger)(size_t, size_t, void *)) { 166 | PosixMemAlignLogger = logger; 167 | } 168 | 169 | void SetFreeLogger(void (*logger)(void *)) { 170 | FreeLogger = logger; 171 | } 172 | -------------------------------------------------------------------------------- /linux_allocation_tracer/linux_allocation_tracer.h: -------------------------------------------------------------------------------- 1 | // This file is part of Desktop App Toolkit, 2 | // a set of libraries for developing nice desktop applications. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/desktop-app/legal/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | #include 10 | 11 | void SetMallocLogger(void (*logger)(size_t, void *)); 12 | void SetVallocLogger(void (*logger)(size_t, void *)); 13 | void SetPVallocLogger(void (*logger)(size_t, void *)); 14 | void SetCallocLogger(void (*logger)(size_t, size_t, void *)); 15 | void SetReallocLogger(void (*logger)(void *, size_t, void *)); 16 | void SetMemAlignLogger(void (*logger)(size_t, size_t, void *)); 17 | void SetAlignedAllocLogger(void (*logger)(size_t, size_t, void *)); 18 | void SetPosixMemAlignLogger(void (*logger)(size_t, size_t, void *)); 19 | void SetFreeLogger(void (*logger)(void *)); 20 | -------------------------------------------------------------------------------- /linux_jemalloc_helper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(linux_jemalloc_helper OBJECT) 8 | init_target(linux_jemalloc_helper "(external)") 9 | add_library(desktop-app::linux_jemalloc_helper ALIAS linux_jemalloc_helper) 10 | 11 | nice_target_sources(linux_jemalloc_helper ${CMAKE_CURRENT_SOURCE_DIR} 12 | PRIVATE 13 | linux_jemalloc_helper.cpp 14 | ) 15 | 16 | target_link_libraries(linux_jemalloc_helper 17 | PRIVATE 18 | desktop-app::external_jemalloc 19 | ) 20 | -------------------------------------------------------------------------------- /linux_jemalloc_helper/linux_jemalloc_helper.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Desktop App Toolkit, 2 | // a set of libraries for developing nice desktop applications. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/desktop-app/legal/blob/master/LEGAL 6 | // 7 | #ifdef __FreeBSD__ 8 | #include 9 | #else // __FreeBSD__ 10 | #include 11 | #endif // !__FreeBSD__ 12 | 13 | namespace { 14 | 15 | class JemallocInitializer { 16 | public: 17 | JemallocInitializer() { 18 | auto backgroundThread = true; 19 | mallctl("background_thread", nullptr, nullptr, &backgroundThread, sizeof(bool)); 20 | } 21 | }; 22 | 23 | static const JemallocInitializer initializer; 24 | 25 | } // namespace 26 | -------------------------------------------------------------------------------- /nice_target_sources.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(nice_target_sources target_name src_loc) 8 | set(writing_now "") 9 | set(private_sources "") 10 | set(public_sources "") 11 | set(interface_sources "") 12 | set(not_win_sources "") 13 | set(not_mac_sources "") 14 | set(not_linux_sources "") 15 | foreach (entry ${ARGN}) 16 | if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") 17 | set(writing_now ${entry}) 18 | else() 19 | set(full_name ${src_loc}/${entry}) 20 | if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.") 21 | list(APPEND not_mac_sources ${full_name}) 22 | list(APPEND not_linux_sources ${full_name}) 23 | elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.") 24 | list(APPEND not_win_sources ${full_name}) 25 | list(APPEND not_linux_sources ${full_name}) 26 | elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.") 27 | list(APPEND not_win_sources ${full_name}) 28 | list(APPEND not_mac_sources ${full_name}) 29 | elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.") 30 | list(APPEND not_win_sources ${full_name}) 31 | endif() 32 | if ("${writing_now}" STREQUAL "PRIVATE") 33 | list(APPEND private_sources ${full_name}) 34 | elseif ("${writing_now}" STREQUAL "PUBLIC") 35 | list(APPEND public_sources ${full_name}) 36 | elseif ("${writing_now}" STREQUAL "INTERFACE") 37 | list(APPEND interface_sources ${full_name}) 38 | else() 39 | message(FATAL_ERROR "Unknown sources scope for target ${target_name}") 40 | endif() 41 | if (${src_loc} MATCHES "/Resources$") 42 | source_group(TREE ${src_loc} PREFIX Resources FILES ${full_name}) 43 | else() 44 | source_group(TREE ${src_loc} PREFIX Sources FILES ${full_name}) 45 | endif() 46 | endif() 47 | endforeach() 48 | 49 | if (NOT "${public_sources}" STREQUAL "") 50 | target_sources(${target_name} PUBLIC ${public_sources}) 51 | endif() 52 | if (NOT "${private_sources}" STREQUAL "") 53 | target_sources(${target_name} PRIVATE ${private_sources}) 54 | endif() 55 | if (NOT "${interface_sources}" STREQUAL "") 56 | target_sources(${target_name} INTERFACE ${interface_sources}) 57 | endif() 58 | if (WIN32) 59 | set_source_files_properties(${not_win_sources} PROPERTIES HEADER_FILE_ONLY TRUE) 60 | set_source_files_properties(${not_win_sources} PROPERTIES SKIP_AUTOGEN TRUE) 61 | elseif (APPLE) 62 | set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE) 63 | set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE) 64 | elseif (LINUX) 65 | set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE) 66 | set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE) 67 | endif() 68 | endfunction() 69 | 70 | function(remove_target_sources target_name src_loc) 71 | set(sources "") 72 | foreach (entry ${ARGN}) 73 | set(full_name ${src_loc}/${entry}) 74 | list(APPEND sources ${full_name}) 75 | endforeach() 76 | 77 | set_source_files_properties(${sources} PROPERTIES HEADER_FILE_ONLY TRUE) 78 | set_source_files_properties(${sources} PROPERTIES SKIP_AUTOGEN TRUE) 79 | endfunction() 80 | -------------------------------------------------------------------------------- /nuget.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(nuget_add_package package_name package package_version) 8 | get_property(nuget_exe_defined GLOBAL PROPERTY nuget_exe_path_property SET) 9 | if (NOT nuget_exe_defined) 10 | # Thanks https://github.com/clarkezone/flutter_win_webview/blob/master/webview_popupauth/windows/CMakeLists.txt 11 | find_program(NUGET_EXE NAMES nuget PATHS "${CMAKE_SOURCE_DIR}/../ThirdParty/NuGet") 12 | if (NOT NUGET_EXE) 13 | message("NUGET.EXE not found.") 14 | message(FATAL_ERROR "Please install this executable, and run CMake again.") 15 | endif() 16 | message("Resolved NuGet executable: ${NUGET_EXE}") 17 | set_property(GLOBAL PROPERTY nuget_exe_path_property ${NUGET_EXE}) 18 | else() 19 | get_property(NUGET_EXE GLOBAL PROPERTY nuget_exe_path_property) 20 | endif() 21 | 22 | set(package_key nuget_${package_name}_version_property) 23 | get_property(package_version_defined GLOBAL PROPERTY ${package_key} SET) 24 | if (NOT package_version_defined) 25 | set(packages_loc ${CMAKE_BINARY_DIR}/packages) 26 | file(MAKE_DIRECTORY ${packages_loc}) 27 | 28 | set_property(GLOBAL PROPERTY ${package_key} ${package_version}) 29 | execute_process( 30 | COMMAND 31 | ${NUGET_EXE} 32 | install 33 | ${package} 34 | -Version ${package_version} 35 | -ExcludeVersion 36 | -OutputDirectory ${packages_loc} 37 | ) 38 | else() 39 | get_property(package_version_cached GLOBAL PROPERTY ${package_key}) 40 | if (NOT (${package_version_cached} EQUAL ${package_version})) 41 | message(FATAL_ERROR "Package ${package_name} requested with both ${package_version_cached} and ${package_version}") 42 | endif() 43 | endif() 44 | set(${package_name}_loc ${CMAKE_BINARY_DIR}/packages/${package} PARENT_SCOPE) 45 | endfunction() 46 | 47 | function(nuget_add_webview target_name) 48 | nuget_add_package(webview2 "Microsoft.Web.WebView2" 1.0.1901.177) 49 | 50 | set(webview2_loc_native ${webview2_loc}/build/native) 51 | # target_link_libraries(${target_name} 52 | # PRIVATE 53 | # ${webview2_loc_native}/Microsoft.Web.WebView2.targets 54 | # ${src_loc}/ForceStaticLink.targets 55 | # ) 56 | # 57 | # This works, but just to be sure, manually link to static library. 58 | # 59 | target_include_directories(${target_name} 60 | PRIVATE 61 | ${webview2_loc_native}/include 62 | ) 63 | if (build_winarm) 64 | set(webview2_lib_folder arm64) 65 | elseif (build_win64) 66 | set(webview2_lib_folder x64) 67 | else() 68 | set(webview2_lib_folder x86) 69 | endif() 70 | target_link_libraries(${target_name} 71 | PRIVATE 72 | ${webview2_loc_native}/${webview2_lib_folder}/WebView2LoaderStatic.lib 73 | ) 74 | endfunction() 75 | 76 | function(nuget_add_winrt target_name) 77 | return() # Use headers from SDK, because Qt 6 does. 78 | 79 | nuget_add_package(winrt "Microsoft.Windows.CppWinRT" 2.0.210505.3) 80 | 81 | set(gen_dst ${CMAKE_BINARY_DIR}/packages/gen) 82 | file(MAKE_DIRECTORY ${gen_dst}/winrt) 83 | 84 | set(winrt_sdk_version) 85 | if (NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) 86 | set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) 87 | endif() 88 | # https://gitlab.kitware.com/cmake/cmake/-/blob/89cfb90b9c0893133983b4f25896671c4f07497c/Modules/InstallRequiredSystemLibraries.cmake#L381 89 | if (";${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION};$ENV{UCRTVersion};$ENV{WindowsSDKVersion};" MATCHES [=[;([0-9.]+)[;\]]=]) 90 | set(winrt_sdk_version ${CMAKE_MATCH_1}) 91 | endif() 92 | set(winrt_version_key ${gen_dst}/winrt/version_key) 93 | set(winrt_version_test ${winrt_version_key}_test) 94 | set(sdk_version_key ${gen_dst}/winrt/sdk_version_key) 95 | set(sdk_version_test ${sdk_version_key}_test) 96 | 97 | execute_process( 98 | COMMAND 99 | ${winrt_loc}/bin/cppwinrt 100 | /? 101 | OUTPUT_FILE 102 | ${winrt_version_test} 103 | COMMAND_ERROR_IS_FATAL ANY 104 | ) 105 | file(WRITE ${sdk_version_test} ${winrt_sdk_version}) 106 | execute_process( 107 | COMMAND 108 | ${CMAKE_COMMAND} -E compare_files ${winrt_version_key} ${winrt_version_test} 109 | RESULT_VARIABLE winrt_version_compare_result 110 | ) 111 | execute_process( 112 | COMMAND 113 | ${CMAKE_COMMAND} -E compare_files ${sdk_version_key} ${sdk_version_test} 114 | RESULT_VARIABLE sdk_version_compare_result 115 | ) 116 | if (winrt_version_compare_result EQUAL 0 AND sdk_version_compare_result EQUAL 0) 117 | message("Using existing WinRT headers.") 118 | else() 119 | message("Generating new WinRT headers.") 120 | 121 | execute_process( 122 | COMMAND 123 | ${winrt_loc}/bin/cppwinrt 124 | -input ${winrt_sdk_version} 125 | -output ${gen_dst} 126 | COMMAND_ERROR_IS_FATAL ANY 127 | ) 128 | file(RENAME ${winrt_version_test} ${winrt_version_key}) 129 | file(RENAME ${sdk_version_test} ${sdk_version_key}) 130 | endif() 131 | 132 | target_include_directories(${target_name} 133 | PRIVATE 134 | ${gen_dst} 135 | ) 136 | endfunction() 137 | -------------------------------------------------------------------------------- /options.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(common_options INTERFACE) 8 | add_library(desktop-app::common_options ALIAS common_options) 9 | 10 | target_compile_definitions(common_options 11 | INTERFACE 12 | $<$:_DEBUG> 13 | QT_NO_KEYWORDS 14 | QT_NO_CAST_FROM_BYTEARRAY 15 | QT_DEPRECATED_WARNINGS_SINCE=0x051500 16 | ) 17 | 18 | if (DESKTOP_APP_DISABLE_X11_INTEGRATION) 19 | target_compile_definitions(common_options 20 | INTERFACE 21 | DESKTOP_APP_DISABLE_X11_INTEGRATION 22 | ) 23 | endif() 24 | 25 | if (WIN32) 26 | include(cmake/options_win.cmake) 27 | elseif (APPLE) 28 | include(cmake/options_mac.cmake) 29 | elseif (LINUX) 30 | include(cmake/options_linux.cmake) 31 | else() 32 | message(FATAL_ERROR "Unknown platform type") 33 | endif() 34 | -------------------------------------------------------------------------------- /options_linux.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | target_compile_options(common_options 8 | INTERFACE 9 | -fPIC 10 | $<$>:-fno-strict-aliasing> 11 | -pipe 12 | ) 13 | 14 | target_compile_options_if_exists(common_options 15 | INTERFACE 16 | -Wall 17 | -Wextra 18 | -Wno-unused-parameter 19 | -Wno-switch 20 | -Wno-maybe-uninitialized 21 | -Wno-missing-field-initializers 22 | -Wno-sign-compare 23 | -Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20 24 | ) 25 | 26 | target_link_options_if_exists(common_options 27 | INTERFACE 28 | -Wno-alloc-size-larger-than # Qt + LTO 29 | -Wno-free-nonheap-object # Qt + LTO 30 | -Wno-stringop-overflow # Qt + LTO 31 | -Wno-stringop-overread # Qt + LTO 32 | -Wno-odr # Qt + LTO 33 | -Wno-inline # OpenAL + LTO 34 | -pthread 35 | -Wl,--as-needed 36 | ) 37 | 38 | if (DESKTOP_APP_SPECIAL_TARGET) 39 | target_compile_options(common_options 40 | INTERFACE 41 | -Werror 42 | ) 43 | endif() 44 | 45 | if (NOT DESKTOP_APP_DISABLE_JEMALLOC) 46 | target_link_libraries(common_options 47 | INTERFACE 48 | $ 49 | $ 50 | ) 51 | endif() 52 | 53 | if (DESKTOP_APP_USE_ALLOCATION_TRACER) 54 | target_link_options(common_options 55 | INTERFACE 56 | # -Wl,-wrap,__malloc 57 | -Wl,-wrap,__libc_malloc 58 | -Wl,-wrap,malloc 59 | -Wl,-wrap,valloc 60 | -Wl,-wrap,pvalloc 61 | -Wl,-wrap,calloc 62 | -Wl,-wrap,realloc 63 | -Wl,-wrap,memalign 64 | -Wl,-wrap,aligned_alloc 65 | -Wl,-wrap,posix_memalign 66 | -Wl,-wrap,free 67 | -Wl,--push-state,--no-as-needed,-lrt,--pop-state 68 | ) 69 | target_link_libraries(common_options 70 | INTERFACE 71 | desktop-app::linux_allocation_tracer 72 | $ 73 | ) 74 | endif() 75 | 76 | if (DESKTOP_APP_ASAN) 77 | target_compile_options(common_options INTERFACE -fsanitize=address) 78 | target_link_options(common_options INTERFACE -fsanitize=address) 79 | endif() 80 | 81 | target_link_libraries(common_options 82 | INTERFACE 83 | ${CMAKE_DL_LIBS} 84 | ) 85 | -------------------------------------------------------------------------------- /options_mac.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | if (build_macstore) 8 | target_compile_definitions(common_options 9 | INTERFACE 10 | OS_MAC_STORE 11 | MAC_USE_BREAKPAD 12 | ) 13 | endif() 14 | if (NOT DESKTOP_APP_USE_PACKAGED) 15 | target_include_directories(common_options SYSTEM 16 | INTERFACE 17 | ${libs_loc}/local/include 18 | ) 19 | endif() 20 | 21 | target_compile_options(common_options 22 | INTERFACE 23 | -pipe 24 | -Wall 25 | -Wextra 26 | -fPIE 27 | $<$:-fobjc-weak> 28 | -fvisibility-inlines-hidden 29 | -fvisibility=hidden 30 | -Wno-unused-variable 31 | -Wno-unused-parameter 32 | -Wno-unused-function 33 | -Wno-deprecated-this-capture 34 | -Wno-switch 35 | -Wno-comment 36 | -Wno-missing-field-initializers 37 | -Wno-sign-compare 38 | -Wno-unknown-attributes 39 | -Wno-pragma-system-header-outside-header 40 | -Wno-shorten-64-to-32 41 | ) 42 | 43 | if (DESKTOP_APP_SPECIAL_TARGET) 44 | target_compile_options(common_options 45 | INTERFACE 46 | -g 47 | -Werror 48 | ) 49 | endif() 50 | 51 | target_link_frameworks(common_options 52 | INTERFACE 53 | Cocoa 54 | CoreFoundation 55 | CoreLocation 56 | CoreServices 57 | CoreText 58 | CoreGraphics 59 | CoreMedia 60 | OpenGL 61 | AudioUnit 62 | ApplicationServices 63 | Foundation 64 | AGL 65 | Security 66 | SystemConfiguration 67 | Carbon 68 | AudioToolbox 69 | VideoToolbox 70 | VideoDecodeAcceleration 71 | AVFoundation 72 | CoreAudio 73 | CoreVideo 74 | CoreMediaIO 75 | QuartzCore 76 | AppKit 77 | CoreWLAN 78 | WebKit 79 | IOKit 80 | GSS 81 | MediaPlayer 82 | IOSurface 83 | Metal 84 | LocalAuthentication 85 | ) 86 | -------------------------------------------------------------------------------- /options_win.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | target_compile_definitions(common_options 8 | INTERFACE 9 | WIN32 10 | WIN32_LEAN_AND_MEAN 11 | _WINDOWS 12 | _SCL_SECURE_NO_WARNINGS 13 | NOMINMAX 14 | NOSERVICE 15 | NOMCX 16 | NOIME 17 | NOSOUND 18 | NOCOMM 19 | NOKANJI 20 | NORPC 21 | NOPROXYSTUB 22 | NOIMAGE 23 | NOTAPE 24 | UNICODE 25 | _UNICODE 26 | ) 27 | if (MSVC) 28 | target_compile_options(common_options 29 | INTERFACE 30 | /permissive- 31 | # /Qspectre 32 | /utf-8 33 | /W4 34 | /MP # Enable multi process build. 35 | /EHsc # Catch C++ exceptions only, extern C functions never throw a C++ exception. 36 | /w15038 # wrong initialization order 37 | /w14265 # class has virtual functions, but destructor is not virtual 38 | /wd4018 # 'token' : signed/unsigned mismatch 39 | /wd4100 # 'identifier' : unreferenced formal parameter 40 | /wd4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data 41 | /wd4244 # 'argument' : conversion from 'type1' to 'type2', possible loss of data 42 | /wd4245 # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch 43 | /wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data 44 | /wd4305 # 'conversion': truncation from 'type1' to 'type2' 45 | /wd4324 # 'structname': structure was padded due to alignment specifier 46 | /wd4389 # 'equality-operator' : signed/unsigned mismatch 47 | /wd4456 # declaration of 'identifier' hides previous local declaration 48 | /wd4457 # declaration of 'identifier' hides function parameter 49 | /wd4458 # declaration of 'identifier' hides class member 50 | /wd4459 # declaration of 'identifier' hides global declaration 51 | /wd4611 # interaction between 'function' and C++ object destruction is non-portable 52 | /wd4702 # unreachable code 53 | /wd4310 # cast truncates constant value 54 | /wd4127 # conditional expression is constant 55 | 56 | # Taken from Qt 6. 57 | # https://developercommunity.visualstudio.com/content/problem/139261/msvc-incorrectly-defines-cplusplus.html 58 | # No support for the flag in upstream CMake as of 3.17. 59 | # https://gitlab.kitware.com/cmake/cmake/issues/18837 60 | /Zc:__cplusplus 61 | ) 62 | 63 | target_link_options(common_options 64 | INTERFACE 65 | $<$:/NODEFAULTLIB:LIBCMT> 66 | $>,ProgramDatabase>,/DEBUG,/DEBUG:NONE> 67 | $<$>:/OPT:REF> 68 | /INCREMENTAL:NO 69 | /DEPENDENTLOADFLAG:0x800 70 | ) 71 | 72 | if (DESKTOP_APP_ASAN) 73 | target_compile_options(common_options INTERFACE /fsanitize=address) 74 | 75 | # https://developercommunity.visualstudio.com/t/Linker-error-LNK2038-when-using-Parallel/10512721 76 | target_compile_definitions(common_options 77 | INTERFACE 78 | _DISABLE_VECTOR_ANNOTATION 79 | _DISABLE_STRING_ANNOTATION 80 | ) 81 | endif() 82 | 83 | target_compile_options(common_options 84 | INTERFACE 85 | /bigobj # scheme.cpp has too many sections. 86 | ) 87 | if (NOT build_win64 AND NOT build_winarm) 88 | # target_compile_options(common_options 89 | # INTERFACE 90 | # /fp:except # Crash-report fp exceptions in 32 bit build. 91 | # ) 92 | target_link_options(common_options 93 | INTERFACE 94 | /LARGEADDRESSAWARE # Allow more than 2 GB in 32 bit application. 95 | ) 96 | endif() 97 | 98 | if (DESKTOP_APP_SPECIAL_TARGET) 99 | target_compile_options(common_options 100 | INTERFACE 101 | /WX 102 | $<$>:/GL> 103 | ) 104 | target_link_options(common_options 105 | INTERFACE 106 | $<$>:/LTCG> 107 | $<$>:/LTCGOUT:> 108 | ) 109 | endif() 110 | endif() 111 | 112 | target_link_libraries(common_options 113 | INTERFACE 114 | winmm 115 | imm32 116 | ws2_32 117 | kernel32 118 | user32 119 | gdi32 120 | winspool 121 | comdlg32 122 | advapi32 123 | shell32 124 | ole32 125 | oleaut32 126 | uuid 127 | odbc32 128 | odbccp32 129 | Shlwapi 130 | Iphlpapi 131 | Gdiplus 132 | Strmiids 133 | Netapi32 134 | Userenv 135 | Version 136 | Dwmapi 137 | UxTheme 138 | Wtsapi32 139 | Crypt32 140 | Propsys 141 | Bcrypt 142 | ) 143 | 144 | if (build_winstore) 145 | target_compile_definitions(common_options INTERFACE OS_WIN_STORE) 146 | endif() 147 | -------------------------------------------------------------------------------- /run_cmake.py: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | import sys, os, shutil, subprocess 8 | 9 | def run(project, arguments, buildType=''): 10 | scriptPath = os.path.dirname(os.path.realpath(__file__)) 11 | basePath = scriptPath + '/../out/' + buildType 12 | 13 | cmake = ['cmake'] 14 | vsArch = '' 15 | explicitGenerator = False 16 | for arg in arguments: 17 | if arg == 'debug': 18 | cmake.append('-DCMAKE_BUILD_TYPE=Debug') 19 | elif arg == 'x86' or arg == 'x64' or arg == 'arm': 20 | vsArch = arg 21 | elif arg != 'force': 22 | if arg.startswith('-G'): 23 | explicitGenerator = True 24 | cmake.append(arg) 25 | if sys.platform == 'win32' and not explicitGenerator: 26 | if vsArch == 'x64': 27 | cmake.append('-Ax64') 28 | elif vsArch == 'arm': 29 | cmake.append('-AARM64') 30 | else: 31 | cmake.append('-AWin32') # default 32 | elif vsArch != '': 33 | print("[ERROR] x86/x64/arm switch is supported only with Visual Studio.") 34 | return 1 35 | elif sys.platform == 'darwin': 36 | if not explicitGenerator: 37 | cmake.append('-GXcode') 38 | else: 39 | if not explicitGenerator: 40 | cmake.append('-GNinja Multi-Config') 41 | elif buildType: 42 | cmake.append('-DCMAKE_BUILD_TYPE=' + buildType) 43 | elif not '-DCMAKE_BUILD_TYPE=Debug' in cmake: 44 | cmake.append('-DCMAKE_BUILD_TYPE=Release') 45 | 46 | specialTarget = '' 47 | specialTargetFile = scriptPath + '/../' + project + '/build/target' 48 | if os.path.isfile(specialTargetFile): 49 | with open(specialTargetFile, 'r') as f: 50 | for line in f: 51 | target = line.strip() 52 | if len(target) > 0: 53 | cmake.append('-DDESKTOP_APP_SPECIAL_TARGET=' + target) 54 | 55 | cmake.extend(['-Werror=dev', '-Werror=deprecated', '--warn-uninitialized', '..' if not buildType else '../..']) 56 | command = '"' + '" "'.join(cmake) + '"' 57 | 58 | if not os.path.exists(basePath): 59 | os.makedirs(basePath) 60 | elif 'force' in arguments: 61 | paths = os.listdir(basePath) 62 | for path in paths: 63 | low = path.lower(); 64 | if not low.startswith('debug') and not low.startswith('release'): 65 | full = basePath + '/' + path 66 | if os.path.isdir(full): 67 | shutil.rmtree(full, ignore_errors=False) 68 | else: 69 | os.remove(full) 70 | print('Cleared previous.') 71 | os.chdir(basePath) 72 | return subprocess.call(command, shell=True) 73 | -------------------------------------------------------------------------------- /target_compile_options_if_exists.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | include(CheckCXXCompilerFlag) 8 | 9 | function(target_compile_options_if_exists target_name) 10 | set(writing_now "") 11 | set(private_options "") 12 | set(public_options "") 13 | set(interface_options "") 14 | foreach (entry ${ARGN}) 15 | if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") 16 | set(writing_now ${entry}) 17 | else() 18 | string(MAKE_C_IDENTIFIER ${entry} entry_identifier) 19 | check_cxx_compiler_flag(${entry} DESKTOP_APP_${entry_identifier}_EXISTS) 20 | if (DESKTOP_APP_${entry_identifier}_EXISTS) 21 | if ("${writing_now}" STREQUAL "PRIVATE") 22 | list(APPEND private_options ${entry}) 23 | elseif ("${writing_now}" STREQUAL "PUBLIC") 24 | list(APPEND public_options ${entry}) 25 | elseif ("${writing_now}" STREQUAL "INTERFACE") 26 | list(APPEND interface_options ${entry}) 27 | else() 28 | message(FATAL_ERROR "Unknown options scope for target ${target_name}") 29 | endif() 30 | endif() 31 | endif() 32 | endforeach() 33 | 34 | if (NOT "${public_options}" STREQUAL "") 35 | target_compile_options(${target_name} PUBLIC ${public_options}) 36 | endif() 37 | if (NOT "${private_options}" STREQUAL "") 38 | target_compile_options(${target_name} PRIVATE ${private_options}) 39 | endif() 40 | if (NOT "${interface_options}" STREQUAL "") 41 | target_compile_options(${target_name} INTERFACE ${interface_options}) 42 | endif() 43 | endfunction() 44 | -------------------------------------------------------------------------------- /target_link_frameworks.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(target_link_frameworks_generic type target_name) 8 | set(writing_now "") 9 | set(private_frameworks "") 10 | set(public_frameworks "") 11 | set(interface_frameworks "") 12 | foreach (entry ${ARGN}) 13 | if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") 14 | set(writing_now ${entry}) 15 | else() 16 | set(full_argument "${type} ${entry}") 17 | if ("${writing_now}" STREQUAL "PRIVATE") 18 | list(APPEND private_frameworks ${full_argument}) 19 | elseif ("${writing_now}" STREQUAL "PUBLIC") 20 | list(APPEND public_frameworks ${full_argument}) 21 | elseif ("${writing_now}" STREQUAL "INTERFACE") 22 | list(APPEND interface_frameworks ${full_argument}) 23 | else() 24 | message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}") 25 | endif() 26 | endif() 27 | endforeach() 28 | 29 | if (NOT "${public_frameworks}" STREQUAL "") 30 | target_link_libraries(${target_name} PUBLIC ${public_frameworks}) 31 | endif() 32 | if (NOT "${private_frameworks}" STREQUAL "") 33 | target_link_libraries(${target_name} PRIVATE ${private_frameworks}) 34 | endif() 35 | if (NOT "${interface_frameworks}" STREQUAL "") 36 | target_link_libraries(${target_name} INTERFACE ${interface_frameworks}) 37 | endif() 38 | endfunction() 39 | 40 | function(target_link_frameworks) 41 | target_link_frameworks_generic("-framework" ${ARGN}) 42 | endfunction() 43 | 44 | function(target_link_frameworks_weak) 45 | target_link_frameworks_generic("-weak_framework" ${ARGN}) 46 | endfunction() 47 | -------------------------------------------------------------------------------- /target_link_options_if_exists.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | include(CheckLinkerFlag) 8 | 9 | function(target_link_options_if_exists target_name) 10 | set(writing_now "") 11 | set(private_options "") 12 | set(public_options "") 13 | set(interface_options "") 14 | foreach (entry ${ARGN}) 15 | if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") 16 | set(writing_now ${entry}) 17 | else() 18 | string(MAKE_C_IDENTIFIER ${entry} entry_identifier) 19 | check_linker_flag(CXX ${entry} DESKTOP_APP_${entry_identifier}_EXISTS) 20 | if (DESKTOP_APP_${entry_identifier}_EXISTS) 21 | if ("${writing_now}" STREQUAL "PRIVATE") 22 | list(APPEND private_options ${entry}) 23 | elseif ("${writing_now}" STREQUAL "PUBLIC") 24 | list(APPEND public_options ${entry}) 25 | elseif ("${writing_now}" STREQUAL "INTERFACE") 26 | list(APPEND interface_options ${entry}) 27 | else() 28 | message(FATAL_ERROR "Unknown options scope for target ${target_name}") 29 | endif() 30 | endif() 31 | endif() 32 | endforeach() 33 | 34 | if (NOT "${public_options}" STREQUAL "") 35 | target_link_options(${target_name} PUBLIC ${public_options}) 36 | endif() 37 | if (NOT "${private_options}" STREQUAL "") 38 | target_link_options(${target_name} PRIVATE ${private_options}) 39 | endif() 40 | if (NOT "${interface_options}" STREQUAL "") 41 | target_link_options(${target_name} INTERFACE ${interface_options}) 42 | endif() 43 | endfunction() 44 | -------------------------------------------------------------------------------- /target_prepare_qrc.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(target_add_resource target_name) 8 | set(list ${ARGN}) 9 | target_sources(${target_name} PRIVATE ${list}) 10 | get_target_property(existing_resources ${target_name} RESOURCE) 11 | if (NOT "${existing_resources}" STREQUAL "existing_resources-NOTFOUND") 12 | foreach(existing ${existing_resources}) 13 | list(APPEND list ${existing}) 14 | endforeach() 15 | endif() 16 | set_target_properties(${target_name} PROPERTIES RESOURCE "${list}") 17 | endfunction() 18 | 19 | function(target_prepare_qrc target_name) 20 | if (NOT APPLE) 21 | set_target_properties(${target_name} PROPERTIES AUTORCC ON) 22 | else() 23 | set(rcc_flags --binary "$") 24 | 25 | set(qrc_files) 26 | get_target_property(list ${target_name} SOURCES) 27 | foreach (entry ${list}) 28 | get_source_file_property(skip_autogen ${entry} SKIP_AUTOGEN) 29 | if (NOT ${entry} MATCHES "\\.qrc$" OR skip_autogen) 30 | continue() 31 | endif() 32 | list(APPEND qrc_files ${entry}) 33 | endforeach() 34 | if (NOT qrc_files) 35 | return() 36 | endif() 37 | set(rcc_file ${target_name}.rcc) 38 | set(rcc_path "${CMAKE_BINARY_DIR}/${rcc_file}") 39 | source_group(TREE ${CMAKE_BINARY_DIR} PREFIX Resources FILES ${rcc_path}) 40 | add_custom_command(OUTPUT ${rcc_path} 41 | DEPENDS ${qrc_files} 42 | COMMAND Qt::rcc ${rcc_flags} -o ${rcc_path} ${qrc_files} 43 | COMMAND_EXPAND_LISTS VERBATIM 44 | ) 45 | target_add_resource(${target_name} ${rcc_path}) 46 | endif() 47 | endfunction() 48 | -------------------------------------------------------------------------------- /validate_d3d_compiler.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(validate_d3d_error text) 8 | if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") 9 | message(FATAL_ERROR ${text}) 10 | else() 11 | message(WARNING ${text}) 12 | endif() 13 | endfunction() 14 | 15 | function(validate_d3d_compiler target_name) 16 | if (build_win64) 17 | set(modules_subdir x64) 18 | else() 19 | set(modules_subdir x86) 20 | endif() 21 | set(modules_hash_loc ${CMAKE_BINARY_DIR}/modules/${modules_subdir}) 22 | set(modules_debug_loc ${CMAKE_BINARY_DIR}/Debug/modules/${modules_subdir}) 23 | set(modules_release_loc ${CMAKE_BINARY_DIR}/Release/modules/${modules_subdir}) 24 | 25 | set(key_path ${modules_hash_loc}/d3d/d3dcompiler_47) 26 | set(module_debug_path ${modules_debug_loc}/d3d) 27 | set(module_release_path ${modules_release_loc}/d3d) 28 | 29 | set(key "") 30 | if (EXISTS ${key_path}) 31 | file(READ ${key_path} key) 32 | endif() 33 | 34 | string(LENGTH "${key}" key_length) 35 | if (NOT "${key_length}" STREQUAL "32" 36 | OR NOT EXISTS ${module_debug_path}/d3dcompiler_47.dll 37 | OR NOT EXISTS ${module_release_path}/d3dcompiler_47.dll) 38 | 39 | set(compiler_path ${cmake_helpers_loc}/win_directx_helper/modules/${modules_subdir}/d3d/d3dcompiler_47.dll) 40 | 41 | find_package(Python3 REQUIRED) 42 | execute_process( 43 | COMMAND 44 | ${Python3_EXECUTABLE} 45 | ${cmake_helpers_loc}/validate_d3d_compiler.py 46 | ${compiler_path} 47 | OUTPUT_VARIABLE key 48 | ERROR_VARIABLE error 49 | ) 50 | if (NOT "${error}" STREQUAL "") 51 | validate_d3d_error(${error}) 52 | return() 53 | endif() 54 | 55 | file(MAKE_DIRECTORY ${modules_debug_loc}/d3d) 56 | file(COPY ${compiler_path} DESTINATION ${module_debug_path}) 57 | 58 | file(MAKE_DIRECTORY ${modules_release_loc}/d3d) 59 | file(COPY ${compiler_path} DESTINATION ${module_release_path}) 60 | 61 | file(MAKE_DIRECTORY ${modules_hash_loc}/d3d) 62 | file(WRITE ${key_path} ${key}) 63 | endif() 64 | 65 | target_compile_definitions(${target_name} 66 | PRIVATE 67 | DESKTOP_APP_D3DCOMPILER_HASH=${key} 68 | ) 69 | 70 | target_link_libraries(${target_name} 71 | PRIVATE 72 | desktop-app::external_openssl 73 | ) 74 | endfunction() 75 | -------------------------------------------------------------------------------- /validate_d3d_compiler.py: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | from __future__ import print_function 8 | import sys, os, re, hashlib 9 | 10 | def error(*args, **kwargs): 11 | print(*args, file=sys.stderr, **kwargs) 12 | sys.exit(1) 13 | 14 | try: 15 | from win32api import GetFileVersionInfo 16 | except ImportError: 17 | error('Python module "pywin32" is not installed.\n\nTry "' + sys.executable + ' -m pip install pywin32".') 18 | 19 | if len(sys.argv) < 2: 20 | error('Expected input path to "d3dcompiler_47.dll".') 21 | 22 | inputPath = sys.argv[1] 23 | if not os.path.exists(inputPath): 24 | error('File "' + inputPath + '" doesn\'t exist.') 25 | 26 | info = GetFileVersionInfo(inputPath, '\\') 27 | version = [ info['FileVersionMS'] // 65536, info['FileVersionMS'] % 65536, info['FileVersionLS'] // 65536, info['FileVersionLS'] % 65536 ] 28 | if (version != [10, 0, 22621, 3233]): 29 | error('Bad "d3dcompiler_47.dll" version: ' + '.'.join(str(x) for x in version)) 30 | 31 | bufferSize = 1024 * 1024 32 | sha256 = hashlib.sha256() 33 | 34 | with open(inputPath, 'rb') as f: 35 | print(hashlib.sha256(f.read()).hexdigest()) 36 | -------------------------------------------------------------------------------- /validate_special_target.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | include(CMakeDependentOption) 8 | 9 | set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.") 10 | 11 | get_filename_component(libs_loc "../Libraries" REALPATH) 12 | set(libs_loc_exists 0) 13 | if (EXISTS ${libs_loc}) 14 | set(libs_loc_exists 1) 15 | endif() 16 | cmake_dependent_option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." OFF libs_loc_exists ON) 17 | 18 | function(report_bad_special_target) 19 | if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") 20 | message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'") 21 | endif() 22 | endfunction() 23 | 24 | if (APPLE AND NOT DESKTOP_APP_USE_PACKAGED) 25 | set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "Minimum macOS deployment version") 26 | set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures") 27 | endif() 28 | 29 | if (NOT DEFINED MSVC) 30 | set(MSVC 0) 31 | endif() 32 | 33 | if (WIN32) 34 | if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp" 35 | AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64" 36 | AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win" 37 | AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64" 38 | AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "winarm" 39 | AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwparm") 40 | report_bad_special_target() 41 | endif() 42 | elseif (APPLE) 43 | if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore" 44 | AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac") 45 | report_bad_special_target() 46 | endif() 47 | else() 48 | set(LINUX 1) 49 | if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux") 50 | report_bad_special_target() 51 | endif() 52 | endif() 53 | -------------------------------------------------------------------------------- /variables.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | include(CMakeDependentOption) 8 | 9 | set(no_special_target 0) 10 | if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") 11 | set(no_special_target 1) 12 | endif() 13 | 14 | set(disable_autoupdate 0) 15 | if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "" 16 | OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp" 17 | OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64" 18 | OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwparm" 19 | OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") 20 | set(disable_autoupdate 1) 21 | endif() 22 | 23 | set(CMAKE_CXX_SCAN_FOR_MODULES OFF CACHE BOOL "") 24 | set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "") 25 | option(DESKTOP_APP_TEST_APPS "Build test apps, development only." OFF) 26 | option(DESKTOP_APP_LOTTIE_DISABLE_RECOLORING "Disable recoloring of lottie animations." OFF) 27 | option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON) 28 | cmake_dependent_option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration." OFF LINUX ON) 29 | cmake_dependent_option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer." OFF LINUX OFF) 30 | option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF) 31 | option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bundled patched one." OFF) 32 | option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target}) 33 | option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) 34 | option(DESKTOP_APP_DISABLE_QT_PLUGINS "Disable bundled Qt plugins." OFF) 35 | option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) 36 | option(DESKTOP_APP_ASAN "Enable address sanitizer" OFF) 37 | cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell." OFF LINUX OFF) 38 | cmake_dependent_option(DESKTOP_APP_USE_CLD3 "Disable system text language recognition and use bundled cld3 only." OFF APPLE ON) 39 | cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF "LINUX; NOT DESKTOP_APP_ASAN" ON) 40 | 41 | if (APPLE) 42 | set(DESKTOP_APP_MAC_ARCH "" CACHE STRING "Target macOS arch.") 43 | else() 44 | set(DESKTOP_APP_MAC_ARCH) 45 | endif() 46 | 47 | set(add_hunspell_library 0) 48 | if (WIN32 49 | OR (LINUX AND NOT DESKTOP_APP_USE_ENCHANT) 50 | OR DESKTOP_APP_USE_HUNSPELL_ONLY) 51 | set(add_hunspell_library 1) 52 | endif() 53 | 54 | set(add_cld3_library 0) 55 | if (LINUX OR DESKTOP_APP_USE_CLD3) 56 | set(add_cld3_library 1) 57 | endif() 58 | 59 | set(build_macstore 0) 60 | set(build_winstore 0) # x86 or x64 or arm 61 | set(build_win64 0) # normal or uwp 62 | set(build_winarm 0) # normal or uwp 63 | 64 | if (WIN32) 65 | if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64") 66 | set(build_win64 1) 67 | elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "winarm") 68 | set(build_winarm 1) 69 | elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") 70 | set(build_winstore 1) 71 | elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64") 72 | set(build_win64 1) 73 | set(build_winstore 1) 74 | elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwparm") 75 | set(build_winarm 1) 76 | set(build_winstore 1) 77 | elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) 78 | if (CMAKE_SYSTEM_PROCESSOR MATCHES "ARM") 79 | set(build_winarm 1) 80 | else() 81 | set(build_win64 1) 82 | endif() 83 | endif() 84 | elseif (APPLE) 85 | if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") 86 | set(build_macstore 1) 87 | endif() 88 | endif() 89 | 90 | #if (DESKTOP_APP_ASAN AND WIN32) 91 | # if (build_win64) 92 | # get_filename_component(libs_loc "../Libraries/asan-win64" REALPATH) 93 | # else() 94 | # get_filename_component(libs_loc "../Libraries/asan" REALPATH) 95 | # endif() 96 | #elseif (build_win64) 97 | if (build_win64) 98 | get_filename_component(libs_loc "../Libraries/win64" REALPATH) 99 | else() 100 | get_filename_component(libs_loc "../Libraries" REALPATH) 101 | endif() 102 | -------------------------------------------------------------------------------- /version.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | function(desktop_app_parse_version file) 8 | file(STRINGS ${file} lines) 9 | foreach (line ${lines}) 10 | string(REPLACE " " ";" parts ${line}) 11 | list(GET parts 0 name) 12 | if (${name} STREQUAL "AppVersionOriginal") 13 | list(LENGTH parts length) 14 | math(EXPR index "${length} - 1") 15 | list(GET parts ${index} version) 16 | break() 17 | endif() 18 | endforeach() 19 | 20 | if (NOT ${version} MATCHES "[0-9]+\.[0-9]+(\.[0-9]+(\.([0-9]+|beta))?)?") 21 | message(FATAL_ERROR "Bad version: ${version}, check ${file}") 22 | endif() 23 | 24 | message("Version: ${version}") 25 | 26 | set(beta 0) 27 | set(beta_bool "false") 28 | set(alpha 0) 29 | 30 | string(REPLACE "." ";" components ${version}) 31 | list(LENGTH components components_count) 32 | list(GET components 0 major) 33 | list(GET components 1 minor) 34 | if (${components_count} GREATER 2) 35 | list(GET components 2 patch) 36 | if (${components_count} GREATER 3) 37 | list(GET components 3 alpha) 38 | if (${alpha} STREQUAL beta) 39 | set(beta 1) 40 | set(beta_bool "true") 41 | set(alpha 0) 42 | endif() 43 | endif() 44 | else() 45 | set(patch 0) 46 | endif() 47 | 48 | if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") 49 | set(alpha 0) 50 | endif() 51 | 52 | math(EXPR version_int "${major} * 1000000 + ${minor} * 1000 + ${patch}") 53 | 54 | set(str_major ${major}.${minor}) 55 | set(str_normal ${str_major}.${patch}) 56 | if (${patch} STREQUAL 0) 57 | set(str_small ${str_major}) 58 | else() 59 | set(str_small ${str_normal}) 60 | endif() 61 | 62 | if (NOT ${alpha} STREQUAL 0) 63 | math(EXPR version_int_alpha "${version_int} * 1000 + ${alpha}") 64 | else() 65 | set(version_int_alpha 0) 66 | endif() 67 | set(version_dot ${str_normal}.${alpha}) 68 | string(REPLACE "." "," version_comma ${version_dot}) 69 | 70 | set(desktop_app_version_int ${version_int} PARENT_SCOPE) 71 | set(desktop_app_version_int_alpha ${version_int_alpha} PARENT_SCOPE) 72 | set(desktop_app_version_string ${str_normal} PARENT_SCOPE) 73 | set(desktop_app_version_string_small ${str_small} PARENT_SCOPE) 74 | set(desktop_app_version_beta_bool ${beta_bool} PARENT_SCOPE) 75 | set(desktop_app_version_dot ${version_dot} PARENT_SCOPE) 76 | set(desktop_app_version_comma ${version_dot} PARENT_SCOPE) 77 | set(desktop_app_version_cmake ${version_dot} PARENT_SCOPE) 78 | endfunction() 79 | -------------------------------------------------------------------------------- /win_directx_helper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of Desktop App Toolkit, 2 | # a set of libraries for developing nice desktop applications. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/desktop-app/legal/blob/master/LEGAL 6 | 7 | add_library(win_directx_helper STATIC) 8 | init_target(win_directx_helper "(external)") 9 | add_library(desktop-app::win_directx_helper ALIAS win_directx_helper) 10 | 11 | nice_target_sources(win_directx_helper ${CMAKE_CURRENT_SOURCE_DIR} 12 | PRIVATE 13 | win_directx_helper.cpp 14 | ) 15 | 16 | validate_d3d_compiler(win_directx_helper) 17 | 18 | target_link_libraries(win_directx_helper 19 | PUBLIC 20 | desktop-app::external_openssl 21 | ) 22 | 23 | if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") 24 | target_compile_definitions(win_directx_helper 25 | PRIVATE 26 | WIN_DIRECTX_HELPER_SPECIAL_TARGET=${DESKTOP_APP_SPECIAL_TARGET} 27 | ) 28 | endif() 29 | -------------------------------------------------------------------------------- /win_directx_helper/modules/x64/d3d/d3dcompiler_47.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desktop-app/cmake_helpers/3fa88ebd4a7e66cc8fbedeb11af4b8380d8b64a1/win_directx_helper/modules/x64/d3d/d3dcompiler_47.dll -------------------------------------------------------------------------------- /win_directx_helper/modules/x86/d3d/d3dcompiler_47.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/desktop-app/cmake_helpers/3fa88ebd4a7e66cc8fbedeb11af4b8380d8b64a1/win_directx_helper/modules/x86/d3d/d3dcompiler_47.dll -------------------------------------------------------------------------------- /win_directx_helper/win_directx_helper.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Desktop App Toolkit, 2 | // a set of libraries for developing nice desktop applications. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/desktop-app/legal/blob/master/LEGAL 6 | // 7 | 8 | #include 9 | #include 10 | #include 11 | extern "C" { 12 | #include 13 | } // extern "C" 14 | #include 15 | #include 16 | #include 17 | 18 | #define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func) 19 | 20 | namespace DirectX { 21 | namespace { 22 | 23 | constexpr auto kMaxPathLong = 32767; 24 | 25 | using Handle = HINSTANCE; 26 | 27 | // d3dcompiler_47.dll 28 | 29 | HRESULT (__stdcall *D3DCompile)( 30 | LPCVOID pSrcData, 31 | SIZE_T SrcDataSize, 32 | LPCSTR pFileName, 33 | CONST D3D_SHADER_MACRO* pDefines, 34 | ID3DInclude* pInclude, 35 | LPCSTR pEntrypoint, 36 | LPCSTR pTarget, 37 | UINT Flags1, 38 | UINT Flags2, 39 | ID3DBlob** ppCode, 40 | ID3DBlob** ppErrorMsgs); 41 | 42 | HRESULT (__stdcall *D3DDisassemble)( 43 | _In_reads_bytes_(SrcDataSize) LPCVOID pSrcData, 44 | _In_ SIZE_T SrcDataSize, 45 | _In_ UINT Flags, 46 | _In_opt_ LPCSTR szComments, 47 | _Out_ ID3DBlob** ppDisassembly); 48 | 49 | // d3d9.dll 50 | 51 | IDirect3D9 * (__stdcall *Direct3DCreate9)(UINT SDKVersion); 52 | int (__stdcall *D3DPERF_BeginEvent)(D3DCOLOR col, LPCWSTR wszName); 53 | int (__stdcall *D3DPERF_EndEvent)(void); 54 | void (__stdcall *D3DPERF_SetMarker)(D3DCOLOR col, LPCWSTR wszName); 55 | DWORD (__stdcall *D3DPERF_GetStatus)(void); 56 | 57 | // d3d11.dll 58 | 59 | HRESULT (__stdcall *D3D11CreateDevice)( 60 | _In_opt_ IDXGIAdapter* pAdapter, 61 | D3D_DRIVER_TYPE DriverType, 62 | HMODULE Software, 63 | UINT Flags, 64 | _In_reads_opt_(FeatureLevels) CONST D3D_FEATURE_LEVEL* pFeatureLevels, 65 | UINT FeatureLevels, 66 | UINT SDKVersion, 67 | _COM_Outptr_opt_ ID3D11Device** ppDevice, 68 | _Out_opt_ D3D_FEATURE_LEVEL* pFeatureLevel, 69 | _COM_Outptr_opt_ ID3D11DeviceContext** ppImmediateContext); 70 | 71 | // dxgi.dll 72 | 73 | HRESULT (__stdcall *CreateDXGIFactory)( 74 | REFIID riid, 75 | _COM_Outptr_ void **ppFactory); 76 | 77 | HRESULT (__stdcall *CreateDXGIFactory1)( 78 | REFIID riid, 79 | _COM_Outptr_ void **ppFactory); 80 | 81 | template 82 | inline bool LoadSymbol(Handle handle, const char *name, Function &func) { 83 | func = handle 84 | ? reinterpret_cast(GetProcAddress(handle, name)) 85 | : nullptr; 86 | return (func != nullptr); 87 | } 88 | 89 | // For win_directx_helper. 90 | std::string FileSha256(const wchar_t *path) { 91 | using uchar = unsigned char; 92 | constexpr auto kLimit = 10 * 1024 * 1024; 93 | auto buffer = std::vector(kLimit); 94 | auto size = DWORD(); 95 | 96 | const auto file = CreateFile( 97 | path, 98 | GENERIC_READ, 99 | FILE_SHARE_READ, 100 | nullptr, 101 | OPEN_EXISTING, 102 | FILE_ATTRIBUTE_NORMAL, 103 | nullptr); 104 | if (file == INVALID_HANDLE_VALUE) { 105 | return {}; 106 | } 107 | const auto read = ReadFile(file, buffer.data(), kLimit, &size, nullptr); 108 | CloseHandle(file); 109 | 110 | if (!read || !size || size >= kLimit) { 111 | return {}; 112 | } 113 | auto binary = std::array{}; 114 | SHA256(buffer.data(), size, binary.data()); 115 | const auto hex = [](uchar value) { 116 | return (value >= 10) ? ('a' + (value - 10)) : ('0' + value); 117 | }; 118 | auto result = std::string(); 119 | result.reserve(binary.size() * 2); 120 | for (const auto byte : binary) { 121 | result.push_back(hex(byte / 16)); 122 | result.push_back(hex(byte % 16)); 123 | } 124 | return result; 125 | } 126 | 127 | bool ResolveD3DCompiler(const wchar_t *path) { 128 | const auto d3dcompiler = LoadLibrary(path); 129 | return true 130 | && LOAD_SYMBOL(d3dcompiler, D3DCompile) 131 | && LOAD_SYMBOL(d3dcompiler, D3DDisassemble); 132 | } 133 | 134 | bool ResolveD3DCompiler() { 135 | static const auto loaded = [] { 136 | #ifdef DESKTOP_APP_D3DCOMPILER_HASH 137 | auto exePath = std::array{ { 0 } }; 138 | const auto exeLength = GetModuleFileName( 139 | nullptr, 140 | exePath.data(), 141 | kMaxPathLong + 1); 142 | if (!exeLength || exeLength >= kMaxPathLong + 1) { 143 | return false; 144 | } 145 | const auto exe = std::wstring(exePath.data()); 146 | const auto last1 = exe.find_last_of('\\'); 147 | const auto last2 = exe.find_last_of('/'); 148 | const auto last = std::max( 149 | (last1 == std::wstring::npos) ? -1 : int(last1), 150 | (last2 == std::wstring::npos) ? -1 : int(last2)); 151 | if (last < 0) { 152 | return false; 153 | } 154 | 155 | #if defined _WIN64 156 | const auto arch = L"x64"; 157 | #elif defined _WIN32 // _WIN64 158 | const auto arch = L"x86"; 159 | #else // _WIN64 || _WIN32 160 | #error "Invalid configuration." 161 | #endif // _WIN64 || _WIN32 162 | 163 | #define DESKTOP_APP_STRINGIFY2(x) #x 164 | #define DESKTOP_APP_STRINGIFY(x) DESKTOP_APP_STRINGIFY2(x) 165 | const auto hash = DESKTOP_APP_STRINGIFY(DESKTOP_APP_D3DCOMPILER_HASH); 166 | #undef DESKTOP_APP_STRINGIFY 167 | #undef DESKTOP_APP_STRINGIFY2 168 | 169 | const auto compiler = exe.substr(0, last + 1) 170 | + L"modules\\" + arch + L"\\d3d\\d3dcompiler_47.dll"; 171 | const auto path = compiler.c_str(); 172 | if (FileSha256(path) == hash && ResolveD3DCompiler(path)) { 173 | return true; 174 | } 175 | #elif defined WIN_DIRECTX_HELPER_SPECIAL_TARGET // DESKTOP_APP_D3DCOMPILER_HASH 176 | #error "Special target build should have d3dcompiler hash." 177 | #endif // !DESKTOP_APP_D3DCOMPILER_HASH && WIN_DIRECTX_HELPER_SPECIAL_TARGET 178 | 179 | return ResolveD3DCompiler(L"d3dcompiler_47.dll"); 180 | }(); 181 | return loaded; 182 | } 183 | 184 | bool ResolveD3D9() { 185 | static const auto loaded = [] { 186 | const auto d3d9 = LoadLibrary(L"d3d9.dll"); 187 | LOAD_SYMBOL(d3d9, D3DPERF_BeginEvent); 188 | LOAD_SYMBOL(d3d9, D3DPERF_EndEvent); 189 | LOAD_SYMBOL(d3d9, D3DPERF_SetMarker); 190 | LOAD_SYMBOL(d3d9, D3DPERF_GetStatus); 191 | return ResolveD3DCompiler() 192 | && LOAD_SYMBOL(d3d9, Direct3DCreate9); 193 | }(); 194 | return loaded; 195 | } 196 | 197 | bool ResolveD3D11() { 198 | static const auto loaded = [] { 199 | const auto d3d11 = LoadLibrary(L"d3d11.dll"); 200 | return ResolveD3DCompiler() 201 | && LOAD_SYMBOL(d3d11, D3D11CreateDevice); 202 | }(); 203 | return loaded; 204 | } 205 | 206 | bool ResolveDXGI() { 207 | static const auto loaded = [&] { 208 | const auto dxgi = LoadLibrary(L"dxgi.dll"); 209 | LOAD_SYMBOL(dxgi, CreateDXGIFactory1); 210 | return true 211 | && LOAD_SYMBOL(dxgi, CreateDXGIFactory); 212 | }(); 213 | return loaded; 214 | } 215 | 216 | } // namespace 217 | } // namespace DirectX 218 | 219 | bool DirectXResolveCompiler() { 220 | return DirectX::ResolveD3DCompiler(); 221 | } 222 | 223 | namespace D = DirectX; 224 | 225 | extern "C" { 226 | 227 | IDirect3D9 * WINAPI Direct3DCreate9(UINT SDKVersion) { 228 | return D::ResolveD3D9() 229 | ? D::Direct3DCreate9(SDKVersion) 230 | : nullptr; 231 | } 232 | 233 | int WINAPI D3DPERF_BeginEvent(D3DCOLOR col, LPCWSTR wszName) { 234 | return (D::ResolveD3D9() && D::D3DPERF_BeginEvent) 235 | ? D::D3DPERF_BeginEvent(col, wszName) 236 | : -1; 237 | } 238 | 239 | int WINAPI D3DPERF_EndEvent(void) { 240 | return (D::ResolveD3D9() && D::D3DPERF_EndEvent) 241 | ? D::D3DPERF_EndEvent() 242 | : -1; 243 | } 244 | 245 | void WINAPI D3DPERF_SetMarker(D3DCOLOR col, LPCWSTR wszName) { 246 | if (D::ResolveD3D9() && D::D3DPERF_SetMarker) { 247 | D::D3DPERF_SetMarker(col, wszName); 248 | } 249 | } 250 | 251 | DWORD WINAPI D3DPERF_GetStatus(void) { 252 | return (D::ResolveD3D9() && D::D3DPERF_GetStatus) 253 | ? D::D3DPERF_GetStatus() 254 | : 0; 255 | } 256 | 257 | HRESULT WINAPI D3D11CreateDevice( 258 | _In_opt_ IDXGIAdapter* pAdapter, 259 | D3D_DRIVER_TYPE DriverType, 260 | HMODULE Software, 261 | UINT Flags, 262 | _In_reads_opt_(FeatureLevels) CONST D3D_FEATURE_LEVEL* pFeatureLevels, 263 | UINT FeatureLevels, 264 | UINT SDKVersion, 265 | _COM_Outptr_opt_ ID3D11Device** ppDevice, 266 | _Out_opt_ D3D_FEATURE_LEVEL* pFeatureLevel, 267 | _COM_Outptr_opt_ ID3D11DeviceContext** ppImmediateContext) { 268 | return D::ResolveD3D11() 269 | ? D::D3D11CreateDevice( 270 | pAdapter, 271 | DriverType, 272 | Software, 273 | Flags, 274 | pFeatureLevels, 275 | FeatureLevels, 276 | SDKVersion, 277 | ppDevice, 278 | pFeatureLevel, 279 | ppImmediateContext) 280 | : CO_E_DLLNOTFOUND; 281 | } 282 | 283 | HRESULT WINAPI CreateDXGIFactory( 284 | REFIID riid, 285 | _COM_Outptr_ void **ppFactory) { 286 | return D::ResolveDXGI() 287 | ? D::CreateDXGIFactory(riid, ppFactory) 288 | : CO_E_DLLNOTFOUND; 289 | } 290 | 291 | HRESULT WINAPI CreateDXGIFactory1( 292 | REFIID riid, 293 | _COM_Outptr_ void **ppFactory) { 294 | return (D::ResolveDXGI() && D::CreateDXGIFactory1) 295 | ? D::CreateDXGIFactory1(riid, ppFactory) 296 | : CO_E_DLLNOTFOUND; 297 | } 298 | 299 | } // extern "C" 300 | --------------------------------------------------------------------------------