build(cmake): always use MultiThreadedDLL msvc runtime library

This allows users of development builds to (once again) run the launcher
without the Windows SDK installed

Signed-off-by: Seth Flynn <getchoo@tuta.io>
This commit is contained in:
Seth Flynn 2026-03-17 20:34:03 -04:00
parent 01a4a6a528
commit 95aaedd333
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
4 changed files with 29 additions and 3 deletions

View file

@ -31,6 +31,12 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
include(GenerateExportHeader) include(GenerateExportHeader)
# NOTE: We can't statically link with the MSVC runtime due to GPL restrictions
#
# We also purposefully choose not to use the debug DLL, as that would require
# users of our development builds to install the Windows SDK
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
add_compile_definitions($<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>) add_compile_definitions($<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
add_compile_definitions(QT_WARN_DEPRECATED_UP_TO=0x060400) add_compile_definitions(QT_WARN_DEPRECATED_UP_TO=0x060400)
add_compile_definitions(QT_DISABLE_DEPRECATED_UP_TO=0x060400) add_compile_definitions(QT_DISABLE_DEPRECATED_UP_TO=0x060400)
@ -312,9 +318,8 @@ endif()
## NOTE(@getchoo): Never use pkg-config with MSVC since the vcpkg port makes our install bundle fail to find the dll ## NOTE(@getchoo): Never use pkg-config with MSVC since the vcpkg port makes our install bundle fail to find the dll
if(MSVC) if(MSVC)
find_path(LIBQRENCODE_INCLUDE_DIR qrencode.h REQUIRED) find_path(LIBQRENCODE_INCLUDE_DIR qrencode.h REQUIRED)
find_library(LIBQRENCODE_LIBRARY_RELEASE qrencode REQUIRED) find_library(LIBQRENCODE_LIBRARY qrencode REQUIRED)
find_library(LIBQRENCODE_LIBRARY_DEBUG qrencoded) set(LIBQRENCODE_LIBRARIES ${LIBQRENCODE_LIBRARY})
set(LIBQRENCODE_LIBRARIES optimized ${LIBQRENCODE_LIBRARY_RELEASE} debug ${LIBQRENCODE_LIBRARY_DEBUG})
else() else()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(libqrencode REQUIRED IMPORTED_TARGET libqrencode) pkg_check_modules(libqrencode REQUIRED IMPORTED_TARGET libqrencode)

View file

@ -0,0 +1,10 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
# NOTE: This is the only change we're making to the default target
#
# Avoid using the debug VCRUNTIME. Otherwise, this would introduce the Windows SDK
# as a requirement for testers :(
# We also don't really need the debug versions of our libraries anyways
set(VCPKG_BUILD_TYPE release)

View file

@ -0,0 +1,10 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
# NOTE: This is the only change we're making to the default target
#
# Avoid using the debug VCRUNTIME. Otherwise, this would introduce the Windows SDK
# as a requirement for testers :(
# We also don't really need the debug versions of our libraries anyways
set(VCPKG_BUILD_TYPE release)

View file

@ -1604,6 +1604,7 @@ if(WIN32 OR (UNIX AND APPLE))
COMPONENT bundle COMPONENT bundle
DIRECTORIES DIRECTORIES
${CMAKE_SYSTEM_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH}
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin
${QT_LIBS_DIR} ${QT_LIBS_DIR}
${QT_LIBEXECS_DIR} ${QT_LIBEXECS_DIR}
PRE_EXCLUDE_REGEXES PRE_EXCLUDE_REGEXES