Skip to content

Commit

Permalink
Update vcpkg to Qt6 (#4872)
Browse files Browse the repository at this point in the history
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
  • Loading branch information
kornes and pajlada authored Oct 7, 2023
1 parent 7528257 commit ab4a0c0
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 29 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
50 changes: 33 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}" "$<TARGET_FILE:${EXECUTABLE_PROJECT}>" ${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
Expand Down
44 changes: 34 additions & 10 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
]
}
}

0 comments on commit ab4a0c0

Please sign in to comment.