Use FetchContent for OTIO

Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
This commit is contained in:
Darby Johnston 2024-12-02 13:07:22 -08:00 committed by Jean-Baptiste Mardelle
parent ad40f9372b
commit fe43be77b9
3 changed files with 18 additions and 46 deletions

View file

@ -53,6 +53,23 @@ if (NOT DEFINED QT_MAJOR_VERSION)
set(QT_MAJOR_VERSION 6)
endif()
# OpenTimelineIO
#
# Note that this needs to come before the KDECompilerSettings. OTIO is not
# compatible with some of the KDE compiler flags, specifically:
# "-fno-operator-names" and "-fno-exceptions".
#
# todo: Use CMake's FetchContent to include OpenTimelineIO until a system
# package is available.
include(FetchContent)
set(OTIO_SHARED_LIBS OFF)
FetchContent_Declare(
OTIO
GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/OpenTimelineIO.git
GIT_TAG v0.17.0)
FetchContent_MakeAvailable(OTIO)
include_directories(${otio_SOURCE_DIR}/src)
## include ECM Modules
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMInstallIcons)

View file

@ -1,45 +0,0 @@
# Find the OpenTimelineIO library
#
# SPDX-FileCopyrightText: 2024 Darby Johnston <darbyjohnston@yahoo.com>
# SPDX-License-Identifier: BSD-2-Clause
find_path(IMATH_INCLUDE_DIR NAMES ImathBox.h PATH_SUFFIXES Imath)
set(IMATH_INCLUDE_DIRS ${IMATH_INCLUDE_DIR})
find_path(OTIO_INCLUDE_DIR NAMES opentimelineio/version.h)
set(OTIO_INCLUDE_DIRS ${OTIO_INCLUDE_DIR})
find_library(
opentime_LIBRARY
NAMES opentime
PATHS ${CMAKE_INSTALL_PREFIX}/python/opentimelineio)
find_library(
opentimelineio_LIBRARY
NAMES opentimelineio
PATHS ${CMAKE_INSTALL_PREFIX}/python/opentimelineio)
set(OTIO_LIBRARIES ${opentimelineio_LIBRARY} ${opentime_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
OTIO
REQUIRED_VARS IMATH_INCLUDE_DIR OTIO_INCLUDE_DIR opentimelineio_LIBRARY opentime_LIBRARY)
mark_as_advanced(IMATH_INCLUDE_DIR OTIO_INCLUDE_DIR opentimelineio_LIBRARY opentime_LIBRARY)
if(OTIO_FOUND AND NOT TARGET OTIO::opentime)
add_library(OTIO::opentime UNKNOWN IMPORTED)
set_target_properties(OTIO::opentime PROPERTIES
IMPORTED_LOCATION "${opentime_LIBRARY}"
INTERFACE_COMPILE_DEFINITIONS opentime_FOUND
INTERFACE_INCLUDE_DIRECTORIES "${opentime_INCLUDE_DIR}")
endif()
if(OTIO_FOUND AND NOT TARGET OTIO::opentimelineio)
add_library(OTIO::opentimelineio UNKNOWN IMPORTED)
set_target_properties(OTIO::opentimelineio PROPERTIES
IMPORTED_LOCATION "${opentimelineio_LIBRARY}"
INTERFACE_COMPILE_DEFINITIONS opentimelineio_FOUND
INTERFACE_INCLUDE_DIRECTORIES "${IMATH_INCLUDE_DIR};${OTIO_INCLUDE_DIR}")
endif()
if(OTIO_FOUND AND NOT TARGET OTIO)
add_library(OTIO INTERFACE)
target_link_libraries(OTIO INTERFACE OTIO::opentimelineio OTIO::opentime)
endif()

View file

@ -170,7 +170,7 @@ target_link_libraries(kdenliveLib
${OPENGLES_LIBRARIES}
${MLT_LIBRARIES}
${MLTPP_LIBRARIES}
OTIO
opentimelineio
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
kiss_fft