diff --git a/.gitignore b/.gitignore index 08f9bce53..f906b7286 100644 --- a/.gitignore +++ b/.gitignore @@ -14,9 +14,7 @@ python/src/xstudio/version.py /build/ xstudio_install/ **/qml/*_qml_export.h -<<<<<<< HEAD CMakeUserPresets.json -======= __build __build_debug ->>>>>>> c808bb352 (WIP) +aqtinstall.log diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 387c71ac9..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "extern/otio/OpenTimelineIO"] - path = extern/otio/OpenTimelineIO - url = https://github.com/AcademySoftwareFoundation/OpenTimelineIO diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ed59875e..f19f43812 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ -cmake_minimum_required(VERSION 3.28 FATAL_ERROR) -cmake_policy(VERSION 3.28) +cmake_minimum_required(VERSION 3.26 FATAL_ERROR) +cmake_policy(VERSION 3.26) +#cmake_minimum_required(VERSION 3.28 FATAL_ERROR) +#cmake_policy(VERSION 3.28) set(XSTUDIO_GLOBAL_VERSION "1.2.0" CACHE STRING "Version string") set(XSTUDIO_GLOBAL_NAME xStudio) @@ -8,6 +10,17 @@ set(XSTUDIO_GLOBAL_NAME xStudio) project(${XSTUDIO_GLOBAL_NAME} VERSION ${XSTUDIO_GLOBAL_VERSION} LANGUAGES CXX) +# Work around Qt bug: FindWrapOpenGL.cmake links -framework AGL, which was +# removed from the macOS SDK in 10.14. Fixed upstream in Qt 6.9+ but not +# backported to 6.5/6.8 LTS (see https://codereview.qt-project.org/c/qt/qtbase/+/652022). +# Pre-create the target so Qt's FindWrapOpenGL early-returns and never hits the +# broken AGL block. Can be removed once the minimum supported Qt is >= 6.9. +if(APPLE AND NOT TARGET WrapOpenGL::WrapOpenGL) + find_package(OpenGL REQUIRED) + add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED) + target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::GL) +endif() + option(BUILD_TESTING "Build tests" OFF) option(INSTALL_PYTHON_MODULE "Install python module" ON) option(INSTALL_XSTUDIO "Install xstudio" ON) @@ -16,7 +29,6 @@ option(ENABLE_CLANG_TIDY "Enable clang-tidy, ninja clang-tidy." OFF) option(ENABLE_CLANG_FORMAT "Enable clang format, ninja clangformat." OFF) option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE) option(OPTIMIZE_FOR_NATIVE "Build with -march=native" OFF) -option(OTIO_SUBMODULE "Automatically build OpenTimelineIO as a submodule" OFF) option(USE_VCPKG "Use Vcpkg for package management" OFF) option(BUILD_PYSIDE_WIDGETS "Build xstudio player as PySide widget" OFF) option(OPENIMAGEIO_PLUGIN "Include the OpenImageIO PLugin" ON) @@ -188,10 +200,6 @@ endif() if (USE_VCPKG) - # When building with VCPKG, we will use OTIO submodule - set(OTIO_SUBMODULE true) - add_subdirectory("extern/otio") - set(VCPKG_INTEGRATION ON) # Install pip and sphinx @@ -218,14 +226,12 @@ if (USE_VCPKG) else() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") - if(${OTIO_SUBMODULE}) - add_subdirectory("extern/otio") - endif() find_package(PkgConfig REQUIRED) endif() # Add the necessary libraries from Vcpkg if Vcpkg integration is enabled +find_package(OpenTimelineIO CONFIG REQUIRED) find_package(nlohmann_json CONFIG REQUIRED) include(CTest) diff --git a/CMakePresets.json b/CMakePresets.json index b57636bb1..c16a5f9e3 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -7,13 +7,13 @@ "binaryDir": "${sourceDir}/build", "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../vcpkg/scripts/buildsystems/vcpkg.cmake", - "Qt6_DIR": "/Users/tedwaine/Qt6/6.5.3/macos/lib/cmake/Qt6", "CMAKE_INSTALL_PREFIX": "xstudio_install", "X_VCPKG_APPLOCAL_DEPS_INSTALL": "ON", "BUILD_DOCS": "OFF", "USE_VCPKG": "ON", "STUDIO_PLUGINS": "", - "BMD_DECKLINK_PLUGIN": "OFF" + "BMD_DECKLINK_PLUGIN": "OFF", + "VCPKG_OVERLAY_PORTS": "${sourceDir}/cmake/vcpkg_overlay_ports" } }, { @@ -44,7 +44,6 @@ }, { "name": "WinDebug", - "hidden": true, "inherits": ["windows-base"], "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", @@ -151,10 +150,67 @@ "USE_SANITIZER": "address" } }, - { + { + "name": "macos-ninja-base-arm", + "inherits": "macos-base-arm", + "generator": "Ninja" + }, + { + "name": "macos-ninja-base-intel", + "inherits": "macos-base-intel", + "generator": "Ninja" + }, + { + "name": "MacOSNinjaRelease", + "inherits": ["macos-ninja-base-arm"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "MacOSNinjaRelWithDebInfo", + "inherits": ["macos-ninja-base-arm"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "USE_SANITIZER": "address" + } + }, + { + "name": "MacOSNinjaDebug", + "inherits": ["macos-ninja-base-arm"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "USE_SANITIZER": "address" + } + }, + { + "name": "MacOSIntelNinjaRelease", + "inherits": ["macos-ninja-base-intel"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "MacOSIntelNinjaRelWithDebInfo", + "inherits": ["macos-ninja-base-intel"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "USE_SANITIZER": "address" + } + }, + { + "name": "MacOSIntelNinjaDebug", + "inherits": ["macos-ninja-base-intel"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "USE_SANITIZER": "address" + } + }, + { "name": "linux-base", "inherits": "default", "cacheVariables": { + "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/cmake/vcpkg_triplets", "VCPKG_TARGET_TRIPLET": "x64-xstudio-linux" } }, @@ -180,6 +236,34 @@ "CMAKE_BUILD_TYPE": "Debug", "USE_SANITIZER": "address" } + }, + { + "name": "linux-ninja-base", + "inherits": "linux-base", + "generator": "Ninja" + }, + { + "name": "LinuxNinjaRelease", + "inherits": ["linux-ninja-base"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "LinuxNinjaRelWithDebInfo", + "inherits": ["linux-ninja-base"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "USE_SANITIZER": "address" + } + }, + { + "name": "LinuxNinjaDebug", + "inherits": ["linux-ninja-base"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "USE_SANITIZER": "address" + } } ] } diff --git a/cmake/macros.cmake b/cmake/macros.cmake index 767a988a4..e3cd1bafa 100644 --- a/cmake/macros.cmake +++ b/cmake/macros.cmake @@ -308,6 +308,7 @@ macro(default_options_qt name) set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" ) install(TARGETS ${name} EXPORT xstudio LIBRARY DESTINATION share/xstudio/lib) diff --git a/cmake/otio_patch.diff b/cmake/otio_patch.diff deleted file mode 100644 index 176f41105..000000000 --- a/cmake/otio_patch.diff +++ /dev/null @@ -1,14 +0,0 @@ -Submodule extern/otio/OpenTimelineIO contains modified content -diff --git a/extern/otio/OpenTimelineIO/CMakeLists.txt b/extern/otio/OpenTimelineIO/CMakeLists.txt -index 825ad9d..7598b5e 100644 ---- a/extern/otio/OpenTimelineIO/CMakeLists.txt -+++ b/extern/otio/OpenTimelineIO/CMakeLists.txt -@@ -245,7 +245,7 @@ else() - endif() - - # set up the internally hosted dependencies --add_subdirectory(src/deps) -+# add_subdirectory(src/deps) - - set (OTIO_IMATH_TARGETS - # For OpenEXR/Imath 3.x: diff --git a/cmake/vcpkg_overlay_ports/opentimelineio/0001-disable-src-deps-subdir.patch b/cmake/vcpkg_overlay_ports/opentimelineio/0001-disable-src-deps-subdir.patch new file mode 100644 index 000000000..4a8d49954 --- /dev/null +++ b/cmake/vcpkg_overlay_ports/opentimelineio/0001-disable-src-deps-subdir.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -245,7 +245,7 @@ + endif() + + # set up the internally hosted dependencies +-add_subdirectory(src/deps) ++# add_subdirectory(src/deps) + + set (OTIO_IMATH_TARGETS + # For OpenEXR/Imath 3.x: diff --git a/cmake/vcpkg_overlay_ports/opentimelineio/portfile.cmake b/cmake/vcpkg_overlay_ports/opentimelineio/portfile.cmake new file mode 100644 index 000000000..fd9fa9389 --- /dev/null +++ b/cmake/vcpkg_overlay_ports/opentimelineio/portfile.cmake @@ -0,0 +1,81 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO AcademySoftwareFoundation/OpenTimelineIO + REF v${VERSION} + SHA512 305d63730446c3b4c368cadd9d7a66de96dafee2168d589ae88a0320319f40cde4a739c9939eb088b635185cb1aabd051360ed432fde3ce11ef145e18c25dd21 + HEAD_REF main + PATCHES + 0001-disable-src-deps-subdir.patch +) + +vcpkg_from_github( + OUT_SOURCE_PATH RAPIDJSON_SOURCE_PATH + REPO Tencent/rapidjson + REF 06d58b9e848c650114556a23294d0b6440078c61 + SHA512 f0a7df46234e5b3244a801ddf1daefd26aac7ae5b2c470b8c3898f65c65591f6c9cabac0421800588826da9d3bcccba1f98e1c0c8c15184b3843cf6f3ffbdcad + HEAD_REF master +) + +file(COPY "${RAPIDJSON_SOURCE_PATH}/include" + DESTINATION "${SOURCE_PATH}/src/deps/rapidjson") + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" OTIO_SHARED) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DOTIO_SHARED_LIBS=${OTIO_SHARED} + -DOTIO_PYTHON_INSTALL=OFF + -DOTIO_DEPENDENCIES_INSTALL=OFF + -DOTIO_FIND_IMATH=ON + -DOTIO_CXX_INSTALL=ON + -DOTIO_AUTOMATIC_SUBMODULES=OFF + -DOTIO_INSTALL_COMMANDLINE_TOOLS=OFF +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup( + PACKAGE_NAME opentimelineio + CONFIG_PATH share/opentimelineio +) +vcpkg_cmake_config_fixup( + PACKAGE_NAME opentime + CONFIG_PATH share/opentime +) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +# OTIO's upstream CMake installs shared libraries (.dll) into lib/ on Windows, +# but vcpkg's convention (and applocal.ps1's search path) expects DLLs in bin/. +# Move them so they get picked up by dependency deployment, and fix up the +# generated CMake targets files so IMPORTED_LOCATION still resolves. +if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") + file(GLOB _otio_release_dlls "${CURRENT_PACKAGES_DIR}/lib/*.dll") + foreach(_dll ${_otio_release_dlls}) + get_filename_component(_name "${_dll}" NAME) + file(RENAME "${_dll}" "${CURRENT_PACKAGES_DIR}/bin/${_name}") + endforeach() + file(GLOB _otio_debug_dlls "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll") + foreach(_dll ${_otio_debug_dlls}) + get_filename_component(_name "${_dll}" NAME) + file(RENAME "${_dll}" "${CURRENT_PACKAGES_DIR}/debug/bin/${_name}") + endforeach() + + # Rewrite the generated Targets-*.cmake files to reference the new DLL + # locations. Only the .dll paths are changed; .lib (import library) paths + # stay in lib/ where they belong. + file(GLOB _otio_targets_files + "${CURRENT_PACKAGES_DIR}/share/opentime/OpenTimeTargets-*.cmake" + "${CURRENT_PACKAGES_DIR}/share/opentimelineio/OpenTimelineIOTargets-*.cmake" + ) + foreach(_file ${_otio_targets_files}) + file(READ "${_file}" _content) + string(REGEX REPLACE "/lib/([^/\"]*\\.dll)" "/bin/\\1" _content "${_content}") + file(WRITE "${_file}" "${_content}") + endforeach() +endif() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") diff --git a/cmake/vcpkg_overlay_ports/opentimelineio/vcpkg.json b/cmake/vcpkg_overlay_ports/opentimelineio/vcpkg.json new file mode 100644 index 000000000..82d6bd0df --- /dev/null +++ b/cmake/vcpkg_overlay_ports/opentimelineio/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "opentimelineio", + "version": "0.17.0", + "description": "A file format and API for describing editorial timelines", + "homepage": "https://opentimeline.io", + "license": "Apache-2.0", + "dependencies": [ + "imath", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/docs/reference/build_guides/developer_tips.md b/docs/reference/build_guides/developer_tips.md deleted file mode 100644 index e37bbdc9e..000000000 --- a/docs/reference/build_guides/developer_tips.md +++ /dev/null @@ -1,21 +0,0 @@ -# Tips for Developers - -### A Faster Development Cycle on Windows - -If you are developing xSTUDIO on Windows the build times for both **package** and **install** targets are very long even if you need to test a single line code change. A solution to this problem is to do a full package build first and then copy the contents of the **bin** folder in the target package output folder into the regular **build/bin** folder in the build output folder. This will allow you to run xstudio directly from the **./build/bin** folder after subsequent builds without specifying package or install as the build target. Likewise if your build environment is MS Visual Studio you can set your debug target to **build/bin/xstudio.exe** for a much faster code-change / build / test cycles. The steps to do this in a PowerShell will look something like this: - -*Clear the bin and share build output folders (you only need to do this once):* - - rm -r -fo ./bin/build - rm -r -fo ./bin/share/xstudio - -*Copy the corresponding folders from the package output back into the build folder (again, you only need to do this once):* - - cp -r .\build\_CPack_Packages\win64\NSIS\xSTUDIO-1.2.0-win64\bin .\build\ - cp -r .\build\_CPack_Packages\win64\NSIS\xSTUDIO-1.2.0-win64\share\xstudio .\build\share\ - -*Now you can build and execute xstudio quickly without doing a full package/install build:* - - cmake --build build - ./bin/xstudio.exe - diff --git a/docs/reference/build_guides/downloading_qt.md b/docs/reference/build_guides/downloading_qt.md index f5832be31..002526bb8 100644 --- a/docs/reference/build_guides/downloading_qt.md +++ b/docs/reference/build_guides/downloading_qt.md @@ -2,7 +2,32 @@ xSTUDIO's UI is built with the Qt cross-platform GUI development libraries. The Qt SDK is a major dependency that is required to build xSTUDIO but fortunately it is freely available for public use under the GPL license. -### Running the Qt installer +There are two ways to install it: the official Qt installer (GUI, requires a Qt account), or `aqtinstall` (command-line, scriptable, no account). Either produces the same result and both are documented below — pick whichever you prefer. + +### Option A: Using `aqtinstall` (command-line, recommended) + +[`aqtinstall`](https://github.com/miurahr/aqtinstall) is a small open-source Python tool that downloads the same official Qt prebuilt binaries as the GUI installer, directly from Qt's CDN. It requires no Qt account, is fully scriptable, and installs exactly the version and modules you ask for. + +First, make sure you have Python 3 and `pip` available, then install `aqtinstall`: + + pip install aqtinstall + +Then download Qt 6.5.3 for your platform. Choose the command that matches your OS: + + # Linux (gcc x86_64) + aqt install-qt linux desktop 6.5.3 gcc_64 -O ~/Qt -m qtimageformats + + # macOS (universal: ARM + Intel) + aqt install-qt mac desktop 6.5.3 clang_64 -O ~/Qt -m qtimageformats + + # Windows (MSVC 2019 64-bit, in PowerShell) + aqt install-qt windows desktop 6.5.3 win64_msvc2019_64 -O C:\Qt -m qtimageformats + +The `-m qtimageformats` flag installs the extra 'Qt Image Formats' module that xSTUDIO requires. The `-O` flag specifies the output directory — feel free to change it, but make a note of the path as you will need it later when setting `Qt6_DIR` in your build environment. + +After the command finishe, you will have a Qt installation layout identical to what the GUI installer produces, e.g. `~/Qt/6.5.3/gcc_64/` on Linux, `~/Qt/6.5.3/macos/` on macOS, or `C:\Qt\6.5.3\msvc2019_64\` on Windows. + +### Option B: Running the Qt installer (GUI) First you need to download the [Qt Installer](https://www.qt.io/download-qt-installer). @@ -10,7 +35,7 @@ Run the installer app. Before you can proceed you must register with Qt if you a ![Qt Installer](qt_inst1.jpg) -### Select Qt 6.5.3 components +#### Select Qt 6.5.3 components (Option B only) Now you must select the correct version of Qt to download. The required version is **6.5.3**. Epand the 'Qt' item in the list, then expand the Qt 6.5.3 below that. You only need to check the following option within the list under 6.5.3, depending on your platform: diff --git a/docs/reference/build_guides/index.rst b/docs/reference/build_guides/index.rst index 0d28b364c..7e37eec2c 100644 --- a/docs/reference/build_guides/index.rst +++ b/docs/reference/build_guides/index.rst @@ -18,9 +18,16 @@ Individual Users If you have any **questions** reach out on the ASWF Slack in the `#ori-xstudio-discussion `_ . +Choosing a guide +^^^^^^^^^^^^^^^^ + +The **macOS**, **Windows** and **Linux Generic** guides all use the same approach: xSTUDIO's dependencies are built and managed automatically by `vcpkg `_, so the only things you need to install by hand are a compiler toolchain, CMake, git and the Qt SDK. These are the **recommended** paths — they work on any reasonably recent distro and require the least manual setup. + +The **Rocky Linux 9.1**, **Ubuntu 22.04** and **CentOS 7** guides take a different, more advanced approach: instead of using vcpkg, they resolve xSTUDIO's dependencies from each distro's native package manager (and build a handful of libraries from source when no suitable package exists). This gives a tighter integration with the host system but is significantly more work and more fragile — package names and versions drift over time, and any mismatch against the VFX Reference Platform requires manual intervention. These guides are intended for users who specifically want a native-package build, or whose target distro matches one of the three and who are comfortable troubleshooting package issues. If you just want xSTUDIO to build on a Linux machine, prefer **Linux Generic**. + .. toctree:: :maxdepth: 1 - + macos windows linux_generic diff --git a/docs/reference/build_guides/linux_generic.md b/docs/reference/build_guides/linux_generic.md index 0287f7e89..f34fa0688 100644 --- a/docs/reference/build_guides/linux_generic.md +++ b/docs/reference/build_guides/linux_generic.md @@ -4,7 +4,13 @@ xSTUDIO can be built in just a few steps on many Linux distros by employing Micr ### Base dependencies -We assume that you have some knowledge of development on Linux platforms and have git, gcc & cmake installed on your system. +We assume that you have some knowledge of development on Linux platforms and have git, gcc and cmake installed on your system. You also need Ninja, which xSTUDIO uses as its CMake generator on all platforms. Install it via your distro's package manager: + + # Rocky / RHEL / Fedora + sudo dnf install ninja-build + + # Ubuntu / Debian + sudo apt install ninja-build ### Download and install Qt 6.5.3 SDK @@ -12,11 +18,11 @@ Follow [these instructions](downloading_qt.md) - ensuring that you download the ### Download the VCPKG repo -To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo, run the bootstrap script and then switch to a specific git commit before we build xstudio. Run these commands in the Powershell: +To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo and run the bootstrap script before we build xstudio. Run these commands in a terminal: git clone https://github.com/microsoft/vcpkg.git + git -C vcpkg checkout c2aeddd80357b17592e59ad965d2adf65a19b22f ./vcpkg/bootstrap-vcpkg.sh - git checkout c2aeddd80357b17592e59ad965d2adf65a19b22f ### Download the xSTUDIO repo @@ -26,34 +32,45 @@ Download from github in the usual manner. Enter the root folder of the repo and cd xstudio git checkout develop -You must run these commands to add the OpenTimelineIO submodule to the tree - - git submodule init - git submodule update - git apply cmake/otio_patch.diff +### Tell CMake where Qt is installed -### Modify the CMakePresets.json file +CMake needs to know where your Qt 6.5.3 SDK is installed. Create a `CMakeUserPresets.json` file alongside `CMakePresets.json` in the repo root. This file is gitignored, so your local path won't be committed. The user preset should have a different name from the tracked preset it inherits from, and add `Qt6_DIR` to `cacheVariables`. For example, if user Mary Jane downloaded Qt into her home folder: -Open the CMakePresets.json file (which is in the root of the xstudio repo) in a text editor. You must look for the entry "Qt6_DIR" and modify the value that follows it to point to your installation of the Qt SDK. Specifically, you need to point to a directory named 'Qt6' which is in a directory named 'cmake', which is in a directory named 'lib'. For example, if user Mary Jane downloaded Qt into her home folder the entry should look like this: + { + "version": 3, + "configurePresets": [ + { + "name": "LinuxNinjaReleaseLocal", + "inherits": "LinuxNinjaRelease", + "cacheVariables": { + "Qt6_DIR": "/home/maryjane/Qt/6.5.3/gcc_64/lib/cmake/Qt6" + } + } + ] + } - "Qt6_DIR": "/home/maryjane/Qt/6.5.3/gcc_64/lib/cmake/Qt6", +See the [CMake presets documentation](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) for the full format reference. ### Build xSTUDIO First, we configure for building. Note that this cmake command ***may take several hours to complete*** the first time it is run, though subsequently it will take a few seconds. This is because xSTUDIO's dependencies (particularly ffmpeg) take a long time to download and build from the source code, which is what VCPKG is doing. - - cmake -B build --preset LinuxRelease -When this has finished, you can build xSTUDIO with this command (in this case, the --parallel flag is set for a machine with 16 cores as an example). + cmake -B build --preset LinuxNinjaReleaseLocal - cmake --build build --parallel 16 +When this has finished, you can build xSTUDIO with: + + cmake --build build + +RelWithDebInfo and Debug variants are also available — see [CMakePresets.json](../../../CMakePresets.json) for the full list. ### Running xSTUDIO in a dev environment -If the compilation is successfull you will find the xstudio app in ./build/bin/xstudio.bin. To enable the python API, you will need to modify your PYTHONPATH evnironment variable like this, or something similar: +If the compilation is successful you will find the xstudio app in `./build/bin/xstudio.bin`. To enable the Python API, add the built site-packages directory to your `PYTHONPATH`: + + export PYTHONPATH=$PYTHONPATH:$(pwd)/build/bin/python/lib/python3.11/site-packages - export PYTHONPATH=$PYTHONPATH:./build/bin/python/lib/python3.10/site-packages +Run this from the xstudio repository root. The `python3.11` segment tracks whichever Python version vcpkg built — if you change the `python3` pin in `vcpkg.json`, update this path to match. ### Installing xSTUDIO -Correct packaging and installation of xstudio and its dependencies across various Linux distros is a problem we are still working on! For now, it is up to individual developers to do an effective installation on their system. You can try running 'make install' from the 'build' folder. Use -DCMAKE_BUILD_PREFIX={path} to set a test installation location +Correct packaging and installation of xstudio and its dependencies across various Linux distros is a problem we are still working on! For now, it is up to individual developers to do an effective installation on their system. You can try running `cmake --install build` from the repository root. Use -DCMAKE_BUILD_PREFIX={path} to set a test installation location diff --git a/docs/reference/build_guides/macos.md b/docs/reference/build_guides/macos.md index 68750717d..17d1eb3f3 100644 --- a/docs/reference/build_guides/macos.md +++ b/docs/reference/build_guides/macos.md @@ -12,9 +12,10 @@ Some of xSTUDIO's dependencies require 'homebrew', the MacOS open source softwar /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -We require 5 packages to be installed to proceed. Run these commands in a terminal: +We require these packages to be installed to proceed. xSTUDIO uses Ninja as its CMake generator on all platforms, so install it here as well. Run these commands in a terminal: brew install cmake + brew install ninja brew install pkg-config brew install nasm brew install autoconf @@ -24,18 +25,13 @@ We require 5 packages to be installed to proceed. Run these commands in a termin Follow [these instructions](downloading_qt.md) -> **NOTE:** Since Xcode version 26.X our specified version of Qt (6.5.3) is not strictly compatible with MacOS and you may see an error when you run the first 'cmake' command below. There are two options to resolve this. You can download Qt version 6.8.3 and use this instead of 6.5.3. Alternatively, open the file 'FindWrapOpenGL.cmake' within the Qt installation (at 6.5.3/macos/lib/cmake) and comment out lines 48 and 49 so that they look like this: - - #target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE ${__opengl_fw_path}) - #target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE ${__opengl_agl_fw_path}) - ### Download the VCPKG repo -To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo, run the bootstrap script and then switch to a specific git commit before we build xstudio. Run these commands in a terminal: +To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo and run the bootstrap script before we build xstudio. Run these commands in a terminal: git clone https://github.com/microsoft/vcpkg.git + git -C vcpkg checkout c2aeddd80357b17592e59ad965d2adf65a19b22f ./vcpkg/bootstrap-vcpkg.sh - git checkout c2aeddd80357b17592e59ad965d2adf65a19b22f ### Download the xSTUDIO repo @@ -45,32 +41,35 @@ Download from github in the usual manner. Enter the root folder of the repo and cd xstudio git checkout develop -You must run these commands to add the OpenTimelineIO submodule to the tree and apply a small patch +### Tell CMake where Qt is installed - git submodule init - git submodule update - git apply cmake/otio_patch.diff +CMake needs to know where your Qt 6.5.3 SDK is installed. Create a `CMakeUserPresets.json` file alongside `CMakePresets.json` in the repo root. This file is gitignored, so your local path won't be committed. The user preset should have a different name from the tracked preset it inherits from, and add `Qt6_DIR` to `cacheVariables`. For example, if user Mary Jane downloaded Qt into her home folder: -### Modify the CMakePresets.json file + { + "version": 3, + "configurePresets": [ + { + "name": "MacOSNinjaReleaseLocal", + "inherits": "MacOSNinjaRelease", + "cacheVariables": { + "Qt6_DIR": "/Users/maryjane/Qt/6.5.3/macos/lib/cmake/Qt6" + } + } + ] + } -Open the CMakePresets.json file (which is in the root of the xstudio repo) in a text editor. You must look for the entry "Qt6_DIR" and modify the value that follows it to point to your installation of the Qt SDK. Specifically, you need to point to a directory named 'Qt6' which is in a directory named 'cmake', which is in a directory named 'lib'. For example, on MacOS where user Mary Jane downloaded Qt into her home folder the entry should look like this: - - "Qt6_DIR": "/Users/maryjane/Qt/6.5.3/macos/lib/cmake/Qt6", +For an Intel Mac, inherit from `MacOSIntelNinjaRelease` instead. See the [CMake presets documentation](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) for the full format reference. ### Build xSTUDIO -Run the appropriate command for your platform (whether you have an older Intel or a newer Apple Silicon machine) to set-up for building. Note that this cmake command ***may take several hours to complete***. This is because xSTUDIO's dependencies (particularly ffmpeg) take a long time to download and build from the source code, which is what VCPKG is doing. - -**Apple Silicon (ARM) Machines:** - - cmake -B build --preset MacOSRelease +Run the configure command. Note that this cmake command ***may take several hours to complete***. This is because xSTUDIO's dependencies (particularly ffmpeg) take a long time to download and build from the source code, which is what VCPKG is doing. -**Intel Machines:** + cmake -B build --preset MacOSNinjaReleaseLocal - cmake -B build --preset MacOSIntelRelease +When this has finished, you can build xSTUDIO with: -When this has finished, you can build xSTUDIO with this command. + cmake --build build --target install - cmake --build build --parallel 16 --target install +RelWithDebInfo and Debug variants are also available — see [CMakePresets.json](../../../CMakePresets.json) for the full list. -If the build is successful, you should have an application bundle in the 'build' folder called 'xSTUDIO.app'. This can be drag & dropped into your applications folder, desktop and dock as for any other application. \ No newline at end of file +If the build is successful, you should have an application bundle in the 'build' folder called 'xSTUDIO.app'. This can be drag & dropped into your applications folder, desktop and dock as for any other application. diff --git a/docs/reference/build_guides/windows.md b/docs/reference/build_guides/windows.md index f091804d4..e1a9cf197 100644 --- a/docs/reference/build_guides/windows.md +++ b/docs/reference/build_guides/windows.md @@ -12,6 +12,7 @@ Get it here: [Git Download](https://git-scm.com/download/win) Get it here: [Microsoft Visual Studio](https://visualstudio.microsoft.com/vs/) Ensure CMake tools for Windows is included on install. [CMake projects in Visual Studio](https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170#installation) +The "CMake tools" component bundles `cmake` and `ninja` (xSTUDIO's CMake generator) along with the MSVC compiler, so no separate install is needed. Restart your machine after Visual Studio finishes installing. ### Download and install Qt 6.5.3 SDK @@ -29,11 +30,11 @@ Start a Windows Powershell to continue these instructions, where you must run a mkdir dev cd dev -To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo, run the bootstrap script and then switch to a specific git commit before we build xstudio. Run these commands in the Powershell: +To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo and run the bootstrap script before we build xstudio. Run these commands in the Powershell: git clone https://github.com/microsoft/vcpkg.git + git -C vcpkg checkout c2aeddd80357b17592e59ad965d2adf65a19b22f ./vcpkg/bootstrap-vcpkg.bat - git checkout c2aeddd80357b17592e59ad965d2adf65a19b22f ### Download the xSTUDIO repo @@ -43,50 +44,54 @@ Download from github in the usual manner. Enter the root folder of the repo and cd xstudio git checkout develop -You must run these commands to add the OpenTimelineIO submodule to the tree and apply a small patch: +### Tell CMake where Qt is installed - git submodule init - git submodule update - git apply cmake/otio_patch.diff +CMake needs to know where your Qt 6.5.3 SDK is installed. Create a `CMakeUserPresets.json` file alongside `CMakePresets.json` in the repo root. This file is gitignored, so your local path won't be committed. The user preset should have a different name from the tracked preset it inherits from, and add `Qt6_DIR` to `cacheVariables`. For example, if user Mary Jane downloaded Qt into the root of her C: drive: -### Modify the CMakePresets.json file + { + "version": 3, + "configurePresets": [ + { + "name": "WinNinjaReleaseLocal", + "inherits": "WinNinjaRelease", + "cacheVariables": { + "Qt6_DIR": "C:/Qt/6.5.3/msvc2019_64/lib/cmake/Qt6" + } + } + ] + } -Open the CMakePresets.json file (which is in the root of the xstudio repo) in a text editor. You must look for the entry "Qt6_DIR" and modify the value that follows it to point to your installation of the Qt SDK. Specifically, you need to point to a directory named 'Qt6' which is in a directory named 'cmake', which is in a directory named 'lib'. For example, on Windows where user Mary Jane downloaded Qt into the root of her C: drive the entry should look like this: +See the [CMake presets documentation](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) for the full format reference. - "Qt6_DIR": ""C:/Qt6/6.5.3/msvc2019_64/lib/cmake/Qt6", +### Set up the build environment -### Build xSTUDIO - -Run the first cmake command to set-up for building. Note that this cmake command ***may take several hours to complete***. This is because xSTUDIO's dependencies (particularly ffmpeg) take a long time to download and build from the source code, which is what VCPKG is doing. - -First, you may need to find the path to the 'cmake.exe' tool that is part of the VisualStudio install. Substitute as appropriate into the following commands as appropriate. - - 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe' -B build --preset WinRelease - -When this has finished, you can build xSTUDIO with this command. Note the value after --parallel: change this number to match the number of cores your machine has for best build times. +The `cmake` and `ninja` tools, along with the MSVC compiler, are bundled with Visual Studio 2022's "CMake tools" component but are not on your `PATH` by default. Make them available in your PowerShell session by entering the Visual Studio Developer Shell: - 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe' --build build --parallel 16 --target PACKAGE --config Release + Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" + Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\2022\Community" -Arch amd64 -SkipAutomaticLocation -If the build is successful, you should have an exectuable in the 'build' folder called something like 'xSTUDIO-1.2.0-win64.exe'. This can be executed to start the xSTUDIO installer. +After running those two commands, `cmake` and `ninja` will resolve directly from the command line for the rest of the session, and the build commands below work as shown. -### Alternative: Build with Ninja (faster builds) +### Build xSTUDIO -Ninja is significantly faster than MSBuild as it parallelises at the file level. Both Ninja and cmake are included with Visual Studio's CMake tools, so no separate install is needed. +Note that the first cmake command below ***may take several hours to complete***. This is because xSTUDIO's dependencies (particularly ffmpeg) take a long time to download and build from the source code, which is what VCPKG is doing. -First, set up the Visual Studio build environment in your Powershell session. This puts the MSVC compiler, cmake and ninja on your PATH: +Configure: - Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" - Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\2022\Community" -Arch amd64 + cmake -B build --preset WinNinjaReleaseLocal -Run the cmake command to configure for building. Note that this cmake command ***may take several hours to complete***. This is because xSTUDIO's dependencies (particularly ffmpeg) take a long time to download and build from the source code, which is what VCPKG is doing. +Build: - cmake -B build --preset WinNinjaRelease + cmake --build build --target package -When this has finished, you can build xSTUDIO with this command. Ninja handles parallelism automatically so there is no need for the `--parallel` flag. +> **Note:** `--target package` produces the NSIS installer and is significantly slower than a plain build. When iterating during development, drop the `--target package` flag and just run `cmake --build build`. - cmake --build build --target PACKAGE +RelWithDebInfo and Debug variants are also available — see [CMakePresets.json](../../../CMakePresets.json) for the full list. If the build is successful, you should have an executable in the 'build' folder called something like 'xSTUDIO-1.2.0-win64.exe'. This can be executed to start the xSTUDIO installer. -For additional tips for **developers** follow [this link](developer_tips.md) +### Running xSTUDIO from the build tree (dev workflow) + +For a quick dev run without going through the installer, the build generates a launcher at `build/run_xstudio.bat`. Arguments are forwarded to xstudio: + .\build\run_xstudio.bat path\to\session.xst diff --git a/extern/otio/CMakeLists.txt b/extern/otio/CMakeLists.txt deleted file mode 100644 index 0118ecc22..000000000 --- a/extern/otio/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -set(OTIO_PYTHON_INSTALL ON) -set(OTIO_DEPENDENCIES_INSTALL OFF) -set(OTIO_INSTALL_PYTHON_MODULES ON) -set(OTIO_INSTALL_COMMANDLINE_TOOLS OFF) -set(OTIO_FIND_IMATH ON) -set(OTIO_PYTHON_INSTALL_DIR python) - -if (APPLE) - #install directly into VCPKG pythin installation. This gets copied into xSTUDIO.app installation - set(CMAKE_INSTALL_PREFIX "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/${PYTHONVP}/site-packages") -else() - set(CMAKE_INSTALL_PREFIX "bin/python") -endif() - -# Build options -if (WIN32) - set(OTIO_SHARED_LIBS OFF) -else() - set(OTIO_SHARED_LIBS ON) -endif() - -set(OTIO_AUTOMATIC_SUBMODULES ON) - -find_package(Python COMPONENTS Interpreter Development) -find_package(pybind11 CONFIG) - -add_subdirectory("OpenTimelineIO") \ No newline at end of file diff --git a/extern/otio/OpenTimelineIO b/extern/otio/OpenTimelineIO deleted file mode 160000 index 4440afaa2..000000000 --- a/extern/otio/OpenTimelineIO +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4440afaa27b16f81cdf81215ce4d0b08e1424148 diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 703487c5b..c358a307b 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -51,7 +51,7 @@ if(NOT APPLE) if(INSTALL_PYTHON_MODULE) if (WIN32) - install(DIRECTORY ${OUTPUT}/Lib/site-packages/xstudio + install(DIRECTORY ${OUTPUT}/lib/${PYTHONVP}/site-packages/xstudio DESTINATION bin/python3/Lib/site-packages) else() install(DIRECTORY ${OUTPUT}/lib/${PYTHONVP}/site-packages/xstudio diff --git a/scripts/qt_install/CMakeLists.txt b/scripts/qt_install/CMakeLists.txt index d97074dd6..7c59a03c3 100644 --- a/scripts/qt_install/CMakeLists.txt +++ b/scripts/qt_install/CMakeLists.txt @@ -1,2 +1,8 @@ -#After everything else is installed, windeployqt will scan the contents and package up Qt dependencies. -install(CODE "execute_process(COMMAND ${Qt6_DIR}/../../../bin/windeployqt.exe ${CMAKE_INSTALL_PREFIX}/bin/xstudio.exe --qmldir ${CMAKE_SOURCE_DIR}/ui)" ) \ No newline at end of file +# After everything else is installed, windeployqt will scan the contents and package up Qt dependencies. + +get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) +get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) +find_program(windeployqt_exe windeployqt HINTS "${_qt_bin_dir}") + +configure_file(qt_install.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/qt_install.cmake @ONLY) +install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/qt_install.cmake) diff --git a/scripts/qt_install/qt_install.cmake.in b/scripts/qt_install/qt_install.cmake.in new file mode 100644 index 000000000..53aa5e9f8 --- /dev/null +++ b/scripts/qt_install/qt_install.cmake.in @@ -0,0 +1,3 @@ +message("Running windeployqt... with args: ${CMAKE_INSTALL_PREFIX}/bin/xstudio.exe --qmldir @CMAKE_SOURCE_DIR@/ui") +execute_process(COMMAND "@windeployqt_exe@" "${CMAKE_INSTALL_PREFIX}/bin/xstudio.exe" --qmldir "@CMAKE_SOURCE_DIR@/ui" + WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}") diff --git a/src/launch/xstudio/src/CMakeLists.txt b/src/launch/xstudio/src/CMakeLists.txt index f2166ca74..aa460f563 100644 --- a/src/launch/xstudio/src/CMakeLists.txt +++ b/src/launch/xstudio/src/CMakeLists.txt @@ -108,11 +108,15 @@ if(WIN32) file(GLOB FFMPEG_COMPONENTS ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/ffmpeg/*) install(FILES ${FFMPEG_COMPONENTS} DESTINATION bin) - get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) - get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) - find_program(windeployqt_exe windeployqt HINTS "${_qt_bin_dir}") - configure_file(windeploy.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/windeploy.cmake @ONLY) - install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/windeploy.cmake) + # Note: windeployqt for Windows is run from scripts/qt_install so it executes + # after all other install rules have populated the install tree. + + # Generate a dev-only launcher that puts Qt's bin dir on PATH, so xstudio + # can be run from the build tree without a windeployqt pass. + get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) + get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) + file(TO_NATIVE_PATH "${_qt_bin_dir}" _qt_bin_dir) + configure_file(run_xstudio.bat.in ${CMAKE_BINARY_DIR}/run_xstudio.bat @ONLY) elseif(APPLE) diff --git a/src/launch/xstudio/src/run_xstudio.bat.in b/src/launch/xstudio/src/run_xstudio.bat.in new file mode 100644 index 000000000..c701e3e6f --- /dev/null +++ b/src/launch/xstudio/src/run_xstudio.bat.in @@ -0,0 +1,7 @@ +@echo off +REM Dev-only launcher for xstudio.exe from the build tree. +REM Adds Qt's bin directory to PATH so Qt DLLs resolve without needing +REM an install or windeployqt run. Generated by CMake; do not edit. + +set "PATH=@_qt_bin_dir@;%~dp0bin;%PATH%" +"%~dp0bin\xstudio.exe" %* diff --git a/src/launch/xstudio/src/windeploy.cmake.in b/src/launch/xstudio/src/windeploy.cmake.in deleted file mode 100644 index 96ec0940d..000000000 --- a/src/launch/xstudio/src/windeploy.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ -message("Running windeployqt... with args: ${CMAKE_INSTALL_PREFIX}/bin/xstudio.exe --qmldir @CMAKE_SOURCE_DIR@/ui") -execute_process(COMMAND "@windeployqt_exe@" ${CMAKE_INSTALL_PREFIX}/bin/xstudio.exe --qmldir @CMAKE_SOURCE_DIR@/ui - WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}") \ No newline at end of file diff --git a/vcpkg.json b/vcpkg.json index 568453ff8..91a44e8d4 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -18,6 +18,7 @@ "openimageio", "openexr", "imath", + "opentimelineio", { "name": "ffmpeg", "features": [ @@ -76,6 +77,14 @@ { "name": "boost-modular-build-helper", "version": "1.84.0#3" + }, + { + "name": "opentimelineio", + "version": "0.17.0" + }, + { + "name": "python3", + "version": "3.11.11" } ] }