diff --git a/ports/libtheora/CMakeLists.txt b/ports/libtheora/CMakeLists.txt index cf8799e5d84794..0d4aed76e04fbc 100644 --- a/ports/libtheora/CMakeLists.txt +++ b/ports/libtheora/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) project(theora LANGUAGES C) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}") -FIND_PACKAGE(OGG REQUIRED) +FIND_PACKAGE(Ogg REQUIRED) file(GLOB HEADERS "include/theora/codec.h" @@ -11,9 +11,6 @@ file(GLOB HEADERS "include/theora/theoraenc.h" ) -include_directories("include") -include_directories(${OGG_INCLUDE_DIR}) - set(LIBTHEORA_COMMON "lib/apiwrapper.c" "lib/bitpack.c" @@ -71,22 +68,47 @@ if (BUILD_SHARED_LIBS) endif() add_library(theora-common OBJECT ${LIBTHEORA_COMMON} ${HEADERS}) +target_link_libraries(theora-common PUBLIC Ogg::ogg) +target_include_directories(theora-common PUBLIC $ $) add_library(theora-enc OBJECT ${LIBTHEORA_ENC} ${HEADERS}) +target_link_libraries(theora-enc PUBLIC Ogg::ogg) +target_include_directories(theora-enc PUBLIC $ $) add_library(theora-dec OBJECT ${LIBTHEORA_DEC} ${HEADERS}) +target_link_libraries(theora-dec PUBLIC Ogg::ogg) +target_include_directories(theora-dec PUBLIC $ $) add_library(theora $ $ $ "libtheora.def") -target_link_libraries(theora ${OGG_LIBRARY}) +target_link_libraries(theora PUBLIC Ogg::ogg) +target_include_directories(theora PUBLIC $ $) add_library(theoraenc $ $ "win32/xmingw32/libtheoraenc-all.def") -target_link_libraries(theoraenc ${OGG_LIBRARY}) +target_link_libraries(theoraenc PUBLIC Ogg::ogg) +target_include_directories(theoraenc PUBLIC $ $) add_library(theoradec $ $ "win32/xmingw32/libtheoradec-all.def") -target_link_libraries(theoradec ${OGG_LIBRARY}) +target_link_libraries(theoradec PUBLIC Ogg::ogg) +target_include_directories(theoradec PUBLIC $ $) + +include(CMakePackageConfigHelpers) + +configure_package_config_file(unofficial-theora-config.cmake.in unofficial-theora-config.cmake + INSTALL_DESTINATION "lib/unofficial-theora") install(FILES ${HEADERS} DESTINATION include/theora) +install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-theora-config.cmake" + DESTINATION "lib/unofficial-theora" +) + install(TARGETS theora theoraenc theoradec + EXPORT unofficial-theora-targets RUNTIME DESTINATION bin LIBRARY DESTINATION bin ARCHIVE DESTINATION lib ) + +install(EXPORT unofficial-theora-targets + NAMESPACE unofficial::theora:: + DESTINATION "lib/unofficial-theora" +) diff --git a/ports/libtheora/CONTROL b/ports/libtheora/CONTROL index 6485b120ea8040..e40a8f28ff4bd8 100644 --- a/ports/libtheora/CONTROL +++ b/ports/libtheora/CONTROL @@ -1,5 +1,6 @@ Source: libtheora -Version: 1.2.0alpha1-20170719-1 +Version: 1.2.0alpha1-20170719 +Port-Version: 2 Homepage: https://github.com/xiph/theora Description: Theora is a free and open video compression format from the Xiph.org Foundation. Build-Depends: libogg diff --git a/ports/libtheora/FindOGG.cmake b/ports/libtheora/FindOGG.cmake deleted file mode 100644 index ba3c8b1b6cfd89..00000000000000 --- a/ports/libtheora/FindOGG.cmake +++ /dev/null @@ -1,8 +0,0 @@ -find_path(OGG_INCLUDE_DIR NAMES ogg/ogg.h) - -find_library(OGG_LIBRARY NAMES ogg libogg) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(OGG DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR) - -mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY) diff --git a/ports/libtheora/portfile.cmake b/ports/libtheora/portfile.cmake index 7d90805089b387..53f8d67c735b56 100644 --- a/ports/libtheora/portfile.cmake +++ b/ports/libtheora/portfile.cmake @@ -12,7 +12,7 @@ vcpkg_from_github( file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/libtheora.def DESTINATION ${SOURCE_PATH}) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindOGG.cmake DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-theora-config.cmake.in DESTINATION ${SOURCE_PATH}) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") set(THEORA_X86_OPT ON) @@ -29,6 +29,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/unofficial-theora TARGET_PATH share/unofficial-theora) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/libtheora/unofficial-theora-config.cmake.in b/ports/libtheora/unofficial-theora-config.cmake.in new file mode 100644 index 00000000000000..af1974f462b0cb --- /dev/null +++ b/ports/libtheora/unofficial-theora-config.cmake.in @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-theora-targets.cmake")