Skip to content

Commit 0c8e63e

Browse files
authored
Merge pull request #50 from mpkepic/windows
MS Windows 10/11 Automated Build Compatibility
2 parents 6cb9613 + 214b9e3 commit 0c8e63e

File tree

916 files changed

+66187
-13231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

916 files changed

+66187
-13231
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ python/src/xstudio.egg-info/
1010
python/test/xstudio.log
1111
docs/conf.py
1212
python/src/xstudio/version.py
13+
.vs/

CMakeLists.txt

Lines changed: 135 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,39 @@
11
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
22

3+
option(USE_VCPKG "Use Vcpkg for package management" OFF)
4+
if(WIN32)
5+
set(USE_VCPKG ON)
6+
endif()
7+
8+
if (USE_VCPKG)
9+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/vcpkg.cmake)
10+
endif()
11+
312
set(XSTUDIO_GLOBAL_VERSION "0.11.2" CACHE STRING "Version string")
413
set(XSTUDIO_GLOBAL_NAME xStudio)
514

615
project(${XSTUDIO_GLOBAL_NAME} VERSION ${XSTUDIO_GLOBAL_VERSION} LANGUAGES CXX)
716

17+
cmake_policy(VERSION 3.26)
18+
819
option(BUILD_TESTING "Build tests" OFF)
920
option(INSTALL_PYTHON_MODULE "Install python module" ON)
1021
option(INSTALL_XSTUDIO "Install xstudio" ON)
11-
option(BUILD_DOCS "Build xStudio documentation" ON)
22+
option(BUILD_DOCS "Build xStudio documentation" OFF)
1223
option(ENABLE_CLANG_TIDY "Enable clang-tidy, ninja clang-tidy." OFF)
1324
option(ENABLE_CLANG_FORMAT "Enable clang format, ninja clangformat." OFF)
1425
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)
1526
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" OFF)
1627
option(BUILD_RESKIN "Build xstudio reskin binary" ON)
1728

29+
30+
if(WIN32)
31+
set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Ob0 /Od /Oy-")
32+
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
33+
# enable UUID System Generator
34+
add_definitions(-DUUID_SYSTEM_GENERATOR=ON)
35+
endif()
36+
1837
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
1938

2039
set(STUDIO_PLUGINS "" CACHE STRING "Enable compilation of SITE plugins")
@@ -30,7 +49,9 @@ if (("${CMAKE_GENERATOR}" MATCHES "Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES "
3049
endif()
3150

3251
set(CXXOPTS_BUILD_TESTS OFF CACHE BOOL "Enable or disable cxxopts' tests")
33-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fmax-errors=5 -fdiagnostics-color=always")
52+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
53+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fmax-errors=5 -fdiagnostics-color=always")
54+
endif()
3455

3556
if (${OPTIMIZE_FOR_NATIVE})
3657
include(CheckCXXCompilerFlag)
@@ -50,18 +71,27 @@ if (NOT ${GCC_MARCH_OVERRIDE} STREQUAL "")
5071
endif()
5172
endif()
5273

53-
54-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fpic")
74+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
75+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fpic")
76+
endif()
5577

5678
set(TEST_RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/test_resource")
5779
set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
5880

59-
set(CMAKE_CXX_STANDARD 17)
81+
if(WIN32)
82+
set(CMAKE_CXX_STANDARD 20)
83+
add_compile_definitions($<$<CONFIG:Debug>:_ITERATOR_DEBUG_LEVEL=0>)
84+
else()
85+
set(CMAKE_CXX_STANDARD 17)
86+
endif()
87+
6088
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6189
set(CMAKE_INCLUDE_CURRENT_DIR ON)
6290
set(CMAKE_LINK_DEPENDS_NO_SHARED true)
6391

64-
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
92+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
93+
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
94+
endif()
6595
set(CMAKE_HAVE_THREADS_LIBRARY 1)
6696
set(CMAKE_USE_WIN32_THREADS_INIT 0)
6797
set(CMAKE_USE_PTHREADS_INIT 1)
@@ -73,10 +103,14 @@ set(REPROC++ ON)
73103
set(OpenGL_GL_PREFERENCE GLVND)
74104

75105
if (USE_SANITIZER STREQUAL "Address")
76-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
77-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
78-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
79-
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
106+
if(MSVC)
107+
target_compile_options(<target> PUBLIC /fsanitize=address)
108+
else()
109+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
110+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
111+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
112+
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
113+
endif()
80114
elseif (USE_SANITIZER STREQUAL "Thread")
81115
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread")
82116
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
@@ -123,7 +157,55 @@ if(ENABLE_CLANG_TIDY)
123157

124158
endif()
125159

126-
find_package(nlohmann_json REQUIRED)
160+
if(WIN32)
161+
ADD_DEFINITIONS(-DNOMINMAX)
162+
set(CMAKE_CXX_STANDARD 20)
163+
add_compile_options(/permissive-)
164+
165+
# Workaround for C++ 20+ comparisons in nlohmann json
166+
# https://github.com/nlohmann/json/issues/3868#issuecomment-1563726354
167+
add_definitions(-DJSON_HAS_THREE_WAY_COMPARISON=OFF)
168+
169+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
170+
171+
# When moving to Qt6 or greater, we might be able to use qt_generate_deploy_app_script
172+
#set(deploy_script "${Qt5_DIR}/../../../windeployqt.exe )
173+
endif()
174+
175+
if(MSVC)
176+
#Getenv complains, would be good to fix later but tired of seeing this for now.
177+
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
178+
179+
endif()
180+
181+
# Add the necessary libraries from Vcpkg if Vcpkg integration is enabled
182+
if(USE_VCPKG)
183+
184+
set(VCPKG_INTEGRATION ON)
185+
# Set Python in VCPKG
186+
set(Python_EXECUTABLE "${VCPKG_DIRECTORY}/../vcpkg_installed/x64-windows/tools/python3/python.exe")
187+
# Install pip and sphinx
188+
execute_process(
189+
COMMAND "${CMAKE_COMMAND}" -E env "PATH=${VCPKG_DIRECTORY}/../vcpkg_installed/x64-windows/tools/python3" python.exe -m ensurepip --upgrade
190+
RESULT_VARIABLE ENSUREPIP_RESULT
191+
)
192+
if(ENSUREPIP_RESULT)
193+
message(FATAL_ERROR "Failed to ensurepip.")
194+
else()
195+
execute_process(
196+
COMMAND "${CMAKE_COMMAND}" -E env "PATH=${VCPKG_DIRECTORY}/../vcpkg_installed/x64-windows/tools/python3" python.exe -m pip install setuptools sphinx breathe sphinx-rtd-theme OpenTimelineIO importlib_metadata zipp
197+
RESULT_VARIABLE PIP_RESULT
198+
)
199+
if(PIP_RESULT)
200+
message(FATAL_ERROR "Failed to install Sphinx using pip.")
201+
endif()
202+
endif()
203+
# append vcpkg packages
204+
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIRECTORY}/../vcpkg_installed/x64-windows")
205+
206+
endif()
207+
208+
find_package(nlohmann_json CONFIG REQUIRED)
127209
include(CTest)
128210

129211
if(ENABLE_CLANG_FORMAT)
@@ -136,18 +218,31 @@ if(ENABLE_CLANG_FORMAT)
136218
clangformat_setup(${FORMAT_ITEMS})
137219
endif()
138220

139-
140221
if(INSTALL_PYTHON_MODULE)
141222
add_subdirectory(python)
142223
endif()
143224

144225
add_subdirectory(src)
145226

146227
if(INSTALL_XSTUDIO)
228+
229+
230+
# add extern libs that are build-time dependencies of xstudio
231+
if (UNIX)
232+
add_subdirectory("extern/reproc")
233+
endif()
234+
add_subdirectory("extern/quickfuture")
235+
add_subdirectory("extern/quickpromise")
236+
147237
add_subdirectory(share/preference)
148238
add_subdirectory(share/snippets)
149239
add_subdirectory(share/fonts)
150240

241+
install(DIRECTORY include/xstudio
242+
DESTINATION include)
243+
244+
INSTALL(DIRECTORY extern/ DESTINATION extern)
245+
151246
if(BUILD_DOCS)
152247
if(NOT INSTALL_PYTHON_MODULE)
153248
add_subdirectory(python)
@@ -157,6 +252,33 @@ if(INSTALL_XSTUDIO)
157252
install(DIRECTORY share/docs/ DESTINATION share/xstudio/docs)
158253
endif ()
159254

255+
include(CMakePackageConfigHelpers)
256+
257+
configure_package_config_file(xStudioConfig.cmake.in
258+
${CMAKE_CURRENT_BINARY_DIR}/xStudioConfig.cmake
259+
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
260+
)
261+
write_basic_package_version_file("xStudioConfigVersion.cmake"
262+
VERSION ${PROJECT_VERSION}
263+
COMPATIBILITY SameMajorVersion
264+
)
265+
266+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xStudioConfig.cmake
267+
${CMAKE_CURRENT_BINARY_DIR}/xStudioConfigVersion.cmake
268+
DESTINATION lib/cmake/${PROJECT_NAME}
269+
)
270+
271+
install(EXPORT xstudio
272+
DESTINATION lib/cmake/${PROJECT_NAME}
273+
FILE ${PROJECT_NAME}Targets.cmake
274+
NAMESPACE xstudio::
275+
EXPORT_LINK_INTERFACE_LIBRARIES
276+
)
277+
160278
endif ()
161279

162-
add_subdirectory("extern/reproc")
280+
if(USE_VCPKG)
281+
# To provide reliable ordering, we need to make this install script happen in a subdirectory.
282+
# Otherwise, Qt deploy will happen before we have the rest of the application deployed.
283+
add_subdirectory("scripts/qt_install")
284+
endif()

CMakePresets.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"name": "windows-base",
6+
"condition": {
7+
"type": "equals",
8+
"lhs": "${hostSystemName}",
9+
"rhs": "Windows"
10+
},
11+
"hidden": true,
12+
"generator": "Ninja",
13+
"binaryDir": "${sourceDir}/build",
14+
"cacheVariables": {
15+
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/build/vcpkg/scripts/buildsystems/vcpkg.cmake",
16+
"Qt5_DIR": "C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5/",
17+
"CMAKE_INSTALL_PREFIX": "C:/xstudio_install",
18+
"X_VCPKG_APPLOCAL_DEPS_INSTALL": "ON",
19+
"BUILD_DOCS": "OFF"
20+
}
21+
},
22+
{
23+
"name": "Release",
24+
"inherits": ["windows-base"],
25+
"cacheVariables": {
26+
"CMAKE_BUILD_TYPE": "Release"
27+
}
28+
},
29+
{
30+
"name": "RelWithDebInfo",
31+
"inherits": ["windows-base"],
32+
"cacheVariables": {
33+
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
34+
"USE_SANITIZER": "address"
35+
}
36+
},
37+
{
38+
"name": "Debug",
39+
"hidden": true,
40+
"inherits": ["windows-base"],
41+
"cacheVariables": {
42+
"CMAKE_BUILD_TYPE": "Debug",
43+
"USE_SANITIZER": "address"
44+
}
45+
}
46+
]
47+
}

NOTICE.TXT

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,31 @@ Foundation, and Bitstream Inc., shall not be used in advertising or
9191
otherwise to promote the sale, use or other dealings in this Font
9292
Software without prior written authorization from the Gnome Foundation
9393
or Bitstream Inc., respectively. For further information, contact:
94-
fonts at gnome dot org.
94+
fonts at gnome dot org.
95+
96+
97+
zstr
98+
99+
Located in extern/include/
100+
101+
The MIT License (MIT)
102+
103+
Copyright (c) 2015 Matei David, Ontario Institute for Cancer Research
104+
105+
Permission is hereby granted, free of charge, to any person obtaining a copy
106+
of this software and associated documentation files (the "Software"), to deal
107+
in the Software without restriction, including without limitation the rights
108+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
109+
copies of the Software, and to permit persons to whom the Software is
110+
furnished to do so, subject to the following conditions:
111+
112+
The above copyright notice and this permission notice shall be included in all
113+
copies or substantial portions of the Software.
114+
115+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
116+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
117+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
118+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
120+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
121+
SOFTWARE.

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22

33
xSTUDIO is a media playback and review application designed for professionals working in the film and TV post production industries, particularly the Visual Effects and Feature Animation sectors. xSTUDIO is focused on providing an intuitive, easy to use interface with a high performance playback engine at its core and C++ and Python APIs for pipeline integration and customisation for total flexibility.
44

5-
## Building xSTUDIO for MS Windows
5+
## Building xSTUDIO
66

7-
You can now build and run xSTUDIO on MS Windows. However, work towards full Windows compatibility is still in its final phase and the updates are therefore not yet merged into the main branch here. To access the Windows compatible codebase please follow [this link](https://github.com/mpkepic/xstudio/tree/windows).
7+
This release of xSTUDIO can be built on various Linux flavours and Windows 10 and 11. MacOS compatibility is not available yet but this work is on the roadmap for 2024.
88

9-
## Building xSTUDIO for Linux
9+
We provide comprehensive build steps for 4 of the most popular distributions.
1010

11-
We provide comprehensive build steps for 3 of the most popular Linux distributions:
11+
### Building xSTUDIO for Linux
1212

1313
* [CentOS 7](docs/build_guides/centos_7.md)
1414
* [Rocky Linux 9.1](docs/build_guides/rocky_linux_9_1.md)
1515
* [Ubuntu 22.04](docs/build_guides/ubuntu_22_04.md)
1616

17-
Note that the xSTUDIO user guide is built with Sphinx using the Read-The-Docs theme. The package dependencies for building the docs are somewhat onerous to install and as such we have ommitted these steps from the instructions and instead recommend that you turn off the docs build. Instead, we include the fully built docs (as html pages) as part of this repo and building xSTUDIO will install these pages so that they can be loaded into your browser via the Help menu in the main UI.
17+
### Building xSTUDIO for Windows
18+
19+
* [Windows](docs/build_guides/windows.md)
20+
21+
### Building xSTUDIO for MacOS
1822

19-
## Building xSTUDIO for MacOS
23+
MacOS compatibility is not yet available. Watch this space!
2024

21-
MacOS compatibility is not yet available but it is due in Q3 or Q4 2023. Watch this space!
25+
### Documentation Note
26+
27+
Note that the xSTUDIO user guide is built with Sphinx using the Read-The-Docs theme. The package dependencies for building the docs are somewhat onerous to install and as such we have ommitted these steps from the instructions and instead recommend that you turn off the docs build. Instead, we include the fully built docs (as html pages) as part of this repo and building xSTUDIO will install these pages so that they can be loaded into your browser via the Help menu in the main UI.

0 commit comments

Comments
 (0)