diff --git a/CHANGELOG.md b/CHANGELOG.md index 4544df17a..826b436d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - Dev: Fix qtkeychain include for Qt6 users. (#4863) - Dev: Add a compile-time flag `CHATTERINO_UPDATER` which can be turned off to disable update checks. (#4854) - Dev: Add a compile-time flag `USE_SYSTEM_MINIAUDIO` which can be turned on to use the system miniaudio. (#4867) +- Dev: Update vcpkg to use Qt6. (#4872) ## 2.4.6 diff --git a/CMakeLists.txt b/CMakeLists.txt index d3ebd4c5e..52c27a746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/sanitizers-cmake/cmake" ) -project(chatterino VERSION 2.4.6) - option(BUILD_APP "Build Chatterino" ON) option(BUILD_TESTS "Build the tests for Chatterino" OFF) option(BUILD_BENCHMARKS "Build the benchmarks for Chatterino" OFF) @@ -45,6 +43,15 @@ else() set(MAJOR_QT_VERSION "5") endif() +if(BUILD_TESTS) + list(APPEND VCPKG_MANIFEST_FEATURES "tests") +endif() +if(BUILD_BENCHMARKS) + list(APPEND VCPKG_MANIFEST_FEATURES "benchmarks") +endif() + +project(chatterino VERSION 2.4.6) + find_program(CCACHE_PROGRAM ccache) find_program(SCCACHE_PROGRAM sccache) if (SCCACHE_PROGRAM) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 936384f19..9ea5cb930 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -768,35 +768,51 @@ if (BUILD_APP) set_target_directory_hierarchy(${EXECUTABLE_PROJECT}) if (WIN32) - if (NOT WINDEPLOYQT_PATH) - get_target_property(Qt_Core_Location Qt${MAJOR_QT_VERSION}::Core LOCATION) - get_filename_component(QT_BIN_DIR ${Qt_Core_Location} DIRECTORY) - string(APPEND WINDEPLOYQT_PATH ${QT_BIN_DIR} /windeployqt.exe) - else() + if (WINDEPLOYQT_PATH) file(TO_CMAKE_PATH "${WINDEPLOYQT_PATH}" WINDEPLOYQT_PATH) + else() + if (VCPKG_INSTALLED_DIR AND (CMAKE_BUILD_TYPE STREQUAL "Debug")) + find_program(WINDEPLOYQT_PATH NAMES windeployqt.debug.bat) + else() + find_program(WINDEPLOYQT_PATH NAMES windeployqt) + endif() + endif() + + if (NOT EXISTS ${WINDEPLOYQT_PATH}) + message(FATAL_ERROR "windeployqt.exe not found") endif() if (CMAKE_BUILD_TYPE STREQUAL "Debug") set(WINDEPLOYQT_MODE --debug) + get_target_property(QT_CORE_LOC Qt${MAJOR_QT_VERSION}::Core LOCATION_DEBUG) else() set(WINDEPLOYQT_MODE --release) + get_target_property(QT_CORE_LOC Qt${MAJOR_QT_VERSION}::Core LOCATION) endif() + get_filename_component(QT_BIN_DIR ${QT_CORE_LOC} DIRECTORY) set(WINDEPLOYQT_COMMAND_ARGV "${WINDEPLOYQT_PATH}" "$" ${WINDEPLOYQT_MODE} --no-compiler-runtime --no-translations --no-opengl-sw) string(REPLACE ";" " " WINDEPLOYQT_COMMAND "${WINDEPLOYQT_COMMAND_ARGV}") - if (X_VCPKG_APPLOCAL_DEPS_INSTALL) - install(TARGETS ${EXECUTABLE_PROJECT} RUNTIME DESTINATION .) - else() - install(TARGETS ${EXECUTABLE_PROJECT} - RUNTIME_DEPENDENCIES - PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" - POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" - DIRECTORIES ${QT_BIN_DIR} - RUNTIME DESTINATION .) - install(CODE "message(\"-- Running: ${WINDEPLOYQT_COMMAND} --dir \\\"\${CMAKE_INSTALL_PREFIX}\\\"\")") - install(CODE "execute_process(COMMAND ${WINDEPLOYQT_COMMAND} --dir \"\${CMAKE_INSTALL_PREFIX}\" COMMAND_ERROR_IS_FATAL ANY)") - endif() + install(TARGETS ${EXECUTABLE_PROJECT} + RUNTIME_DEPENDENCIES + PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" + POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" + DIRECTORIES ${QT_BIN_DIR} + RUNTIME DESTINATION .) + + # Hardcoded list of DLLs to install from Qt - these are marked as optional since they only exist for vcpkg + install(FILES + ${QT_BIN_DIR}/jpeg62.dll + ${QT_BIN_DIR}/libwebpdemux.dll + ${QT_BIN_DIR}/libwebpmux.dll + ${QT_BIN_DIR}/libwebp.dll + ${QT_BIN_DIR}/libsharpyuv.dll + DESTINATION . + OPTIONAL) + + install(CODE "message(\"-- Running: ${WINDEPLOYQT_COMMAND} --dir \\\"\${CMAKE_INSTALL_PREFIX}\\\"\")") + install(CODE "execute_process(COMMAND ${WINDEPLOYQT_COMMAND} --dir \"\${CMAKE_INSTALL_PREFIX}\" COMMAND_ERROR_IS_FATAL ANY)") elseif (APPLE) install(TARGETS ${EXECUTABLE_PROJECT} RUNTIME DESTINATION bin diff --git a/vcpkg.json b/vcpkg.json index 99aa00b38..ed80080e5 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,23 +2,47 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "chatterino", "version": "2.0.0", - "builtin-baseline": "43f56137beabcd470ac2650cdf3954761f65b70e", + "builtin-baseline": "c6d6efed3e9b4242765bfe1b5c5befffd85f7b92", "dependencies": [ - "benchmark", "boost-asio", "boost-circular-buffer", "boost-foreach", "boost-interprocess", "boost-signals2", "boost-variant", - "gtest", - "openssl", - "qt5-tools" - ], - "overrides": [ { - "name": "openssl", - "version-string": "1.1.1n" + "name": "qt5compat", + "default-features": false, + "features": ["textcodec"] + }, + { + "name": "qtbase", + "default-features": false, + "features": [ + "concurrent", + "gui", + "jpeg", + "network", + "openssl", + "png", + "widgets" + ] + }, + { + "name": "qtimageformats", + "default-features": false, + "features": ["webp"] + }, + "qtsvg" + ], + "features": { + "benchmarks": { + "description": "Build benchamarks", + "dependencies": ["benchmark"] + }, + "tests": { + "description": "Build tests", + "dependencies": ["gtest"] } - ] + } }