diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 94094c521..2b1ba9d61 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -39,6 +39,7 @@ jobs: OTIO_BUILD_CONFIG: Release OTIO_BUILD_DIR: ${{ github.workspace }}/build OTIO_INSTALL_DIR: ${{ github.workspace }}/install + OTIO_CONSUMER_TEST_BUILD_DIR: ${{ github.workspace }}/consumertest steps: - uses: actions/checkout@v3 @@ -81,6 +82,11 @@ jobs: run: | cd ${{ env.OTIO_BUILD_DIR }} cmake --build . --target install --config ${{ env.OTIO_BUILD_CONFIG }} + - name: Consumer tests + run: | + cmake -E make_directory ${{ env.OTIO_CONSUMER_TEST_BUILD_DIR }} + cd ${{ env.OTIO_CONSUMER_TEST_BUILD_DIR }} + cmake ${{ github.workspace }}/tests/consumer -DCMAKE_PREFIX_PATH=${{ env.OTIO_INSTALL_DIR }} py_build_test: runs-on: ${{ matrix.os }} diff --git a/src/opentime/CMakeLists.txt b/src/opentime/CMakeLists.txt index 447853c4d..b7cc47cf4 100644 --- a/src/opentime/CMakeLists.txt +++ b/src/opentime/CMakeLists.txt @@ -42,14 +42,31 @@ if(OTIO_CXX_INSTALL) DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentime") install(TARGETS opentime - EXPORT OpenTimeConfig + EXPORT OpenTimeTargets INCLUDES DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include" ARCHIVE DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}" LIBRARY DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}" RUNTIME DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}") - install(EXPORT OpenTimeConfig + install(EXPORT OpenTimeTargets DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/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 + NO_SET_AND_CHECK_MACRO + NO_CHECK_REQUIRED_COMPONENTS_MACRO + ) + + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/OpenTimeConfig.cmake + DESTINATION + ${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentime + ) endif() diff --git a/src/opentime/OpenTimeConfig.cmake.in b/src/opentime/OpenTimeConfig.cmake.in new file mode 100644 index 000000000..421d55b32 --- /dev/null +++ b/src/opentime/OpenTimeConfig.cmake.in @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/OpenTimeTargets.cmake") diff --git a/src/opentimelineio/CMakeLists.txt b/src/opentimelineio/CMakeLists.txt index 29cc3a8a8..1860b8e97 100644 --- a/src/opentimelineio/CMakeLists.txt +++ b/src/opentimelineio/CMakeLists.txt @@ -118,13 +118,30 @@ if(OTIO_CXX_INSTALL) endif() install(TARGETS opentimelineio - EXPORT OpenTimelineIOConfig + EXPORT OpenTimelineIOTargets INCLUDES DESTINATION "${OPENTIMELINEIO_INCLUDES}" ARCHIVE DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}" LIBRARY DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}" RUNTIME DESTINATION "${OTIO_RESOLVED_CXX_DYLIB_INSTALL_DIR}") - install(EXPORT OpenTimelineIOConfig + install(EXPORT OpenTimelineIOTargets DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/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 + NO_SET_AND_CHECK_MACRO + NO_CHECK_REQUIRED_COMPONENTS_MACRO + ) + + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/OpenTimelineIOConfig.cmake + DESTINATION + ${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentimelineio + ) endif() diff --git a/src/opentimelineio/OpenTimelineIOConfig.cmake.in b/src/opentimelineio/OpenTimelineIOConfig.cmake.in new file mode 100644 index 000000000..f735b3666 --- /dev/null +++ b/src/opentimelineio/OpenTimelineIOConfig.cmake.in @@ -0,0 +1,6 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) +find_dependency(OpenTime) + +include("${CMAKE_CURRENT_LIST_DIR}/OpenTimelineIOTargets.cmake") diff --git a/tests/consumer/CMakeLists.txt b/tests/consumer/CMakeLists.txt new file mode 100644 index 000000000..1a851f9e3 --- /dev/null +++ b/tests/consumer/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.18.2 FATAL_ERROR) + +project(consumer_tests) + +add_subdirectory(opentime) +add_subdirectory(opentimeline) diff --git a/tests/consumer/opentime/CMakeLists.txt b/tests/consumer/opentime/CMakeLists.txt new file mode 100644 index 000000000..d9a682930 --- /dev/null +++ b/tests/consumer/opentime/CMakeLists.txt @@ -0,0 +1,2 @@ +find_package(OpenTime REQUIRED) +message(STATUS "Found OpenTime successfully at '${OpenTime_DIR}'") diff --git a/tests/consumer/opentimeline/CMakeLists.txt b/tests/consumer/opentimeline/CMakeLists.txt new file mode 100644 index 000000000..660a20be7 --- /dev/null +++ b/tests/consumer/opentimeline/CMakeLists.txt @@ -0,0 +1,2 @@ +find_package(OpenTimelineIO REQUIRED) +message(STATUS "Found OpenTimelineIO successfully at '${OpenTimelineIO_DIR}'")