Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ation#606)

### Feature - Qt 6 port # 1

### Linked issues
AcademySoftwareFoundation#367 

### Summarize your change.
This is the first phase of the Qt 6 port. It was mostly tested on Rocky
Linux 8.

There are a lot of generated files under `src/lib/mu/MuQt6`, and some
modifications but you don't need to go over that folder.

There are known issues that will be addressed in future PR:

**All platforms:**
- Refactor _QtAudioRenderer_ class. Currently, The _pulse_ audio output
device is not enabled, and they are loud white noise issues on MacOS.
- Remove the usage of _Core5compat_ and refactor what is deprecated. I
don't think there is a lot to do here, but it is mostly about refactor
the usage of _QTextCodec_.

**MacOS:**
- The _Open File dialog_ does not open anymore.
- Loud white noise audio (Should be related to _QtAudioRenderer_)
- The Central widget is rendered in the bottom left corner, but as soon
as you resize the windows, it goes back to normal.

**Windows:**
- Issue with the compilation of Shiboken6

### Describe what you have tested and on which operating system.

- [ ] Rocky LInux 8
- [ ] MacOS

### Add a list of changes, and note any that might need special
attention during the review.

---------

Signed-off-by: Cédrik Fuoco <[email protected]>
  • Loading branch information
cedrik-fuoco-adsk committed Nov 7, 2024
1 parent db17195 commit dd94e52
Show file tree
Hide file tree
Showing 545 changed files with 174,569 additions and 642 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ compile_commands.json

cmake-*/*
build/*
_build/*
_build*/*
_install/*
.venv/*

# These are now generated by CMake using template to support Qt5 and Qt6.
# See rvui.mu.in
rvui.mu
# See window_mode.mu.in
window_mode.mu
# See session_manager.mu.in
session_manager.mu
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
url = https://github.com/shotgunsoftware/openrv-WFObj.git
[submodule "src/pub"]
path = src/pub
url = https://github.com/shotgunsoftware/openrv-pub.git
url = [email protected]:cedrik-fuoco-adsk/openrv-pub.git
branch = qt6
4 changes: 4 additions & 0 deletions cmake/defaults/cxx_defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ ENDIF()
IF(RV_VFX_PLATFORM STREQUAL CY2024)
SET(RV_VFX_CY2024 ON)
ADD_COMPILE_DEFINITIONS(RV_VFX_CY2024)
SET(RV_QT_PACKAGE_NAME "Qt6")
SET(RV_QT_MU_TARGET "MuQt6")
ELSEIF(RV_VFX_PLATFORM STREQUAL CY2023)
SET(RV_VFX_CY2023 ON)
ADD_COMPILE_DEFINITIONS(RV_VFX_CY2023)
SET(RV_QT_PACKAGE_NAME "Qt5")
SET(RV_QT_MU_TARGET "MuQt5")
ENDIF()

#
Expand Down
1 change: 1 addition & 0 deletions cmake/defaults/rv_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ SET(RV_VFX_PLATFORM
"${_RV_VFX_PLATFORM}"
CACHE STRING "Set the VFX platform for installaing external dependencies" FORCE
)

SET_PROPERTY(
CACHE RV_VFX_PLATFORM
PROPERTY STRINGS ${_RV_VFX_PLATFORM}
Expand Down
27 changes: 24 additions & 3 deletions cmake/dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ ENDIF()
IF(RV_TARGET_WINDOWS)
INCLUDE(expat)
ENDIF()
INCLUDE(qt5)

# TODO_QT: Not generic enough.. But maybe we could use something like NOT CY2023
# since after 2023, it is Qt6
IF(RV_VFX_PLATFORM STREQUAL CY2023)
INCLUDE(qt5)
ELSEIF(RV_VFX_PLATFORM STREQUAL CY2024)
INCLUDE(qt6)
ENDIF()

INCLUDE(openssl) # Python3 requirement
INCLUDE(python3)
INCLUDE(boost)
Expand Down Expand Up @@ -120,8 +128,21 @@ IF(RV_TARGET_WINDOWS)
ENDIF()
MESSAGE(STATUS "Using PNG: ${RV_DEPS_PNG_VERSION}")
MESSAGE(STATUS "Using Python3: ${RV_DEPS_PYTHON3_VERSION}")
MESSAGE(STATUS "Using PySide2: ${RV_DEPS_PYSIDE2_VERSION}")
MESSAGE(STATUS "Using Qt5: ${RV_DEPS_QT5_VERSION}")

RV_VFX_SET_VARIABLE(
_rv_deps_pyside_version
CY2023 "Using PySide2: ${RV_DEPS_PYSIDE_VERSION}"
CY2024 "Using PySide6: ${RV_DEPS_PYSIDE_VERSION}"
)
MESSAGE(STATUS "${_rv_deps_pyside_version}")

RV_VFX_SET_VARIABLE(
_rv_deps_qt_version
CY2023 "Using Qt5: ${RV_DEPS_QT5_VERSION}"
CY2024 "Using Qt6: ${RV_DEPS_QT6_VERSION}"
)
MESSAGE(STATUS "${_rv_deps_qt_version}")

MESSAGE(STATUS "Using Raw: ${RV_DEPS_RAW_VERSION}")
MESSAGE(STATUS "Using Tiff: ${RV_DEPS_TIFF_VERSION}")
MESSAGE(STATUS "Using WebP: ${RV_DEPS_WEBP_VERSION}")
Expand Down
2 changes: 0 additions & 2 deletions cmake/dependencies/oiio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ ENDIF()

LIST(APPEND _configure_options "-DLibRaw_ROOT=${RV_DEPS_RAW_ROOT_DIR}")

LIST(APPEND _configure_options "-DQt5_ROOT=${RV_DEPS_QT5_LOCATION}")

IF(NOT RV_TARGET_LINUX)
LIST(APPEND _configure_options "-DWebP_ROOT=${RV_DEPS_WEBP_ROOT_DIR}")
# Linux has a Link error related to relocation; WebP appears not built with -fPIC. Hence OIIO will build WebP itself.
Expand Down
167 changes: 114 additions & 53 deletions cmake/dependencies/python3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
#


SET(_python3_target
"RV_DEPS_PYTHON3"
)
Expand All @@ -12,8 +13,10 @@ SET(_opentimelineio_target
"RV_DEPS_OPENTIMELINEIO"
)

SET(_pyside2_target
"RV_DEPS_PYSIDE2"
RV_VFX_SET_VARIABLE(
_pyside_target
CY2023 "RV_DEPS_PYSIDE2"
CY2024 "RV_DEPS_PYSIDE6"
)

SET(PYTHON_VERSION_MAJOR
Expand Down Expand Up @@ -48,10 +51,9 @@ SET(_opentimelineio_version
)

RV_VFX_SET_VARIABLE(
_pyside2_version
_pyside_version
CY2023 "5.15.10"
# Need 5.15.11+ to support Python 3.11.
CY2024 "5.15.11"
CY2024 "6.5.3"
)

SET(_python3_download_url
Expand All @@ -70,13 +72,16 @@ SET(_opentimelineio_git_tag
"v${_opentimelineio_version}"
)

SET(_pyside2_archive_url
"https://mirrors.ocf.berkeley.edu/qt/official_releases/QtForPython/pyside2/PySide2-${_pyside2_version}-src/pyside-setup-opensource-src-${_pyside2_version}.zip"
RV_VFX_SET_VARIABLE(
_pyside_archive_url
CY2023 "https://mirrors.ocf.berkeley.edu/qt/official_releases/QtForPython/pyside2/PySide2-${_pyside_version}-src/pyside-setup-opensource-src-${_pyside_version}.zip"
CY2024 "https://mirrors.ocf.berkeley.edu/qt/official_releases/QtForPython/pyside6/PySide6-${_pyside_version}-src/pyside-setup-everywhere-src-${_pyside_version}.zip"
)

RV_VFX_SET_VARIABLE(
_pyside2_download_hash
_pyside_download_hash
CY2023 "87841aaced763b6b52e9b549e31a493f"
CY2024 "8f652b08c1c74f9a80a2c0f16ff2a4ca"
CY2024 "515d3249c6e743219ff0d7dd25b8c8d8"
)

SET(_install_dir
Expand All @@ -103,13 +108,13 @@ IF(RV_TARGET_WINDOWS)
ENDIF()

FETCHCONTENT_DECLARE(
${_pyside2_target}
URL ${_pyside2_archive_url}
URL_HASH MD5=${_pyside2_download_hash}
${_pyside_target}
URL ${_pyside_archive_url}
URL_HASH MD5=${_pyside_download_hash}
SOURCE_SUBDIR "sources" # Avoids the top level CMakeLists.txt
)

FETCHCONTENT_MAKEAVAILABLE(${_pyside2_target})
FETCHCONTENT_MAKEAVAILABLE(${_pyside_target})

SET(_python3_make_command_script
"${PROJECT_SOURCE_DIR}/src/build/make_python.py"
Expand All @@ -136,30 +141,67 @@ IF(RV_TARGET_WINDOWS)
LIST(APPEND _python3_make_command "${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
ENDIF()

SET(_pyside2_make_command_script
"${PROJECT_SOURCE_DIR}/src/build/make_pyside.py"
)
SET(_pyside2_make_command
python3 "${_pyside2_make_command_script}"
)
LIST(APPEND _pyside2_make_command "--variant")
LIST(APPEND _pyside2_make_command ${CMAKE_BUILD_TYPE})
LIST(APPEND _pyside2_make_command "--source-dir")
LIST(APPEND _pyside2_make_command ${rv_deps_pyside2_SOURCE_DIR})
LIST(APPEND _pyside2_make_command "--output-dir")
LIST(APPEND _pyside2_make_command ${_install_dir})
LIST(APPEND _pyside2_make_command "--temp-dir")
LIST(APPEND _pyside2_make_command ${_build_dir})
IF(DEFINED RV_DEPS_OPENSSL_INSTALL_DIR)
LIST(APPEND _pyside2_make_command "--openssl-dir")
LIST(APPEND _pyside2_make_command ${RV_DEPS_OPENSSL_INSTALL_DIR})

# TODO_QT: Maybe we could use something like NOT CY2023
# since after 2023, it is Qt6
# TODO_QT: Below code could be simplified, but for now it is faster to test.
IF(RV_VFX_PLATFORM STREQUAL CY2023)
SET(_pyside_make_command_script
"${PROJECT_SOURCE_DIR}/src/build/make_pyside.py"
)
SET(_pyside_make_command
python3 "${_pyside_make_command_script}"
)

LIST(APPEND _pyside_make_command "--variant")
LIST(APPEND _pyside_make_command ${CMAKE_BUILD_TYPE})
LIST(APPEND _pyside_make_command "--source-dir")
LIST(APPEND _pyside_make_command ${rv_deps_pyside2_SOURCE_DIR})
LIST(APPEND _pyside_make_command "--output-dir")
LIST(APPEND _pyside_make_command ${_install_dir})
LIST(APPEND _pyside_make_command "--temp-dir")
LIST(APPEND _pyside_make_command ${_build_dir})

IF(DEFINED RV_DEPS_OPENSSL_INSTALL_DIR)
LIST(APPEND _pyside_make_command "--openssl-dir")
LIST(APPEND _pyside_make_command ${RV_DEPS_OPENSSL_INSTALL_DIR})
ENDIF()

LIST(APPEND _pyside_make_command "--python-dir")
LIST(APPEND _pyside_make_command ${_install_dir})
LIST(APPEND _pyside_make_command "--qt-dir")
LIST(APPEND _pyside_make_command ${RV_DEPS_QT5_LOCATION})
LIST(APPEND _pyside_make_command "--python-version")
LIST(APPEND _pyside_make_command "${RV_DEPS_PYTHON_VERSION_SHORT}")
ELSEIF(RV_VFX_PLATFORM STREQUAL CY2024)
SET(_pyside_make_command_script
"${PROJECT_SOURCE_DIR}/src/build/make_pyside6.py"
)
SET(_pyside_make_command
python3 "${_pyside_make_command_script}"
)

LIST(APPEND _pyside_make_command "--variant")
LIST(APPEND _pyside_make_command ${CMAKE_BUILD_TYPE})
LIST(APPEND _pyside_make_command "--source-dir")
LIST(APPEND _pyside_make_command ${rv_deps_pyside6_SOURCE_DIR})
LIST(APPEND _pyside_make_command "--output-dir")
LIST(APPEND _pyside_make_command ${_install_dir})
LIST(APPEND _pyside_make_command "--temp-dir")
LIST(APPEND _pyside_make_command ${_build_dir})

IF(DEFINED RV_DEPS_OPENSSL_INSTALL_DIR)
LIST(APPEND _pyside_make_command "--openssl-dir")
LIST(APPEND _pyside_make_command ${RV_DEPS_OPENSSL_INSTALL_DIR})
ENDIF()

LIST(APPEND _pyside_make_command "--python-dir")
LIST(APPEND _pyside_make_command ${_install_dir})
LIST(APPEND _pyside_make_command "--qt-dir")
LIST(APPEND _pyside_make_command ${RV_DEPS_QT6_LOCATION})
LIST(APPEND _pyside_make_command "--python-version")
LIST(APPEND _pyside_make_command "${RV_DEPS_PYTHON_VERSION_SHORT}")
ENDIF()
LIST(APPEND _pyside2_make_command "--python-dir")
LIST(APPEND _pyside2_make_command ${_install_dir})
LIST(APPEND _pyside2_make_command "--qt-dir")
LIST(APPEND _pyside2_make_command ${RV_DEPS_QT5_LOCATION})
LIST(APPEND _pyside2_make_command "--python-version")
LIST(APPEND _pyside2_make_command "${RV_DEPS_PYTHON_VERSION_SHORT}")

IF(RV_TARGET_WINDOWS)
IF(CMAKE_BUILD_TYPE MATCHES "^Debug$")
Expand Down Expand Up @@ -297,21 +339,40 @@ IF(RV_TARGET_WINDOWS
)
ENDIF()

SET(${_pyside2_target}-build-flag
${_install_dir}/${_pyside2_target}-build-flag
SET(${_pyside_target}-build-flag
${_install_dir}/${_pyside_target}-build-flag
)

ADD_CUSTOM_COMMAND(
COMMENT "Building PySide2 using ${_pyside2_make_command_script}"
OUTPUT ${${_pyside2_target}-build-flag}
# First PySide build script on Windows which doesn't respect '--debug' option
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/src/build/patch_PySide2/windows_desktop.py
${rv_deps_pyside2_SOURCE_DIR}/build_scripts/platforms/windows_desktop.py
COMMAND ${_pyside2_make_command} --prepare --build
COMMAND cmake -E touch ${${_pyside2_target}-build-flag}
DEPENDS ${_python3_target} ${_pyside2_make_command_script} ${${_python3_target}-requirements-flag}
USES_TERMINAL
)

# TODO_QT: Maybe we could use something like NOT CY2023
# since after 2023, it is Qt6
# TODO_QT: Below code could be simplified, but for now it is faster to test.
IF(RV_VFX_PLATFORM STREQUAL CY2023)
ADD_CUSTOM_COMMAND(
COMMENT "Building PySide2 using ${_pyside_make_command_script}"
OUTPUT ${${_pyside_target}-build-flag}
# First PySide build script on Windows which doesn't respect '--debug' option
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/src/build/patch_PySide2/windows_desktop.py
${rv_deps_pyside2_SOURCE_DIR}/build_scripts/platforms/windows_desktop.py
COMMAND ${_pyside_make_command} --prepare --build
COMMAND cmake -E touch ${${_pyside_target}-build-flag}
DEPENDS ${_python3_target} ${_pyside_make_command_script} ${${_python3_target}-requirements-flag}
USES_TERMINAL
)

SET(_build_flag_depends ${${_pyside_target}-build-flag})
ELSEIF(RV_VFX_PLATFORM STREQUAL CY2024)
ADD_CUSTOM_COMMAND(
COMMENT "Building PySide6 using ${_pyside_make_command_script}"
OUTPUT ${${_pyside_target}-build-flag}
COMMAND ${_pyside_make_command} --prepare --build
COMMAND cmake -E touch ${${_pyside_target}-build-flag}
DEPENDS ${_python3_target} ${_pyside_make_command_script} ${${_python3_target}-requirements-flag}
USES_TERMINAL
)

SET(_build_flag_depends ${${_pyside_target}-build-flag})
ENDIF()

IF(RV_TARGET_WINDOWS)
ADD_CUSTOM_COMMAND(
Expand All @@ -320,7 +381,7 @@ IF(RV_TARGET_WINDOWS)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/lib ${RV_STAGE_LIB_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/include ${RV_STAGE_INCLUDE_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/bin ${RV_STAGE_BIN_DIR}
DEPENDS ${_python3_target} ${${_pyside2_target}-build-flag} ${${_python3_target}-requirements-flag}
DEPENDS ${_python3_target} ${${_python3_target}-requirements-flag} ${_build_flag_depends}
)
ADD_CUSTOM_TARGET(
${_python3_target}-stage-target ALL
Expand All @@ -333,7 +394,7 @@ ELSE()
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/lib ${RV_STAGE_LIB_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/include ${RV_STAGE_INCLUDE_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/bin ${RV_STAGE_BIN_DIR}
DEPENDS ${_python3_target} ${${_pyside2_target}-build-flag} ${${_python3_target}-requirements-flag}
DEPENDS ${_python3_target} ${${_python3_target}-requirements-flag} ${_build_flag_depends}
)
ADD_CUSTOM_TARGET(
${_python3_target}-stage-target ALL
Expand Down Expand Up @@ -370,8 +431,8 @@ SET(RV_DEPS_PYTHON3_VERSION
${_python3_version}
CACHE INTERNAL "" FORCE
)
SET(RV_DEPS_PYSIDE2_VERSION
${_pyside2_version}
SET(RV_DEPS_PYSIDE_VERSION
${_pyside_version}
CACHE INTERNAL "" FORCE
)

Expand Down
6 changes: 6 additions & 0 deletions cmake/dependencies/qt5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ FIND_PACKAGE(
REQUIRED
)

get_target_property(MOC_EXECUTABLE Qt5::moc IMPORTED_LOCATION)
get_target_property(UIC_EXECUTABLE Qt5::uic IMPORTED_LOCATION)

SET(QT_MOC_EXECUTABLE "${MOC_EXECUTABLE}" CACHE STRING "Qt MOC executable")
SET(QT_UIC_EXECUTABLE "${UIC_EXECUTABLE}" CACHE STRING "Qt UIC executable")

SET(_qt_copy_message
"Copying Qt into ${RV_STAGE_ROOT_DIR}"
)
Expand Down
Loading

0 comments on commit dd94e52

Please sign in to comment.