diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a2a2d9..684267b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,3 +58,20 @@ add_subdirectory(lib/toucan) add_subdirectory(plugins) add_subdirectory(bin) add_subdirectory(tests) + +install( + FILES cmake/FindOpenFX.cmake + DESTINATION lib/cmake/toucan) +install( + FILES cmake/FindOTIO.cmake + DESTINATION lib/cmake/toucan) +include(CMakePackageConfigHelpers) +set(INCLUDE_INSTALL_DIR include/toucan) +configure_package_config_file( + toucanConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/toucanConfig.cmake + INSTALL_DESTINATION lib/cmake/toucan + PATH_VARS INCLUDE_INSTALL_DIR) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/toucanConfig.cmake + DESTINATION lib/cmake/toucan) diff --git a/cmake/FindOTIO.cmake b/cmake/FindOTIO.cmake index a5b2eb1..6300637 100644 --- a/cmake/FindOTIO.cmake +++ b/cmake/FindOTIO.cmake @@ -15,10 +15,7 @@ # * OTIO find_path(OTIO_INCLUDE_DIR NAMES opentimelineio/version.h) -if(OTIO_INCLUDE_DIR) - set(OTIO_DEPS_INCLUDE_DIRS ${OTIO_INCLUDE_DIR}/opentimelineio/deps) -endif() -set(OTIO_INCLUDE_DIRS ${OTIO_INCLUDE_DIR} ${OTIO_DEPS_INCLUDE_DIRS}) +set(OTIO_INCLUDE_DIRS ${OTIO_INCLUDE_DIR}) if(CMAKE_BUILD_TYPE MATCHES "^Debug$") find_library( @@ -44,8 +41,8 @@ set(OTIO_LIBRARIES ${opentimelineio_LIBRARY} ${opentime_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( OTIO - REQUIRED_VARS OTIO_INCLUDE_DIR OTIO_DEPS_INCLUDE_DIRS opentimelineio_LIBRARY opentime_LIBRARY) -mark_as_advanced(OTIO_INCLUDE_DIR OTIO_DEPS_INCLUDE_DIRS opentimelineio_LIBRARY opentime_LIBRARY) + REQUIRED_VARS OTIO_INCLUDE_DIR opentimelineio_LIBRARY opentime_LIBRARY) +mark_as_advanced(OTIO_INCLUDE_DIR opentimelineio_LIBRARY opentime_LIBRARY) if(OTIO_FOUND AND NOT TARGET OTIO::opentime) add_library(OTIO::opentime UNKNOWN IMPORTED) @@ -59,7 +56,7 @@ if(OTIO_FOUND AND NOT TARGET OTIO::opentimelineio) set_target_properties(OTIO::opentimelineio PROPERTIES IMPORTED_LOCATION "${opentimelineio_LIBRARY}" INTERFACE_COMPILE_DEFINITIONS opentimelineio_FOUND - INTERFACE_INCLUDE_DIRECTORIES "${OTIO_INCLUDE_DIR};${OTIO_DEPS_INCLUDE_DIRS}") + INTERFACE_INCLUDE_DIRECTORIES "${OTIO_INCLUDE_DIR}") endif() if(OTIO_FOUND AND NOT TARGET OTIO) add_library(OTIO INTERFACE) diff --git a/lib/toucan/CMakeLists.txt b/lib/toucan/CMakeLists.txt index 6100fcb..10f9d94 100644 --- a/lib/toucan/CMakeLists.txt +++ b/lib/toucan/CMakeLists.txt @@ -45,12 +45,19 @@ else() endif() add_library(toucan ${HEADERS} ${HEADERS_PRIVATE} ${SOURCE}) -target_link_libraries(toucan PUBLIC OTIO OpenImageIO::OpenImageIO MINIZIP::minizip) +target_link_libraries(toucan PUBLIC OTIO::opentimelineio OTIO::opentime OpenImageIO::OpenImageIO MINIZIP::minizip) set_target_properties(toucan PROPERTIES FOLDER lib) set_target_properties(toucan PROPERTIES PUBLIC_HEADER "${HEADERS}") -install(TARGETS toucan +install( + TARGETS toucan + EXPORT toucanTargets ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin - PUBLIC_HEADER DESTINATION include) + PUBLIC_HEADER DESTINATION include/toucan) +install( + EXPORT toucanTargets + FILE toucanTargets.cmake + DESTINATION "lib/cmake/toucan" + NAMESPACE toucan::) diff --git a/lib/toucan/Util.cpp b/lib/toucan/Util.cpp index 45f5067..0301aa1 100644 --- a/lib/toucan/Util.cpp +++ b/lib/toucan/Util.cpp @@ -18,19 +18,26 @@ namespace toucan int depth, int maxDepth) { - for (auto const& entry : std::filesystem::directory_iterator(path)) + try { - const auto& entryPath = entry.path(); - if (entry.is_regular_file() && - (entryPath.extension() == ".dll" || entryPath.extension() == ".so")) + for (auto const& entry : std::filesystem::directory_iterator(path)) { - out.push_back(entryPath); - } - else if (entry.is_directory() && depth < maxDepth) - { - _findPlugins(entryPath, out, depth + 1, maxDepth); + const auto& entryPath = entry.path(); + if (entry.is_regular_file() && + (entryPath.extension() == ".dll" || entryPath.extension() == ".so")) + { + out.push_back(entryPath); + } + else if (entry.is_directory() && depth < maxDepth) + { + _findPlugins(entryPath, out, depth + 1, maxDepth); + } } } + catch (const std::exception&) + { + //! \bug How should this be handled? + } } } diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index de9abff..1f76e9b 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -8,6 +8,6 @@ foreach(PLUGIN ColorSpace Draw Filter Generator Transform Transition) install(TARGETS toucan${PLUGIN} ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib + LIBRARY DESTINATION bin RUNTIME DESTINATION bin) endforeach() \ No newline at end of file diff --git a/toucanConfig.cmake.in b/toucanConfig.cmake.in new file mode 100644 index 0000000..380e9b3 --- /dev/null +++ b/toucanConfig.cmake.in @@ -0,0 +1,26 @@ +@PACKAGE_INIT@ + +# \todo Is this the correct way to locate the custom Find*.cmake files? +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +include(CMakeFindDependencyMacro) +find_dependency(Imath) +find_dependency(Freetype) +find_dependency(ZLIB) +find_dependency(PNG) +find_dependency(JPEG) +find_dependency(TIFF) +find_dependency(OpenEXR) +find_dependency(minizip) +find_dependency(OpenColorIO) +find_dependency(OpenImageIO) +find_dependency(OTIO) +find_dependency(OpenFX) + +include("${CMAKE_CURRENT_LIST_DIR}/toucanTargets.cmake") + +# \todo Is this the correct way to add the include directory? +include_directories("@PACKAGE_INCLUDE_INSTALL_DIR@") +include_directories("@PACKAGE_INCLUDE_INSTALL_DIR@/../Imath") + +check_required_components(toucan)