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 4 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
26 changes: 21 additions & 5 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 @@ -12,7 +12,7 @@ file(GLOB HEADERS
)

include_directories("include")
include_directories(${OGG_INCLUDE_DIR})
include_directories(${Ogg_INCLUDE_DIR})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
include_directories(${Ogg_INCLUDE_DIR})

This should be handled automatically by the Ogg::ogg target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and yes, I realised that. I tried deleting it but for some reason it does not find the headers for some files that are compiled. I'm going to see if I can get to the root of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a target_link_libraries against Ogg for the object libraries fixed it. I've just pushed another commit to this effect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The targets may need have target_include_directories(${target} PUBLIC $<INSTALL_INTERFACE:include>)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. Might as well fix that too.


set(LIBTHEORA_COMMON
"lib/apiwrapper.c"
Expand Down Expand Up @@ -75,18 +75,34 @@ add_library(theora-enc OBJECT ${LIBTHEORA_ENC} ${HEADERS})
add_library(theora-dec OBJECT ${LIBTHEORA_DEC} ${HEADERS})

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 Ogg::ogg)

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 Ogg::ogg)

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 Ogg::ogg)

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")