Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 43 additions & 53 deletions package-system/Qt/FindQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ if(NOT EXISTS ${QT_PATH})
endif()

# Force-set QtCore's version here to ensure CMake detects Qt's existence and allows AUTOMOC to work
set(Qt5Core_VERSION_MAJOR "5" CACHE STRING "Qt's major version" FORCE)
set(Qt5Core_VERSION_MINOR "15" CACHE STRING "Qt's minor version" FORCE)
set(Qt5Core_VERSION_PATCH "2" CACHE STRING "Qt's patch version" FORCE)
mark_as_advanced(Qt5Core_VERSION_MAJOR)
mark_as_advanced(Qt5Core_VERSION_MINOR)
mark_as_advanced(Qt5Core_VERSION_PATCH)

set(QT5_COMPONENTS
set(Qt6Core_VERSION_MAJOR "6" CACHE STRING "Qt's major version" FORCE)
set(Qt6Core_VERSION_MINOR "9" CACHE STRING "Qt's minor version" FORCE)
set(Qt6Core_VERSION_PATCH "1" CACHE STRING "Qt's patch version" FORCE)
mark_as_advanced(Qt6Core_VERSION_MAJOR)
mark_as_advanced(Qt6Core_VERSION_MINOR)
mark_as_advanced(Qt6Core_VERSION_PATCH)

set(QT6_COMPONENTS
Core
Concurrent
Gui
LinguistTools
# LinguistTools
Network
OpenGL
Svg
Expand All @@ -41,47 +41,42 @@ set(QT5_COMPONENTS

include(${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}/Qt_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)

list(APPEND CMAKE_PREFIX_PATH ${QT_LIB_PATH}/cmake/Qt5)
list(APPEND CMAKE_PREFIX_PATH ${QT_LIB_PATH}/cmake/Qt6)

# Clear the cache for found DIRs
unset(Qt5_DIR CACHE)
foreach(component ${QT5_COMPONENTS})
unset(Qt5${component}_DIR CACHE)
unset(Qt6_DIR CACHE)
foreach(component ${QT6_COMPONENTS})
unset(Qt6${component}_DIR CACHE)
endforeach()
unset(Qt5Positioning_DIR CACHE)
unset(Qt5PrintSupport_DIR CACHE)
unset(Qt5Qml_DIR CACHE)
unset(Qt5QmlModels_DIR CACHE)
unset(Qt5Quick_DIR CACHE)

# Populate the Qt5 configurations
find_package(Qt5
COMPONENTS ${QT5_COMPONENTS}

# Populate the Qt6 configurations
find_package(Qt6
COMPONENTS ${QT6_COMPONENTS}
REQUIRED
NO_CMAKE_PACKAGE_REGISTRY
)

# Now create libraries that wrap the dependency so we can refer to them in our format
foreach(component ${QT5_COMPONENTS})
if(TARGET Qt5::${component})
foreach(component ${QT6_COMPONENTS})
if(TARGET Qt6::${component})

# Convert the includes to system includes
get_target_property(system_includes Qt5::${component} INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(Qt5::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "") # Clear it in case someone refers to it
ly_target_include_system_directories(TARGET Qt5::${component}
get_target_property(system_includes Qt6::${component} INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(Qt6::${component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "") # Clear it in case someone refers to it
ly_target_include_system_directories(TARGET Qt6::${component}
INTERFACE ${system_includes}
)

# Alias the target with our prefix
add_library(3rdParty::Qt::${component} ALIAS Qt5::${component})
mark_as_advanced(Qt5${component}_DIR) # Hiding from GUI
add_library(3rdParty::Qt::${component} ALIAS Qt6::${component})
mark_as_advanced(Qt6${component}_DIR) # Hiding from GUI

# Qt only has debug and release, we map the configurations we use in o3de. We map all the configurations
# except debug to release
foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER ${conf} UCONF)
ly_qt_configuration_mapping(${UCONF} MAPPED_CONF)
set_target_properties(Qt5::${component} PROPERTIES
set_target_properties(Qt6::${component} PROPERTIES
MAP_IMPORTED_CONFIG_${UCONF} ${MAPPED_CONF}
)
endforeach()
Expand All @@ -90,22 +85,17 @@ foreach(component ${QT5_COMPONENTS})
endforeach()

# Some extra DIR variables we want to hide from GUI
mark_as_advanced(Qt5_DIR) # Hiding from GUI
mark_as_advanced(Qt5LinguistTools_DIR) # Hiding from GUI, this variable comes from the LinguistTools module
mark_as_advanced(Qt5Positioning_DIR)
mark_as_advanced(Qt5PrintSupport_DIR)
mark_as_advanced(Qt5Qml_DIR)
mark_as_advanced(Qt5QmlModels_DIR)
mark_as_advanced(Qt5Quick_DIR)
mark_as_advanced(Qt6_DIR) # Hiding from GUI
# mark_as_advanced(Qt6LinguistTools_DIR) # Hiding from GUI, this variable comes from the LinguistTools module

# Special case for Qt::Gui, we are using the private headers...
ly_target_include_system_directories(TARGET Qt5::Gui
INTERFACE "${Qt5Gui_PRIVATE_INCLUDE_DIRS}"
ly_target_include_system_directories(TARGET Qt6::Gui
INTERFACE "${Qt6Gui_PRIVATE_INCLUDE_DIRS}"
)

# Another special case: Qt:Widgets, we are also using private headers
ly_target_include_system_directories(TARGET Qt5::Widgets
INTERFACE "${Qt5Widgets_PRIVATE_INCLUDE_DIRS}"
ly_target_include_system_directories(TARGET Qt6::Widgets
INTERFACE "${Qt6Widgets_PRIVATE_INCLUDE_DIRS}"
)

# Qt plugins/translations/aux files.
Expand All @@ -120,7 +110,7 @@ if(tranlation_files)
OUTPUT_SUBDIRECTORY translations
)
endif()
ly_add_dependencies(Qt5::Core 3rdParty::Qt::Core::Translations)
ly_add_dependencies(Qt6::Core 3rdParty::Qt::Core::Translations)

# plugins, each platform will define the files it has and the OUTPUT_SUBDIRECTORY
set(QT_PLUGINS
Expand All @@ -130,7 +120,7 @@ set(QT_PLUGINS
)
foreach(plugin ${QT_PLUGINS})
add_library(3rdParty::Qt::${plugin}::Plugins INTERFACE IMPORTED GLOBAL)
ly_add_dependencies(Qt5::${plugin} 3rdParty::Qt::${plugin}::Plugins)
ly_add_dependencies(Qt6::${plugin} 3rdParty::Qt::${plugin}::Plugins)
endforeach()
include(${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}/QtPlugin_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)

Expand All @@ -143,24 +133,24 @@ mark_as_advanced(QT_UIC_EXECUTABLE) # Hiding from GUI
unset(AUTORCC_EXECUTABLE CACHE)
find_program(AUTORCC_EXECUTABLE rcc HINTS "${QT_PATH}/bin")
mark_as_advanced(AUTORCC_EXECUTABLE) # Hiding from GUI
set(Qt5Core_RCC_EXECUTABLE "${AUTORCC_EXECUTABLE}" CACHE FILEPATH "Qt's resource compiler, used by qt5_add_resources" FORCE)
mark_as_advanced(Qt5Core_RCC_EXECUTABLE) # Hiding from GUI
set(Qt6Core_RCC_EXECUTABLE "${AUTORCC_EXECUTABLE}" CACHE FILEPATH "Qt's resource compiler, used by qt_add_resources" FORCE)
mark_as_advanced(Qt6Core_RCC_EXECUTABLE) # Hiding from GUI

# LRELEASE executable
unset(QT_LRELEASE_EXECUTABLE CACHE)
find_program(QT_LRELEASE_EXECUTABLE lrelease HINTS "${QT_PATH}/bin")
mark_as_advanced(QT_LRELEASE_EXECUTABLE) # Hiding from GUI
if(NOT QT_LRELEASE_EXECUTABLE)
message(FATAL_ERROR "Qt's lrelease executbale not found")
endif()
set(Qt5_LRELEASE_EXECUTABLE "${QT_LRELEASE_EXECUTABLE}" CACHE FILEPATH "Qt's lrelease executable, used by qt5_add_translation" FORCE)
mark_as_advanced(Qt5_LRELEASE_EXECUTABLE) # Hiding from GUI
#if(NOT QT_LRELEASE_EXECUTABLE)
# message(FATAL_ERROR "Qt's lrelease executbale not found")
#endif()
set(Qt6_LRELEASE_EXECUTABLE "${QT_LRELEASE_EXECUTABLE}" CACHE FILEPATH "Qt's lrelease executable, used by qt_add_translation" FORCE)
mark_as_advanced(Qt6_LRELEASE_EXECUTABLE) # Hiding from GUI

#! ly_qt_uic_target: handles qt's ui files by injecting uic generation
#
# AUTOUIC has issues to detect changes in UIC files and trigger regeneration:
# https://gitlab.kitware.com/cmake/cmake/-/issues/18741
# So instead, we are going to manually wrap the files. We dont use qt5_wrap_ui because
# So instead, we are going to manually wrap the files. We dont use qt_wrap_ui because
# it outputs to ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h and we want to follow the
# same folder structure that AUTOUIC uses
#
Expand Down Expand Up @@ -253,7 +243,7 @@ function(ly_add_translations)
message(FATAL_ERROR "You must provide at least a translation file")
endif()

qt5_add_translation(TRANSLATED_FILES ${ly_add_translations_FILES})
# qt_add_translation(TRANSLATED_FILES ${ly_add_translations_FILES})

set(qrc_file_contents
"<RCC>
Expand All @@ -279,7 +269,7 @@ function(ly_add_translations)
GENERATED TRUE
SKIP_AUTORCC TRUE
)
qt5_add_resources(RESOURCE_FILE ${qrc_file_path})
qt_add_resources(RESOURCE_FILE ${qrc_file_path})

foreach(target ${ly_add_translations_TARGETS})
target_sources(${target} PRIVATE "${TRANSLATED_FILES};${qrc_file_path};${RESOURCE_FILE}")
Expand Down
52 changes: 10 additions & 42 deletions package-system/Qt/build-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ REM SPDX-License-Identifier: Apache-2.0 OR MIT
REM

REM Set these before running the script
if not defined VCVARS_PATH set VCVARS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
if not defined QTARRAY set QTARRAY=(qtbase,qtgraphicaleffects,qtimageformats,qtsvg,qttools,qtwinextras)
if not defined VCVARS_PATH set VCVARS_PATH="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
if not defined QTARRAY set QTARRAY=qtbase,qtimageformats,qtsvg

REM TEMP_FOLDER and TARGET_INSTALL_ROOT get set from the pull_and_build_from_git.py script
set CHECKS_FAILED=0
Expand All @@ -23,69 +23,37 @@ for %%P IN (VCVARS_PATH,TEMP_FOLDER,TARGET_INSTALL_ROOT) do (

if %CHECKS_FAILED%==1 goto FAILURE

echo Setting up VS2019
echo Setting up VS2022
call %VCVARS_PATH% amd64

REM We need jom and ICU to build on Windows
set JOM_PATH=%TEMP_FOLDER%\jom
set ICU_PATH=%TEMP_FOLDER%\icu\bin64

set PATH=%PATH%;%JOM_PATH%;%ICU_PATH%

REM The Qt source directory will get cloned into a local temp\src folder
set BUILD_ROOT=%TEMP_FOLDER%\src
set BUILD_PATH=%BUILD_ROOT%\qtbase
set BUILD_PATH=%TEMP_FOLDER%\build

REM For OpenSSL support
set OPENSSL_ROOT=%TEMP_FOLDER%\OpenSSL-1.1.1m-rev1-windows\OpenSSL
set OPENSSL_ROOT=%TEMP_FOLDER%\OpenSSL-1.1.1o-rev1-windows\OpenSSL
set OPENSSL_INCLUDE=%OPENSSL_ROOT%\include
set OPENSSL_LIB_DEBUG=%OPENSSL_ROOT%\debug\lib
set OPENSSL_LIB_RELEASE=%OPENSSL_ROOT%\lib
set INCLUDE=%OPENSSL_INCLUDE%;%INCLUDE%
set LIB=%OPENSSL_LIB_DEBUG%;%OPENSSL_LIB_RELEASE%;%LIB%

REM Base the Tiff of the dependent tiff O3DE package (static)
set TIFF_PREFIX=%TEMP_FOLDER%\tiff-4.2.0.15-rev3-windows\tiff
set TIFF_INCDIR=%TIFF_PREFIX%\include
set TIFF_LIBDIR=%TIFF_PREFIX%\lib

REM We need to also bring in the zlib dependency since Tiff is a static lib dependency
set ZLIB_PREFIX=%TEMP_FOLDER%\zlib-1.2.11-rev5-windows\zlib
set ZLIB_INCDIR=%ZLIB_PREFIX%\include
set ZLIB_LIBDIR=%ZLIB_PREFIX%\lib

cd %BUILD_PATH%

set _OPTS=-v^
-prefix %TARGET_INSTALL_ROOT% ^
set _OPTS=-prefix %TARGET_INSTALL_ROOT% ^
-submodules %QTARRAY% ^
-debug-and-release ^
-force-debug-info ^
-opensource ^
-confirm-license ^
-nomake examples ^
-nomake tests ^
-shared ^
--tiff=system ^
-opengl dynamic ^
-openssl-linked ^
-I %TIFF_INCDIR% ^
-I %ZLIB_INCDIR% ^
-L %TIFF_LIBDIR% ^
-L %ZLIB_LIBDIR%
-openssl-linked

cmd /c ""%BUILD_ROOT%\configure.bat" %_OPTS%" || goto FAILURE

for %%M IN %QTARRAY% do (
echo Building %%M...
jom module-%%M || goto FAILURE
echo Built %%M.
)
cmd /c cmake --build . --parallel || goto FAILURE

for %%M IN %QTARRAY% do (
echo Installing %%M...
jom module-%%M-install_subtargets || goto FAILURE
echo %%M installed.
)
cmd /c ninja install || goto FAILURE

:FINISH
exit
Expand Down
20 changes: 6 additions & 14 deletions package-system/Qt/build_config.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
{
"git_url": "https://github.com/o3de/qt5.git",
"git_tag": "5.15.1-o3de",
"git_commit": "b3a1a6947422928e8aecb14ad607199e9720d266",
"git_url": "https://github.com/guillaume-haerinck/qt5.git",
"git_tag": "6.9.1-o3de",
"git_commit": "8251a04bb2ecc41f59771fb3e80a79d5188098c2",
"package_name": "qt",
"package_url": "https://www.qt.io/",
"package_license": "LGPL-3.0",
"package_license_file": "qt/LICENSE.LGPLv3",
"package_license_file": "LICENSES/LGPL-3.0-only.txt",
"cmake_find_source": "FindQt.cmake",
"cmake_find_target": "FindQt.cmake",
"Platforms": {
"Windows": {
"Windows": {
"package_version": "5.15.2-rev7",
"patch_file": "qt-image-format-windows.patch",
"package_version": "6.9.1-rev1",
"depends_on_packages": [
["OpenSSL-1.1.1m-rev1-windows", "7d8d3904c70b7da471f777ee788678614a9b20d3ac926b7c0d60ccf2a17c7959", ""],
["OpenSSL-1.1.1o-rev1-windows", "52b9d2bc5f3e0c6e405a0f290d1904bf545acc0c73d6a52351247d917c4a06d2", ""],
["tiff-4.2.0.15-rev3-windows", "c6000a906e6d2a0816b652e93dfbeab41c9ed73cdd5a613acd53e553d0510b60", ""],
["zlib-1.2.11-rev5-windows", "8847112429744eb11d92c44026fc5fc53caa4a06709382b5f13978f3c26c4cbd", ""]
],
"additional_download_packages":[
["http://download.qt.io/official_releases/jom/jom.zip", "128fdd846fe24f8594eed37d1d8929a0ea78df563537c0c1b1861a635013fff8", "sha256"],
["https://github.com/unicode-org/icu/releases/download/release-65-1/icu4c-65_1-Win64-MSVC2017.zip", "cfaf7477d65272e9e01c739951f0607642c0510235e46befc109f6a3addd4f43", "sha256"]
],
"custom_build_cmd": [
"build-windows.bat"
],
"custom_install_cmd": [
"{python}", "copy_platform_cmakes.py"
]
}
},
Expand Down
13 changes: 0 additions & 13 deletions package-system/Qt/qt-image-format-windows.patch

This file was deleted.

4 changes: 2 additions & 2 deletions package_build_list_host_windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"pybind11-2.10.0-rev1-multiplatform": "Scripts/extras/pull_and_build_from_git.py ../../package-system/pybind11 --platform-name multiplatform --package-root ../../package-system/pybind11/temp --clean",
"pyside2-5.15.2.1-py3.10-rev3-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/pyside2 --platform-name Windows --package-root ../../package-system/pyside2/temp --clean",
"python-3.10.13-rev1-windows": "package-system/python/build_package_image.py",
"qt-5.15.2-rev7-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Windows --package-root ../../package-system/Qt/temp --clean",
"qt-6.9.1-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Windows --package-root ../../package-system/Qt/temp --clean",
"RapidJSON-1.1.0-rev1-multiplatform": "Scripts/extras/pull_and_build_from_git.py ../../package-system/RapidJSON --platform-name multiplatform --package-root ../../package-system",
"SPIRVCross-1.3.275.0-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Windows --package-root ../../package-system --clean",
"SQLite-3.37.2-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Windows --package-root ../../package-system --clean",
Expand Down Expand Up @@ -121,7 +121,7 @@
"pybind11-2.10.0-rev1-multiplatform": "package-system/pybind11/temp/pybind11-multiplatform",
"pyside2-5.15.2.1-py3.10-rev3-windows": "package-system/pyside2/temp/pyside2-windows",
"python-3.10.13-rev1-windows": "package-system/python/win_x64/package",
"qt-5.15.2-rev7-windows": "package-system/Qt/temp/qt-windows",
"qt-6.9.1-rev1-windows": "package-system/Qt/temp/qt-windows",
"RapidJSON-1.1.0-rev1-multiplatform": "package-system/RapidJSON-multiplatform",
"RapidXML-1.13-rev1-multiplatform": "package-system/RapidXML-multiplatform",
"SPIRVCross-1.3.275.0-rev1-windows": "package-system/SPIRVCross-windows",
Expand Down
Loading