Skip to content

Commit

Permalink
Merge pull request #50 from mpkepic/windows
Browse files Browse the repository at this point in the history
MS Windows 10/11 Automated Build Compatibility
  • Loading branch information
tedwaine authored Jul 23, 2024
2 parents 6cb9613 + 214b9e3 commit 0c8e63e
Show file tree
Hide file tree
Showing 916 changed files with 66,187 additions and 13,231 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ python/src/xstudio.egg-info/
python/test/xstudio.log
docs/conf.py
python/src/xstudio/version.py
.vs/
148 changes: 135 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

option(USE_VCPKG "Use Vcpkg for package management" OFF)
if(WIN32)
set(USE_VCPKG ON)
endif()

if (USE_VCPKG)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/vcpkg.cmake)
endif()

set(XSTUDIO_GLOBAL_VERSION "0.11.2" CACHE STRING "Version string")
set(XSTUDIO_GLOBAL_NAME xStudio)

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

cmake_policy(VERSION 3.26)

option(BUILD_TESTING "Build tests" OFF)
option(INSTALL_PYTHON_MODULE "Install python module" ON)
option(INSTALL_XSTUDIO "Install xstudio" ON)
option(BUILD_DOCS "Build xStudio documentation" ON)
option(BUILD_DOCS "Build xStudio documentation" OFF)
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(BUILD_RESKIN "Build xstudio reskin binary" ON)


if(WIN32)
set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Ob0 /Od /Oy-")
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
# enable UUID System Generator
add_definitions(-DUUID_SYSTEM_GENERATOR=ON)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

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

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

if (${OPTIMIZE_FOR_NATIVE})
include(CheckCXXCompilerFlag)
Expand All @@ -50,18 +71,27 @@ if (NOT ${GCC_MARCH_OVERRIDE} STREQUAL "")
endif()
endif()


set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fpic")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fpic")
endif()

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

set(CMAKE_CXX_STANDARD 17)
if(WIN32)
set(CMAKE_CXX_STANDARD 20)
add_compile_definitions($<$<CONFIG:Debug>:_ITERATOR_DEBUG_LEVEL=0>)
else()
set(CMAKE_CXX_STANDARD 17)
endif()

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_LINK_DEPENDS_NO_SHARED true)

set(CMAKE_THREAD_LIBS_INIT "-lpthread")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
endif()
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
Expand All @@ -73,10 +103,14 @@ set(REPROC++ ON)
set(OpenGL_GL_PREFERENCE GLVND)

if (USE_SANITIZER STREQUAL "Address")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
if(MSVC)
target_compile_options(<target> PUBLIC /fsanitize=address)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
endif()
elseif (USE_SANITIZER STREQUAL "Thread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
Expand Down Expand Up @@ -123,7 +157,55 @@ if(ENABLE_CLANG_TIDY)

endif()

find_package(nlohmann_json REQUIRED)
if(WIN32)
ADD_DEFINITIONS(-DNOMINMAX)
set(CMAKE_CXX_STANDARD 20)
add_compile_options(/permissive-)

# Workaround for C++ 20+ comparisons in nlohmann json
# https://github.com/nlohmann/json/issues/3868#issuecomment-1563726354
add_definitions(-DJSON_HAS_THREE_WAY_COMPARISON=OFF)

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# When moving to Qt6 or greater, we might be able to use qt_generate_deploy_app_script
#set(deploy_script "${Qt5_DIR}/../../../windeployqt.exe )
endif()

if(MSVC)
#Getenv complains, would be good to fix later but tired of seeing this for now.
add_definitions(-D_CRT_SECURE_NO_WARNINGS)

endif()

# Add the necessary libraries from Vcpkg if Vcpkg integration is enabled
if(USE_VCPKG)

set(VCPKG_INTEGRATION ON)
# Set Python in VCPKG
set(Python_EXECUTABLE "${VCPKG_DIRECTORY}/../vcpkg_installed/x64-windows/tools/python3/python.exe")
# Install pip and sphinx
execute_process(
COMMAND "${CMAKE_COMMAND}" -E env "PATH=${VCPKG_DIRECTORY}/../vcpkg_installed/x64-windows/tools/python3" python.exe -m ensurepip --upgrade
RESULT_VARIABLE ENSUREPIP_RESULT
)
if(ENSUREPIP_RESULT)
message(FATAL_ERROR "Failed to ensurepip.")
else()
execute_process(
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
RESULT_VARIABLE PIP_RESULT
)
if(PIP_RESULT)
message(FATAL_ERROR "Failed to install Sphinx using pip.")
endif()
endif()
# append vcpkg packages
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIRECTORY}/../vcpkg_installed/x64-windows")

endif()

find_package(nlohmann_json CONFIG REQUIRED)
include(CTest)

if(ENABLE_CLANG_FORMAT)
Expand All @@ -136,18 +218,31 @@ if(ENABLE_CLANG_FORMAT)
clangformat_setup(${FORMAT_ITEMS})
endif()


if(INSTALL_PYTHON_MODULE)
add_subdirectory(python)
endif()

add_subdirectory(src)

if(INSTALL_XSTUDIO)


# add extern libs that are build-time dependencies of xstudio
if (UNIX)
add_subdirectory("extern/reproc")
endif()
add_subdirectory("extern/quickfuture")
add_subdirectory("extern/quickpromise")

add_subdirectory(share/preference)
add_subdirectory(share/snippets)
add_subdirectory(share/fonts)

install(DIRECTORY include/xstudio
DESTINATION include)

INSTALL(DIRECTORY extern/ DESTINATION extern)

if(BUILD_DOCS)
if(NOT INSTALL_PYTHON_MODULE)
add_subdirectory(python)
Expand All @@ -157,6 +252,33 @@ if(INSTALL_XSTUDIO)
install(DIRECTORY share/docs/ DESTINATION share/xstudio/docs)
endif ()

include(CMakePackageConfigHelpers)

configure_package_config_file(xStudioConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/xStudioConfig.cmake
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
)
write_basic_package_version_file("xStudioConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xStudioConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/xStudioConfigVersion.cmake
DESTINATION lib/cmake/${PROJECT_NAME}
)

install(EXPORT xstudio
DESTINATION lib/cmake/${PROJECT_NAME}
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE xstudio::
EXPORT_LINK_INTERFACE_LIBRARIES
)

endif ()

add_subdirectory("extern/reproc")
if(USE_VCPKG)
# To provide reliable ordering, we need to make this install script happen in a subdirectory.
# Otherwise, Qt deploy will happen before we have the rest of the application deployed.
add_subdirectory("scripts/qt_install")
endif()
47 changes: 47 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/build/vcpkg/scripts/buildsystems/vcpkg.cmake",
"Qt5_DIR": "C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5/",
"CMAKE_INSTALL_PREFIX": "C:/xstudio_install",
"X_VCPKG_APPLOCAL_DEPS_INSTALL": "ON",
"BUILD_DOCS": "OFF"
}
},
{
"name": "Release",
"inherits": ["windows-base"],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "RelWithDebInfo",
"inherits": ["windows-base"],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"USE_SANITIZER": "address"
}
},
{
"name": "Debug",
"hidden": true,
"inherits": ["windows-base"],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"USE_SANITIZER": "address"
}
}
]
}
29 changes: 28 additions & 1 deletion NOTICE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,31 @@ Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font
Software without prior written authorization from the Gnome Foundation
or Bitstream Inc., respectively. For further information, contact:
fonts at gnome dot org.
fonts at gnome dot org.


zstr

Located in extern/include/

The MIT License (MIT)

Copyright (c) 2015 Matei David, Ontario Institute for Cancer Research

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@

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.

## Building xSTUDIO for MS Windows
## Building xSTUDIO

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).
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.

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

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

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

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.
### Building xSTUDIO for Windows

* [Windows](docs/build_guides/windows.md)

### Building xSTUDIO for MacOS

## Building xSTUDIO for MacOS
MacOS compatibility is not yet available. Watch this space!

MacOS compatibility is not yet available but it is due in Q3 or Q4 2023. Watch this space!
### Documentation Note

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.
Loading

0 comments on commit 0c8e63e

Please sign in to comment.