Skip to content

Commit

Permalink
Adsk Contrib - Fix 'setup_ocio' script support (#1350)
Browse files Browse the repository at this point in the history
* Adsk Contrib - Fix 'setup_ocio' script support

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* As agreed, remove the Nuke env. variables

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>
  • Loading branch information
hodoulp authored Apr 6, 2021
1 parent 4e27f96 commit 87d3109
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,18 @@ add_subdirectory(tests)
add_subdirectory(src)
add_subdirectory(include)
add_subdirectory(ext)


###############################################################################
# Configure env script

if(WIN32)
set(OCIO_SETUP_NAME setup_ocio.bat)
else()
set(OCIO_SETUP_NAME setup_ocio.sh)
endif()

configure_file(${CMAKE_SOURCE_DIR}/share/ocio/${OCIO_SETUP_NAME}.in
${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} @ONLY)

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} DESTINATION share/ocio/)
7 changes: 7 additions & 0 deletions share/ocio/setup_ocio.bat.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
REM SPDX-License-Identifier: BSD-3-Clause
REM Copyright Contributors to the OpenColorIO Project.

set PATH=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@;%PATH%

set PATH=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@;%PATH%
set PYTHONPATH=@CMAKE_INSTALL_PREFIX@/@PYTHON_VARIANT_PATH@;%PYTHONPATH%
13 changes: 4 additions & 9 deletions share/ocio/setup_ocio.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.

OCIO_ROOT="@CMAKE_INSTALL_PREFIX@"
OCIO_EXECROOT="@CMAKE_INSTALL_EXEC_PREFIX@"

# For OS X
export DYLD_LIBRARY_PATH="${OCIO_EXECROOT}/lib:${DYLD_LIBRARY_PATH}"
export DYLD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@:${DYLD_LIBRARY_PATH}"

# For Linux
export LD_LIBRARY_PATH="${OCIO_EXECROOT}/lib:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@:${LD_LIBRARY_PATH}"

export PATH="${OCIO_EXECROOT}/bin:${PATH}"
export PYTHONPATH="${OCIO_EXECROOT}/@_Python_VARIANT_PATH@:${PYTHONPATH}"
export NUKE_PATH="${OCIO_EXECROOT}/lib/nuke@Nuke_API_VERSION@:${NUKE_PATH}"
export NUKE_PATH="${OCIO_ROOT}/share/nuke:${NUKE_PATH}";
export PATH="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@:${PATH}"
export PYTHONPATH="@CMAKE_INSTALL_PREFIX@/@PYTHON_VARIANT_PATH@:${PYTHONPATH}"
4 changes: 4 additions & 0 deletions src/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ else()
set(_Python_VARIANT_PATH "lib${LIB_SUFFIX}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages")
endif()

# Create an internal global variable to access it in another scope but not publicly visible
# using ccmake.
set(PYTHON_VARIANT_PATH ${_Python_VARIANT_PATH} CACHE INTERNAL "")

install(TARGETS PyOpenColorIO
LIBRARY DESTINATION ${_Python_VARIANT_PATH}
)

0 comments on commit 87d3109

Please sign in to comment.