mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Add CMake Install Support for Windows (#4300)
* fix: windows installation with cmake * fix: support install for all win32 compilers * chore: add changelog entry * fix: support `X_VCPKG_APPLOCAL_DEPS_INSTALL` * chore: document cmake min version * fix: vcpkg * fix: plugin path * fix: remove flattening * revert: `qt.conf` changes --------- Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
4958d08036
commit
633b77511d
2 changed files with 26 additions and 7 deletions
|
@ -41,6 +41,7 @@
|
|||
- Dev: Fixed `final-dtor-non-final-class` warnings. (#4296)
|
||||
- Dev: Fixed `ambiguous-reversed-operator` warnings. (#4296)
|
||||
- Dev: Format YAML and JSON files with prettier. (#4304)
|
||||
- Dev: Addded CMake Install Support on Windows. (#4300)
|
||||
|
||||
## 2.4.0
|
||||
|
||||
|
|
|
@ -651,17 +651,35 @@ if (BUILD_APP)
|
|||
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin"
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
if (NOT VCPKG_INSTALLED_DIR)
|
||||
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)
|
||||
set(WINDEPLOYQT_COMMAND "${QT_BIN_DIR}/windeployqt.exe" $<TARGET_FILE:${EXECUTABLE_PROJECT}> --release --no-compiler-runtime --no-translations --no-opengl-sw)
|
||||
string(APPEND WINDEPLOYQT_PATH ${QT_BIN_DIR} /windeployqt.exe)
|
||||
else()
|
||||
file(TO_CMAKE_PATH "${WINDEPLOYQT_PATH}" WINDEPLOYQT_PATH)
|
||||
endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(WINDEPLOYQT_MODE --debug)
|
||||
else()
|
||||
set(WINDEPLOYQT_MODE --release)
|
||||
endif()
|
||||
|
||||
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 DESTINATION .
|
||||
)
|
||||
|
||||
install(CODE "execute_process(COMMAND ${WINDEPLOYQT_COMMAND} --dir \${CMAKE_INSTALL_PREFIX})")
|
||||
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()
|
||||
elseif (APPLE)
|
||||
install(TARGETS ${EXECUTABLE_PROJECT}
|
||||
|
|
Loading…
Reference in a new issue