Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libtheora] add unofficial cmake config, remove FindOGG.cmake #13783

Merged
merged 7 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from 6 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
36 changes: 29 additions & 7 deletions ports/libtheora/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
add_library(theora-enc OBJECT ${LIBTHEORA_ENC} ${HEADERS})
target_link_libraries(theora-enc PUBLIC Ogg::ogg)
target_include_directories(theora-enc PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
add_library(theora-dec OBJECT ${LIBTHEORA_DEC} ${HEADERS})
target_link_libraries(theora-dec PUBLIC Ogg::ogg)
target_include_directories(theora-dec PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)

add_library(theora $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-enc> $<TARGET_OBJECTS:theora-dec> "libtheora.def")
target_link_libraries(theora ${OGG_LIBRARY})
target_link_libraries(theora PUBLIC Ogg::ogg)
target_include_directories(theora PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)

add_library(theoraenc $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-enc> "win32/xmingw32/libtheoraenc-all.def")
target_link_libraries(theoraenc ${OGG_LIBRARY})
target_link_libraries(theoraenc PUBLIC Ogg::ogg)
target_include_directories(theoraenc PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)

add_library(theoradec $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-dec> "win32/xmingw32/libtheoradec-all.def")
target_link_libraries(theoradec ${OGG_LIBRARY})
target_link_libraries(theoradec PUBLIC Ogg::ogg)
target_include_directories(theoradec PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)

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"
)
3 changes: 2 additions & 1 deletion ports/libtheora/CONTROL
Original file line number Diff line number Diff line change
@@ -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
8 changes: 0 additions & 8 deletions ports/libtheora/FindOGG.cmake

This file was deleted.

3 changes: 2 additions & 1 deletion ports/libtheora/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions ports/libtheora/unofficial-theora-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/unofficial-theora-targets.cmake")