Skip to content

Commit e9ae2d7

Browse files
OlafRockettedwaine
authored andcommitted
Build system improvements: OTIO vcpkg overlay migration, general fixes, cross-platform docs (#246)
* Build system improvements: OTIO vcpkg migration, Windows fixes, cross-platform docs Core build system ----------------- - Migrate OpenTimelineIO from git submodule to vcpkg overlay port (cmake/vcpkg_overlay_ports/opentimelineio/). Removes extern/otio, .gitmodules, cmake/otio_patch.diff, and the OTIO_SUBMODULE option. - OTIO portfile: on Windows, move .dll files from lib/ to bin/ (vcpkg convention for applocal.ps1 discovery) and rewrite generated Targets-*.cmake files so IMPORTED_LOCATION resolves correctly. - Pin python3 to 3.11.11 in vcpkg.json. - Lower CMake minimum from 3.28 to 3.26 for broader distro compatibility. - Work around Qt 6.5/6.8 FindWrapOpenGL.cmake AGL bug on macOS by pre-creating WrapOpenGL::WrapOpenGL so Qt's find-module early-returns. Fixed upstream in Qt 6.9+; workaround can be removed once minimum supported Qt >= 6.9. CMakePresets ------------ - Remove hardcoded Qt6_DIR from the default preset. Users now supply it via the Qt6_DIR environment variable, a CMakeUserPresets.json, or a one-off -D flag (documented in each build guide). - Add VCPKG_OVERLAY_PORTS path so the new OTIO overlay is picked up. - Add Ninja generator presets for macOS (arm / intel) and Linux — Release, RelWithDebInfo and Debug variants. Aligns with existing Windows Ninja presets. - Un-hide WinDebug preset. - Add VCPKG_OVERLAY_TRIPLETS to the Linux base preset. Windows build fixes ------------------- - Fix scripts/qt_install to use install(SCRIPT) + configure_file instead of install(CODE), so ${CMAKE_INSTALL_PREFIX} resolves at install time. Previously the configure-time prefix was baked in, which broke the CPack package target because CPack uses a different (staging) prefix. - Remove the redundant early windeployqt call in src/launch/xstudio/src. The late call in scripts/qt_install now covers everything and runs after all other install rules have populated the install tree. - In cmake/macros.cmake (default_options_qt), add RUNTIME_OUTPUT_DIRECTORY alongside LIBRARY_OUTPUT_DIRECTORY so *_qml.dll files land in build/bin on Windows (Windows uses RUNTIME for .dll, not LIBRARY). - Fix Windows python install path mismatch in python/CMakeLists.txt: the build produces lib/python3.11/site-packages (Unix layout, because vcpkg's Python uses that layout on Windows), not Lib/site-packages. Dev workflow ------------ - Generate build/run_xstudio.bat — a dev launcher that puts Qt's bin directory on PATH and forwards arguments to xstudio.exe, so xstudio can be run straight from the build tree without a windeployqt pass. Documentation ------------- - downloading_qt.md: add aqtinstall instructions (command-line, no Qt account required) as a recommended alternative to the GUI installer. Covers Linux, macOS and Windows. - index.rst: add "Choosing a guide" section explaining the split between vcpkg-based guides (recommended) and distro-native guides (advanced). - linux_generic.md: restructured around the new Qt6_DIR / user-preset workflow, removed submodule instructions, added optional Ninja section. - macos.md: minor updates to reflect current dependency list and Qt workaround now handled in CMakeLists.txt. - windows.md: full rewrite — unified "Set up the build environment" section using Enter-VsDevShell with -SkipAutomaticLocation, separate build sections for Visual Studio and Ninja generators, corrected Qt path example (C:/Qt not C:/Qt6), user-preset examples for both generators, note on run_xstudio.bat dev launcher. Signed-off-by: Olaf Razzoli <olaf.razzoli@gmail.com> * docs: simplify build guides and pin vcpkg - Require Ninja as the CMake generator on all platforms; remove the "Faster builds with Ninja (optional)" sections and the Visual Studio generator option on Windows. - Pin vcpkg to commit c2aeddd80357b17592e59ad965d2adf65a19b22f in all three guides for reproducible dependency builds. - Document CMakeUserPresets.json as the single way to point CMake at the local Qt 6.5.3 install; drop the Qt6_DIR env-var and one-off -DQt6_DIR command-line paths. - Note that --target package on Windows is slow and recommend a plain cmake --build build for dev iteration. - Remove docs/reference/build_guides/developer_tips.md and the link to it from windows.md. Signed-off-by: Olaf Razzoli <olaf.razzoli@gmail.com> --------- Signed-off-by: Olaf Razzoli <olaf.razzoli@gmail.com> Signed-off-by: Ted Waine <ted.waine@gmail.com>
1 parent d2d4ab7 commit e9ae2d7

24 files changed

Lines changed: 384 additions & 171 deletions

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ python/src/xstudio/version.py
1414
/build/
1515
xstudio_install/
1616
**/qml/*_qml_export.h
17-
<<<<<<< HEAD
1817
CMakeUserPresets.json
19-
=======
2018
__build
2119
__build_debug
22-
>>>>>>> c808bb352 (WIP)
20+
aqtinstall.log

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
cmake_minimum_required(VERSION 3.28 FATAL_ERROR)
2-
cmake_policy(VERSION 3.28)
1+
cmake_minimum_required(VERSION 3.26 FATAL_ERROR)
2+
cmake_policy(VERSION 3.26)
3+
#cmake_minimum_required(VERSION 3.28 FATAL_ERROR)
4+
#cmake_policy(VERSION 3.28)
35

46
set(XSTUDIO_GLOBAL_VERSION "1.2.0" CACHE STRING "Version string")
57
set(XSTUDIO_GLOBAL_NAME xStudio)
@@ -8,6 +10,17 @@ set(XSTUDIO_GLOBAL_NAME xStudio)
810

911
project(${XSTUDIO_GLOBAL_NAME} VERSION ${XSTUDIO_GLOBAL_VERSION} LANGUAGES CXX)
1012

13+
# Work around Qt bug: FindWrapOpenGL.cmake links -framework AGL, which was
14+
# removed from the macOS SDK in 10.14. Fixed upstream in Qt 6.9+ but not
15+
# backported to 6.5/6.8 LTS (see https://codereview.qt-project.org/c/qt/qtbase/+/652022).
16+
# Pre-create the target so Qt's FindWrapOpenGL early-returns and never hits the
17+
# broken AGL block. Can be removed once the minimum supported Qt is >= 6.9.
18+
if(APPLE AND NOT TARGET WrapOpenGL::WrapOpenGL)
19+
find_package(OpenGL REQUIRED)
20+
add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED)
21+
target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::GL)
22+
endif()
23+
1124
option(BUILD_TESTING "Build tests" OFF)
1225
option(INSTALL_PYTHON_MODULE "Install python module" ON)
1326
option(INSTALL_XSTUDIO "Install xstudio" ON)
@@ -16,7 +29,6 @@ option(ENABLE_CLANG_TIDY "Enable clang-tidy, ninja clang-tidy." OFF)
1629
option(ENABLE_CLANG_FORMAT "Enable clang format, ninja clangformat." OFF)
1730
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)
1831
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" OFF)
19-
option(OTIO_SUBMODULE "Automatically build OpenTimelineIO as a submodule" OFF)
2032
option(USE_VCPKG "Use Vcpkg for package management" OFF)
2133
option(BUILD_PYSIDE_WIDGETS "Build xstudio player as PySide widget" OFF)
2234
option(OPENIMAGEIO_PLUGIN "Include the OpenImageIO PLugin" ON)
@@ -188,10 +200,6 @@ endif()
188200

189201
if (USE_VCPKG)
190202

191-
# When building with VCPKG, we will use OTIO submodule
192-
set(OTIO_SUBMODULE true)
193-
add_subdirectory("extern/otio")
194-
195203
set(VCPKG_INTEGRATION ON)
196204

197205
# Install pip and sphinx
@@ -218,14 +226,12 @@ if (USE_VCPKG)
218226

219227
else()
220228
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
221-
if(${OTIO_SUBMODULE})
222-
add_subdirectory("extern/otio")
223-
endif()
224229
find_package(PkgConfig REQUIRED)
225230
endif()
226231

227232
# Add the necessary libraries from Vcpkg if Vcpkg integration is enabled
228233

234+
find_package(OpenTimelineIO CONFIG REQUIRED)
229235
find_package(nlohmann_json CONFIG REQUIRED)
230236
include(CTest)
231237

CMakePresets.json

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"binaryDir": "${sourceDir}/build",
88
"cacheVariables": {
99
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../vcpkg/scripts/buildsystems/vcpkg.cmake",
10-
"Qt6_DIR": "/Users/tedwaine/Qt6/6.5.3/macos/lib/cmake/Qt6",
1110
"CMAKE_INSTALL_PREFIX": "xstudio_install",
1211
"X_VCPKG_APPLOCAL_DEPS_INSTALL": "ON",
1312
"BUILD_DOCS": "OFF",
1413
"USE_VCPKG": "ON",
1514
"STUDIO_PLUGINS": "",
16-
"BMD_DECKLINK_PLUGIN": "OFF"
15+
"BMD_DECKLINK_PLUGIN": "OFF",
16+
"VCPKG_OVERLAY_PORTS": "${sourceDir}/cmake/vcpkg_overlay_ports"
1717
}
1818
},
1919
{
@@ -44,7 +44,6 @@
4444
},
4545
{
4646
"name": "WinDebug",
47-
"hidden": true,
4847
"inherits": ["windows-base"],
4948
"cacheVariables": {
5049
"CMAKE_BUILD_TYPE": "Debug",
@@ -151,10 +150,67 @@
151150
"USE_SANITIZER": "address"
152151
}
153152
},
154-
{
153+
{
154+
"name": "macos-ninja-base-arm",
155+
"inherits": "macos-base-arm",
156+
"generator": "Ninja"
157+
},
158+
{
159+
"name": "macos-ninja-base-intel",
160+
"inherits": "macos-base-intel",
161+
"generator": "Ninja"
162+
},
163+
{
164+
"name": "MacOSNinjaRelease",
165+
"inherits": ["macos-ninja-base-arm"],
166+
"cacheVariables": {
167+
"CMAKE_BUILD_TYPE": "Release"
168+
}
169+
},
170+
{
171+
"name": "MacOSNinjaRelWithDebInfo",
172+
"inherits": ["macos-ninja-base-arm"],
173+
"cacheVariables": {
174+
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
175+
"USE_SANITIZER": "address"
176+
}
177+
},
178+
{
179+
"name": "MacOSNinjaDebug",
180+
"inherits": ["macos-ninja-base-arm"],
181+
"cacheVariables": {
182+
"CMAKE_BUILD_TYPE": "Debug",
183+
"USE_SANITIZER": "address"
184+
}
185+
},
186+
{
187+
"name": "MacOSIntelNinjaRelease",
188+
"inherits": ["macos-ninja-base-intel"],
189+
"cacheVariables": {
190+
"CMAKE_BUILD_TYPE": "Release"
191+
}
192+
},
193+
{
194+
"name": "MacOSIntelNinjaRelWithDebInfo",
195+
"inherits": ["macos-ninja-base-intel"],
196+
"cacheVariables": {
197+
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
198+
"USE_SANITIZER": "address"
199+
}
200+
},
201+
{
202+
"name": "MacOSIntelNinjaDebug",
203+
"inherits": ["macos-ninja-base-intel"],
204+
"cacheVariables": {
205+
"CMAKE_BUILD_TYPE": "Debug",
206+
"USE_SANITIZER": "address"
207+
}
208+
},
209+
{
155210
"name": "linux-base",
156211
"inherits": "default",
157212
"cacheVariables": {
213+
"VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/cmake/vcpkg_triplets",
158214
"VCPKG_TARGET_TRIPLET": "x64-xstudio-linux"
159215
}
160216
},
@@ -180,6 +236,34 @@
180236
"CMAKE_BUILD_TYPE": "Debug",
181237
"USE_SANITIZER": "address"
182238
}
239+
},
240+
{
241+
"name": "linux-ninja-base",
242+
"inherits": "linux-base",
243+
"generator": "Ninja"
244+
},
245+
{
246+
"name": "LinuxNinjaRelease",
247+
"inherits": ["linux-ninja-base"],
248+
"cacheVariables": {
249+
"CMAKE_BUILD_TYPE": "Release"
250+
}
251+
},
252+
{
253+
"name": "LinuxNinjaRelWithDebInfo",
254+
"inherits": ["linux-ninja-base"],
255+
"cacheVariables": {
256+
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
257+
"USE_SANITIZER": "address"
258+
}
259+
},
260+
{
261+
"name": "LinuxNinjaDebug",
262+
"inherits": ["linux-ninja-base"],
263+
"cacheVariables": {
264+
"CMAKE_BUILD_TYPE": "Debug",
265+
"USE_SANITIZER": "address"
266+
}
183267
}
184268
]
185269
}

cmake/macros.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ macro(default_options_qt name)
308308
set_target_properties(${name}
309309
PROPERTIES
310310
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/lib"
311+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
311312
)
312313
install(TARGETS ${name} EXPORT xstudio
313314
LIBRARY DESTINATION share/xstudio/lib)

cmake/otio_patch.diff

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
--- a/CMakeLists.txt
3+
+++ b/CMakeLists.txt
4+
@@ -245,7 +245,7 @@
5+
endif()
6+
7+
# set up the internally hosted dependencies
8+
-add_subdirectory(src/deps)
9+
+# add_subdirectory(src/deps)
10+
11+
set (OTIO_IMATH_TARGETS
12+
# For OpenEXR/Imath 3.x:
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO AcademySoftwareFoundation/OpenTimelineIO
4+
REF v${VERSION}
5+
SHA512 305d63730446c3b4c368cadd9d7a66de96dafee2168d589ae88a0320319f40cde4a739c9939eb088b635185cb1aabd051360ed432fde3ce11ef145e18c25dd21
6+
HEAD_REF main
7+
PATCHES
8+
0001-disable-src-deps-subdir.patch
9+
)
10+
11+
vcpkg_from_github(
12+
OUT_SOURCE_PATH RAPIDJSON_SOURCE_PATH
13+
REPO Tencent/rapidjson
14+
REF 06d58b9e848c650114556a23294d0b6440078c61
15+
SHA512 f0a7df46234e5b3244a801ddf1daefd26aac7ae5b2c470b8c3898f65c65591f6c9cabac0421800588826da9d3bcccba1f98e1c0c8c15184b3843cf6f3ffbdcad
16+
HEAD_REF master
17+
)
18+
19+
file(COPY "${RAPIDJSON_SOURCE_PATH}/include"
20+
DESTINATION "${SOURCE_PATH}/src/deps/rapidjson")
21+
22+
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" OTIO_SHARED)
23+
24+
vcpkg_cmake_configure(
25+
SOURCE_PATH "${SOURCE_PATH}"
26+
OPTIONS
27+
-DOTIO_SHARED_LIBS=${OTIO_SHARED}
28+
-DOTIO_PYTHON_INSTALL=OFF
29+
-DOTIO_DEPENDENCIES_INSTALL=OFF
30+
-DOTIO_FIND_IMATH=ON
31+
-DOTIO_CXX_INSTALL=ON
32+
-DOTIO_AUTOMATIC_SUBMODULES=OFF
33+
-DOTIO_INSTALL_COMMANDLINE_TOOLS=OFF
34+
)
35+
36+
vcpkg_cmake_install()
37+
38+
vcpkg_cmake_config_fixup(
39+
PACKAGE_NAME opentimelineio
40+
CONFIG_PATH share/opentimelineio
41+
)
42+
vcpkg_cmake_config_fixup(
43+
PACKAGE_NAME opentime
44+
CONFIG_PATH share/opentime
45+
)
46+
47+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
48+
49+
# OTIO's upstream CMake installs shared libraries (.dll) into lib/ on Windows,
50+
# but vcpkg's convention (and applocal.ps1's search path) expects DLLs in bin/.
51+
# Move them so they get picked up by dependency deployment, and fix up the
52+
# generated CMake targets files so IMPORTED_LOCATION still resolves.
53+
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
54+
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
55+
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
56+
file(GLOB _otio_release_dlls "${CURRENT_PACKAGES_DIR}/lib/*.dll")
57+
foreach(_dll ${_otio_release_dlls})
58+
get_filename_component(_name "${_dll}" NAME)
59+
file(RENAME "${_dll}" "${CURRENT_PACKAGES_DIR}/bin/${_name}")
60+
endforeach()
61+
file(GLOB _otio_debug_dlls "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll")
62+
foreach(_dll ${_otio_debug_dlls})
63+
get_filename_component(_name "${_dll}" NAME)
64+
file(RENAME "${_dll}" "${CURRENT_PACKAGES_DIR}/debug/bin/${_name}")
65+
endforeach()
66+
67+
# Rewrite the generated Targets-*.cmake files to reference the new DLL
68+
# locations. Only the .dll paths are changed; .lib (import library) paths
69+
# stay in lib/ where they belong.
70+
file(GLOB _otio_targets_files
71+
"${CURRENT_PACKAGES_DIR}/share/opentime/OpenTimeTargets-*.cmake"
72+
"${CURRENT_PACKAGES_DIR}/share/opentimelineio/OpenTimelineIOTargets-*.cmake"
73+
)
74+
foreach(_file ${_otio_targets_files})
75+
file(READ "${_file}" _content)
76+
string(REGEX REPLACE "/lib/([^/\"]*\\.dll)" "/bin/\\1" _content "${_content}")
77+
file(WRITE "${_file}" "${_content}")
78+
endforeach()
79+
endif()
80+
81+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "opentimelineio",
3+
"version": "0.17.0",
4+
"description": "A file format and API for describing editorial timelines",
5+
"homepage": "https://opentimeline.io",
6+
"license": "Apache-2.0",
7+
"dependencies": [
8+
"imath",
9+
{
10+
"name": "vcpkg-cmake",
11+
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
16+
}
17+
]
18+
}

docs/reference/build_guides/developer_tips.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)