Skip to content

Commit

Permalink
Merge branch 'feature/try_fix_qt'
Browse files Browse the repository at this point in the history
  • Loading branch information
CJCombrink committed Apr 4, 2024
2 parents 98563e7 + 7879813 commit f7fa707
Showing 1 changed file with 100 additions and 18 deletions.
118 changes: 100 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: Build SpellChecker-Plugin
on: [push]

env:
QT_VERSION: "6.4.2"
QT_VERSION: "6.6.2"
QT_CREATOR_VERSION: "13.0.0"
QT_MIRRORS: download.qt.io;mirrors.ocf.berkeley.edu/qt;ftp.fau.de/qtproject;mirror.bit.edu.cn/qtproject

Expand Down Expand Up @@ -106,10 +106,17 @@ jobs:

steps:
# Checks-out your repository under $GITHUB_WORKSPACE/SpellChecker-Plugin, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: SpellChecker-Plugin

# Just get the Qt Creator sources as well under $GITHUB_WORKSPACE/qtc_src, so your job can access it
- uses: actions/checkout@v4
with:
repository: qt-creator/qt-creator
ref: "v${{ env.QT_CREATOR_VERSION }}"
path: qtc_src

- name: System Packages
shell: pwsh
run: |
Expand All @@ -130,50 +137,88 @@ jobs:
shell: cmake -P {0}
run: |
set(qt_version "$ENV{QT_VERSION}")
string(REPLACE "." "" qt_version_dotless "${qt_version}")
if ("${{ runner.os }}" STREQUAL "Windows")
set(url_os "windows_x86")
set(qt_package_arch_suffix "win64_msvc2019_64")
set(qt_dir_prefix "${qt_version}/msvc2019_64")
set(qt_package_suffix "-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64")
if ("x${{ matrix.config.environment_script }}" STREQUAL "x")
set(qt_package_arch_suffix "win64_mingw")
set(qt_dir_prefix "${qt_version}/mingw_64")
set(qt_package_suffix "-Windows-Windows_10_22H2-Mingw-Windows-Windows_10_22H2-X86_64")
elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
set(qt_package_arch_suffix "win64_msvc2019_64")
set(qt_dir_prefix "${qt_version}/msvc2019_64")
set(qt_package_suffix "-Windows-Windows_10_22H2-MSVC2019-Windows-Windows_10_22H2-X86_64")
endif()
elseif ("${{ runner.os }}" STREQUAL "Linux")
set(url_os "linux_x64")
set(qt_package_arch_suffix "gcc_64")
set(qt_dir_prefix "${qt_version}/gcc_64")
set(qt_package_suffix "-Linux-RHEL_8_4-GCC-Linux-RHEL_8_4-X86_64")
set(qt_package_suffix "-Linux-RHEL_8_8-GCC-Linux-RHEL_8_8-X86_64")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(url_os "mac_x64")
set(qt_package_arch_suffix "clang_64")
set(qt_dir_prefix "${qt_version}/macos")
set(qt_package_suffix "-MacOS-MacOS_12-Clang-MacOS-MacOS_12-X86_64-ARM64")
set(qt_package_suffix "-MacOS-MacOS_13-Clang-MacOS-MacOS_13-X86_64-ARM64")
endif()
set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}")
file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS)
set(qt_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}")
foreach(qt_mirror $ENV{QT_MIRRORS})
cmake_language(EVAL CODE "
message(\"Downloading: ${qt_base_url}/Updates.xml\")
file(DOWNLOAD \"${qt_base_url}/Updates.xml\" ./Updates.xml)
")
file(SIZE ./Updates.xml fileSize)
if (fileSize GREATER 0)
break()
endif()
endforeach()
file(READ ./Updates.xml updates_xml)
string(REGEX MATCH "<Name>qt.qt6.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}")
set(qt_package_version ${CMAKE_MATCH_1})
file(MAKE_DIRECTORY qt)
file(MAKE_DIRECTORY qt6)
# Save the path for other steps
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt/${qt_dir_prefix}" qt_dir)
message("::set-output name=qt_dir::${qt_dir}")
message("Downloading Qt to ${qt_dir}")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt6/${qt_dir_prefix}" qt_dir)
file(APPEND "$ENV{GITHUB_OUTPUT}" "qt_dir=${qt_dir}")
function(downloadAndExtract url archive)
message("Downloading ${url}")
file(DOWNLOAD "${url}" ./${archive} SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt)
foreach(qt_mirror $ENV{QT_MIRRORS})
cmake_language(EVAL CODE "
message(\"Downloading ${url}\")
file(DOWNLOAD \"${url}\" ./${archive})
")
file(SIZE ./${archive} fileSize)
if (fileSize GREATER 0)
break()
endif()
endforeach()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt6)
endfunction()
foreach(package qtbase qtdeclarative)
foreach(package qtbase qtdeclarative qttools qtsvg qttranslations)
downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z
)
endforeach()
foreach(package qt5compat qtshadertools)
foreach(package qtimageformats qtserialport)
downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.addons.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z
)
endforeach()
foreach(package qtquicktimeline qtquick3d qt5compat qtshadertools)
downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z
)
endforeach()
# uic depends on libicu56.so
if ("${{ runner.os }}" STREQUAL "Linux")
downloadAndExtract(
Expand All @@ -182,6 +227,32 @@ jobs:
)
endif()
file(READ "qt6/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig)
string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}")
string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}")
string(REPLACE "licheck64" "" qtconfig "${qtconfig}")
string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}")
file(WRITE "qt6/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}")
if ("${{ runner.os }}" STREQUAL "Windows")
# deploy "system" runtimes into Qt, so they get deployed as well
if ("x${{ matrix.config.environment_script }}" STREQUAL "x")
# deploy MinGW
foreach(file libwinpthread-1.dll libstdc++-6.dll libgcc_s_seh-1.dll)
file(INSTALL "$ENV{GITHUB_WORKSPACE}/${{ matrix.config.toolchain_path }}/${file}"
DESTINATION "qt6/${qt_dir_prefix}/bin"
USE_SOURCE_PERMISSIONS)
endforeach()
else()
# deploy MSVC
foreach(file vcruntime140.dll concrt140.dll msvcp140_1.dll msvcp140_2.dll
msvcp140_codecvt_ids.dll vcruntime140_1.dll msvcp140.dll)
file(INSTALL "C:/Windows/System32/${file}"
DESTINATION "qt6/${qt_dir_prefix}/bin")
endforeach()
endif()
endif()
- name: Download Qt Creator
id: qt_creator
shell: cmake -P {0}
Expand Down Expand Up @@ -211,6 +282,16 @@ jobs:
${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qtcreator)
endforeach()
if ("${{ runner.os }}" STREQUAL "macOS")
file(COPY
"qtc_src/src/libs/3rdparty/syntax-highlighting/autogenerated/include/KSyntaxHighlighting/"
DESTINATION "qtcreator/Qt Creator.app/Contents/Resources/Headers/qtcreator/src/libs/3rdparty/syntax-highlighting/autogenerated/include/KSyntaxHighlighting/")
else()
file(COPY
"qtc_src/src/libs/3rdparty/syntax-highlighting/autogenerated/include/KSyntaxHighlighting/"
DESTINATION "qtcreator/include/qtcreator/src/libs/3rdparty/syntax-highlighting/autogenerated/include/KSyntaxHighlighting/")
endif()
- name: Build Plugin
shell: pwsh
run: |
Expand Down Expand Up @@ -243,6 +324,7 @@ jobs:
cmake --preset "${env:CMAKE_PRESET}" `
-DCMAKE_PREFIX_PATH="${{ steps.qt.outputs.qt_dir }};${{ steps.qt_creator.outputs.qtc_dir }}${prefix_extra}" `
-DCMAKE_INCLUDE_PATH="${env:GITHUB_WORKSPACE}/qtc_src/src/libs/3rdparty/syntax-highlighting/autogenerated/include"
cmake --build --preset conan-release
Expand Down

0 comments on commit f7fa707

Please sign in to comment.