Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ option(OTIO_DEPENDENCIES_INSTALL "Install OTIO's C++ header dependencies (I
option(OTIO_INSTALL_PYTHON_MODULES "Install OTIO pure Python modules/files" ON)
option(OTIO_INSTALL_COMMANDLINE_TOOLS "Install the OTIO command line tools" ON)
option(OTIO_FIND_IMATH "Find Imath using find_package" OFF)
option(OTIO_FIND_PYBIND11 "Find pybind11 using find_package" OFF)
option(OTIO_FIND_RAPIDJSON "Find RapidJSON using find_package" OFF)
set(OTIO_PYTHON_INSTALL_DIR "" CACHE STRING "Python installation dir (such as the site-packages dir)")

Expand Down Expand Up @@ -258,6 +259,16 @@ else()
include_directories("${PROJECT_SOURCE_DIR}/src/deps/Imath/src")
endif()

#----- pybind11
if(OTIO_FIND_PYBIND11)
find_package(pybind11 REQUIRED)
if (pybind11_FOUND)
message(STATUS "Found pybind11 at ${pybind11_CONFIG}")
endif()
else()
message(STATUS "Using src/deps/pybind11 by default")
endif()

#----- RapidJSON

if(OTIO_FIND_RAPIDJSON)
Expand Down
28 changes: 25 additions & 3 deletions src/deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
#----- Other dependencies

# detect if the submodules haven't been updated
set(DEPS_SUBMODULES pybind11)
if(NOT OTIO_FIND_PYBIND11 AND OTIO_PYTHON_INSTALL)
# pybind11 only needed when building Python bindings
set(DEPS_SUBMODULES ${DEPS_SUBMODULES} pybind11)
endif()

if(NOT OTIO_FIND_IMATH)
set(DEPS_SUBMODULES ${DEPS_SUBMODULES} Imath)
endif()

if(NOT OTIO_FIND_RAPIDJSON)
set(DEPS_SUBMODULES ${DEPS_SUBMODULES} rapidjson)
endif()

foreach(submodule IN LISTS DEPS_SUBMODULES)
file(GLOB SUBMOD_CONTENTS ${submodule})
file(GLOB SUBMOD_CONTENTS "${submodule}/*")
list(LENGTH SUBMOD_CONTENTS SUBMOD_CONTENT_LEN)
if(SUBMOD_CONTENT_LEN EQUAL 0)
message(
Expand All @@ -21,10 +28,25 @@ foreach(submodule IN LISTS DEPS_SUBMODULES)
endif()
endforeach()

if(OTIO_PYTHON_INSTALL)
if(NOT OTIO_FIND_PYBIND11 AND OTIO_PYTHON_INSTALL)
# pybind11 only needed when building Python bindings
add_subdirectory(pybind11)
endif()

# Calling add_subdirectory(rapidjson) will try to build subcomponents
# such as example/CMakeLists.txt which has not been updated for CMake
# 4.0 compatibility and will break our builds. rapidjson is a header
# only library, code in src/opentimelineio/ only needs it to be present
# to pick up the headers.
# If building rapidjson ends up required, the CMake variables:
#
# RAPIDJSON_BUILD_DOC
# RAPIDJSON_BUILD_EXAMPLES
# RAPIDJSON_BUILD_TESTS
#
# coud be overriden from ON to OFF to avoid trying to build
# subcomponents we don't need.

if(NOT OTIO_FIND_IMATH)
# preserve BUILD_SHARED_LIBS options for this project, but set it off for Imath
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
Expand Down
6 changes: 3 additions & 3 deletions src/opentime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ if(OTIO_CXX_INSTALL)
RUNTIME DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}")

install(EXPORT OpenTimeTargets
DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentime"
DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/lib/cmake/opentime"
NAMESPACE OTIO:: )

include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/OpenTimeConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/OpenTimeConfig.cmake
INSTALL_DESTINATION
${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentime
${OTIO_RESOLVED_CXX_INSTALL_DIR}/lib/cmake/opentime
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
Expand All @@ -87,7 +87,7 @@ if(OTIO_CXX_INSTALL)
${CMAKE_CURRENT_BINARY_DIR}/OpenTimeConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/OpenTimeConfigVersion.cmake
DESTINATION
${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentime
${OTIO_RESOLVED_CXX_INSTALL_DIR}/lib/cmake/opentime
)
endif()

6 changes: 3 additions & 3 deletions src/opentimelineio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ if(OTIO_CXX_INSTALL)
RUNTIME DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}")

install(EXPORT OpenTimelineIOTargets
DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentimelineio"
DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/lib/cmake/opentimelineio"
NAMESPACE OTIO:: )

include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/OpenTimelineIOConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/OpenTimelineIOConfig.cmake
INSTALL_DESTINATION
${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentimelineio
${OTIO_RESOLVED_CXX_INSTALL_DIR}/lib/cmake/opentimelineio
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
Expand All @@ -165,6 +165,6 @@ if(OTIO_CXX_INSTALL)
${CMAKE_CURRENT_BINARY_DIR}/OpenTimelineIOConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/OpenTimelineIOConfigVersion.cmake
DESTINATION
${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentimelineio
${OTIO_RESOLVED_CXX_INSTALL_DIR}/lib/cmake/opentimelineio
)
endif()
Loading