Skip to content

Commit

Permalink
Merge branch 'main' into doc_mac_1
Browse files Browse the repository at this point in the history
  • Loading branch information
cedrik-fuoco-adsk authored Sep 24, 2024
2 parents 19ca5e7 + f9e45c7 commit 05fb1fb
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ env:

jobs:
rocky-linux:
if : ${{ github.repository_owner == 'AcademySoftwareFoundation' }}
name: 'Rocky Linux ${{ matrix.rocky-version }} ${{ matrix.vfx-platform }}
<qt=${{ matrix.qt-version }},
python=${{ matrix.python-version }},
Expand Down Expand Up @@ -219,6 +220,7 @@ jobs:
cmake --install _build --prefix $(pwd)/_install --config ${{ matrix.build-type }}
macos:
if : ${{ github.repository_owner == 'AcademySoftwareFoundation' }}
name: '${{ matrix.os }} ${{ matrix.arch-type }} ${{ matrix.vfx-platform }}
<qt=${{ matrix.qt-version }},
python=${{ matrix.python-version }},
Expand Down Expand Up @@ -397,6 +399,7 @@ jobs:
cmake --install _build --prefix $(pwd)/_install --config ${{ matrix.build-type }}
windows:
if : ${{ github.repository_owner == 'AcademySoftwareFoundation' }}
name: 'Windows ${{ matrix.vfx-platform }}
<${{ matrix.os }}
msvc=${{ matrix.msvc-component }},
Expand Down
2 changes: 1 addition & 1 deletion cmake/dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ IF(NOT EXISTS "${PROJECT_SOURCE_DIR}/src/pub/CMakeLists.txt")
ENDIF()

IF(RV_TARGET_WINDOWS)
INCLUDE(vcpkg)
INCLUDE(expat)
ENDIF()
INCLUDE(qt5)
INCLUDE(openssl) # Python3 requirement
Expand Down
88 changes: 88 additions & 0 deletions cmake/dependencies/expat.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#
# Copyright (C) 2024 Autodesk, Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

#
# Official source repository https://github.com/libexpat/libexpat
#

INCLUDE(ProcessorCount) # require CMake 3.15+
PROCESSORCOUNT(_cpu_count)

RV_CREATE_STANDARD_DEPS_VARIABLES("RV_DEPS_EXPAT" "2.6.3" "" "")
RV_SHOW_STANDARD_DEPS_VARIABLES()


string(REPLACE "." "_" _version_underscored ${_version})
SET(_download_url
"https://github.com/libexpat/libexpat/archive/refs/tags/R_${_version_underscored}.tar.gz"
)

SET(_download_hash
"985086e206a01e652ca460eb069e4780"
)

SET(_libexpat_lib_version
"2.6.3"
)

RV_MAKE_STANDARD_LIB_NAME("libexpat" "" "SHARED" "d")

# Remove the -S argument from _configure_options, and adjust the path for Expat.
list(REMOVE_ITEM _configure_options "-S ${_source_dir}")
# Expat source is under expat folder and not directly under repository root.
LIST(APPEND _configure_options "-S ${_source_dir}/expat")

LIST(APPEND _configure_options "-DEXPAT_BUILD_DOCS=OFF")
LIST(APPEND _configure_options "-DEXPAT_BUILD_EXAMPLES=OFF")
LIST(APPEND _configure_options "-DEXPAT_BUILD_TESTS=OFF")
LIST(APPEND _configure_options "-DEXPAT_BUILD_TOOLS=OFF")

EXTERNALPROJECT_ADD(
${_target}
URL ${_download_url}
URL_MD5 ${_download_hash}
DOWNLOAD_NAME ${_target}_${_version}.tar.gz
DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR}
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
SOURCE_DIR ${_source_dir}
BINARY_DIR ${_build_dir}
INSTALL_DIR ${_install_dir}
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${_configure_options}
BUILD_COMMAND ${_cmake_build_command}
INSTALL_COMMAND ${_cmake_install_command}
BUILD_IN_SOURCE FALSE
BUILD_ALWAYS FALSE
BUILD_BYPRODUCTS ${_byproducts}
USES_TERMINAL_BUILD TRUE
)

RV_COPY_LIB_BIN_FOLDERS()

ADD_DEPENDENCIES(dependencies ${_target}-stage-target)

ADD_LIBRARY(EXPAT::EXPAT SHARED IMPORTED GLOBAL)
ADD_DEPENDENCIES(EXPAT::EXPAT ${_target})

# An import library (.lib) file is often used to resolve references to
# functions and variables in a DLL, enabling the linker to generate code
# for loading the DLL and calling its functions at runtime.
SET_PROPERTY(
TARGET EXPAT::EXPAT
PROPERTY IMPORTED_LOCATION "${_libpath}"
)
SET_PROPERTY(
TARGET EXPAT::EXPAT
PROPERTY IMPORTED_IMPLIB "${_implibpath}"
)

# It is required to force directory creation at configure time otherwise CMake complains about importing a non-existing path
FILE(MAKE_DIRECTORY "${_include_dir}")
TARGET_INCLUDE_DIRECTORIES(
EXPAT::EXPAT
INTERFACE ${_include_dir}
)

LIST(APPEND RV_DEPS_LIST EXPAT::EXPAT)
37 changes: 2 additions & 35 deletions cmake/dependencies/ocio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ ELSE() # Windows
FILE(REMOVE ${_backup_pyopencolorio_cmakelists_path})
ENDIF()

GET_TARGET_PROPERTY(_vcpkg_location VCPKG::VCPKG IMPORTED_LOCATION)
GET_FILENAME_COMPONENT(_vcpkg_path ${_vcpkg_location} DIRECTORY)

# Some options are not multi-platform so we start clean.
SET(_configure_options
""
Expand All @@ -215,8 +212,7 @@ ELSE() # Windows
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DZLIB_LIBRARY=${_zlib_library}"
"-DZLIB_INCLUDE_DIR=${_zlib_include_dir}"
# Using the expat build with /MD to match the CRT.
"-Dexpat_DIR=${_vcpkg_path}/packages/expat_x64-windows-static-md/share/expat"
"-Dexpat_ROOT=${RV_DEPS_EXPAT_ROOT_DIR}"
"-DImath_DIR=${RV_DEPS_IMATH_ROOT_DIR}/lib/cmake/Imath"
"-DPython_ROOT=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install"
# Mandatory param: OCIO CMake code finds Python.
Expand Down Expand Up @@ -264,7 +260,7 @@ ELSE() # Windows
SOURCE_DIR ${_source_dir}
BINARY_DIR ${_build_dir}
INSTALL_DIR ${_install_dir}
DEPENDS Boost::headers RV_DEPS_PYTHON3 Imath::Imath VCPKG::VCPKG ZLIB::ZLIB
DEPENDS Boost::headers RV_DEPS_PYTHON3 Imath::Imath ZLIB::ZLIB EXPAT::EXPAT
PATCH_COMMAND
python3 ${_pyopencolorio_patch_script_path} ${_pyopencolorio_cmakelists_path}
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${_configure_options}
Expand All @@ -275,35 +271,6 @@ ELSE() # Windows
BUILD_BYPRODUCTS ${_byproducts}
USES_TERMINAL_BUILD TRUE
)

# To update the baseline property in the OCIO VCPKG JSON:
# See https://learn.microsoft.com/en-us/vcpkg/users/versioning#baselines
# vcpkg x-update-baseline
# Caveat: the file must be called vcpkg.json to work.
# Workaround: change ocio_vcpkg.json to vcpkg.json, update the baseline, and rename it back.
SET(_vcpkg_manifest
"${RV_PKGMANCONFIG_DIR}/ocio_vcpkg.json"
)
EXTERNALPROJECT_ADD_STEP(
${_target} add_vcpkg_manifest
COMMENT "Copying the VCPKG manifest"
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_vcpkg_manifest} "${_source_dir}/vcpkg.json"
DEPENDERS configure
)

EXTERNALPROJECT_ADD_STEP(
${_target} install_vcpkg_manifest
COMMENT "Installing OCIO dependencies via VCPKG"
# IMPORTANT: VCPKG Manifest mode (using a .json) does not support differents triplets per dependencies.
# This is not a problem right now because only expat is installed with vcpkg.
# Expat is installed with vcpkg because there's an expat library that comes with MSYS2 on Windows,
# and it is causing compiler error.
# OCIO installs the remaining dependencies (yaml-cpp, pystring, pybind11 and minizip-ng).
COMMAND ${_vcpkg_location} install --triplet x64-windows-static-md
DEPENDEES add_vcpkg_manifest
DEPENDERS configure
WORKING_DIRECTORY "${_source_dir}"
)
ENDIF()

SET(_ocio_stage_plugins_python_dir "${RV_STAGE_PLUGINS_PYTHON_DIR}")
Expand Down
10 changes: 7 additions & 3 deletions rvcmds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,27 @@ rvenv_shell() {
# VARIABLES
RV_HOME="${RV_HOME:-$SCRIPT_HOME}"
RV_BUILD="${RV_BUILD:-${RV_HOME}/_build}"
RV_BUILD_DEBUG="${RV_BUILD_DEBUG:-${RV_HOME}/_build_debug}"
RV_INST="${RV_INST:-${RV_HOME}/_install}"
RV_INST_DEBUG="${RV_INST_DEBUG:-${RV_HOME}/_install_debug}"
RV_BUILD_PARALLELISM="${RV_BUILD_PARALLELISM:-$(python3 -c 'import os; print(os.cpu_count())')}"

# ALIASES: Basic commands

alias rvenv="rvenv_shell"
alias rvsetup="rvenv && SETUPTOOLS_USE_DISTUTILS=${SETUPTOOLS_USE_DISTUTILS} python3 -m pip install --upgrade -r ${RV_HOME}/requirements.txt"
alias rvcfg="rvenv && cmake -B ${RV_BUILD} -G \"${CMAKE_GENERATOR}\" ${CMAKE_WIN_ARCH} -DCMAKE_BUILD_TYPE=Release -DRV_DEPS_QT5_LOCATION=${QT_HOME} -DRV_DEPS_WIN_PERL_ROOT=${WIN_PERL}"
alias rvcfgd="rvenv && cmake -B ${RV_BUILD} -G \"${CMAKE_GENERATOR}\" ${CMAKE_WIN_ARCH} -DCMAKE_BUILD_TYPE=Debug -DRV_DEPS_QT5_LOCATION=${QT_HOME} -DRV_DEPS_WIN_PERL_ROOT=${WIN_PERL}"
alias rvcfgd="rvenv && cmake -B ${RV_BUILD_DEBUG} -G \"${CMAKE_GENERATOR}\" ${CMAKE_WIN_ARCH} -DCMAKE_BUILD_TYPE=Debug -DRV_DEPS_QT5_LOCATION=${QT_HOME} -DRV_DEPS_WIN_PERL_ROOT=${WIN_PERL}"
alias rvbuildt="rvenv && cmake --build ${RV_BUILD} --config Release -v --parallel=${RV_BUILD_PARALLELISM} --target "
alias rvbuildtd="rvenv && cmake --build ${RV_BUILD} --config Debug -v --parallel=${RV_BUILD_PARALLELISM} --target "
alias rvbuildtd="rvenv && cmake --build ${RV_BUILD_DEBUG} --config Debug -v --parallel=${RV_BUILD_PARALLELISM} --target "
alias rvbuild="rvenv && rvbuildt main_executable"
alias rvbuildd="rvenv && rvbuildtd main_executable"
alias rvtest="rvenv && ctest --test-dir ${RV_BUILD} --extra-verbose"
alias rvtestd="rvenv && ctest --test-dir ${RV_BUILD_DEBUG} --extra-verbose"
alias rvinst="rvenv && cmake --install ${RV_BUILD} --prefix ${RV_INST} --config Release"
alias rvinstd="rvenv && cmake --install ${RV_BUILD} --prefix ${RV_INST} --config Debug"
alias rvinstd="rvenv && cmake --install ${RV_BUILD_DEBUG} --prefix ${RV_INST_DEBUG} --config Debug"
alias rvclean="rm -rf ${RV_BUILD} && rm -rf .venv"
alias rvcleand="rm -rf ${RV_BUILD_DEBUG} && rm -rf .venv"

# ALIASES: Config and Build

Expand Down

0 comments on commit 05fb1fb

Please sign in to comment.