usse vcpkg just for the libsndfile build chain

This commit is contained in:
marauder2k7 2025-10-29 01:40:27 +00:00
parent a577d36679
commit 873fbbf1fe
1856 changed files with 1019 additions and 466624 deletions

View file

@ -0,0 +1,160 @@
cmake_minimum_required(VERSION 3.30)
project(theora LANGUAGES C)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
set(OGG_REQUIRED_VERSION 1.3.4)
find_package(Ogg "${OGG_REQUIRED_VERSION}" CONFIG REQUIRED)
file(GLOB HEADERS
"include/theora/codec.h"
"include/theora/theora.h"
"include/theora/theoradec.h"
"include/theora/theoraenc.h"
)
if(MSVC)
set(LIBTHEORA_COMMON_X86
"lib/x86_vc/mmxfrag.c"
"lib/x86_vc/mmxidct.c"
"lib/x86_vc/mmxstate.c"
"lib/x86_vc/x86cpu.c"
"lib/x86_vc/x86state.c"
)
else()
set(LIBTHEORA_COMMON_X86
"lib/x86/mmxfrag.c"
"lib/x86/mmxidct.c"
"lib/x86/mmxstate.c"
"lib/x86/sse2idct.c"
"lib/x86/x86cpu.c"
"lib/x86/x86state.c"
)
endif()
set(LIBTHEORA_COMMON
"lib/apiwrapper.c"
"lib/bitpack.c"
"lib/dequant.c"
"lib/fragment.c"
"lib/idct.c"
"lib/info.c"
"lib/internal.c"
"lib/state.c"
"lib/quant.c"
${LIBTHEORA_COMMON_X86}
)
if(MSVC)
set(LIBTHEORA_ENC_X86
"lib/x86_vc/mmxencfrag.c"
"lib/x86_vc/mmxfdct.c"
"lib/x86_vc/x86enc.c"
)
else()
set(LIBTHEORA_ENC_X86
"lib/x86/mmxencfrag.c"
"lib/x86/mmxfdct.c"
"lib/x86/x86enc.c"
"lib/x86/x86enquant.c"
"lib/x86/sse2encfrag.c"
)
endif()
set(LIBTHEORA_ENC
"lib/analyze.c"
"lib/encapiwrapper.c"
"lib/encfrag.c"
"lib/encinfo.c"
"lib/encode.c"
"lib/enquant.c"
"lib/fdct.c"
"lib/huffenc.c"
"lib/mathops.c"
"lib/mcenc.c"
"lib/rate.c"
"lib/tokenize.c"
${LIBTHEORA_ENC_X86}
)
set(LIBTHEORA_DEC
"lib/decapiwrapper.c"
"lib/decinfo.c"
"lib/decode.c"
"lib/huffdec.c"
)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
option(USE_X86 "Use x86 optimization" OFF)
if(USE_X86)
add_definitions(-DOC_X86_ASM)
endif()
if (BUILD_SHARED_LIBS)
add_definitions(-DLIBTHEORA_EXPORTS)
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 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 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 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 "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
install(EXPORT unofficial-theora-targets
NAMESPACE unofficial::theora::
DESTINATION "lib/unofficial-theora"
)
block(SCOPE_FOR VARIABLES)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(libdir "\${prefix}/lib")
set(exec_prefix "\${prefix}")
set(includedir "\${prefix}/include")
set(THEORA_LIBOGG_REQ_VERSION "${OGG_REQUIRED_VERSION}")
configure_file(theora.pc.in theora.pc @ONLY)
configure_file(theoradec.pc.in theoradec.pc @ONLY)
configure_file(theoraenc.pc.in theoraenc.pc @ONLY)
endblock()
install(
FILES "${PROJECT_BINARY_DIR}/theora.pc" "${PROJECT_BINARY_DIR}/theoradec.pc" "${PROJECT_BINARY_DIR}/theoraenc.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)

View file

@ -0,0 +1,61 @@
EXPORTS
; Old alpha API
theora_version_string
theora_version_number
theora_decode_header
theora_decode_init
theora_decode_packetin
theora_decode_YUVout
theora_control
theora_packet_isheader
theora_packet_iskeyframe
theora_granule_shift
theora_granule_frame
theora_granule_time
theora_info_init
theora_info_clear
theora_clear
theora_comment_init
theora_comment_add
theora_comment_add_tag
theora_comment_query
theora_comment_query_count
theora_comment_clear
; New theora-exp API
th_version_string
th_version_number
th_decode_headerin
th_decode_alloc
th_setup_free
th_decode_ctl
th_decode_packetin
th_decode_ycbcr_out
th_decode_free
th_packet_isheader
th_packet_iskeyframe
th_granule_frame
th_granule_time
th_info_init
th_info_clear
th_comment_init
th_comment_add
th_comment_add_tag
th_comment_query
th_comment_query_count
th_comment_clear
; Old alpha API
theora_encode_init
theora_encode_YUVin
theora_encode_packetout
theora_encode_header
theora_encode_comment
theora_encode_tables
; New theora-exp API
th_encode_alloc
th_encode_ctl
th_encode_flushheader
th_encode_ycbcr_in
th_encode_packetout
th_encode_free
TH_VP31_QUANT_INFO
TH_VP31_HUFF_CODES

View file

@ -0,0 +1,32 @@
set(LOCAL_ARCHIVE "$ENV{VCPKG_LIB_SOURCE_ROOT}/xiph-theora-v1.2.0.tar.gz")
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${LOCAL_ARCHIVE}"
)
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}/unofficial-theora-config.cmake.in" DESTINATION "${SOURCE_PATH}")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(THEORA_X86_OPT ON)
else()
set(THEORA_X86_OPT OFF)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DVERSION:STRING=${VERSION}"
-DUSE_X86=${THEORA_X86_OPT}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/unofficial-theora" PACKAGE_NAME "unofficial-theora")
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING" "${SOURCE_PATH}/LICENSE")

View file

@ -0,0 +1,6 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Ogg CONFIG)
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-theora-targets.cmake")

View file

@ -0,0 +1,18 @@
{
"name": "libtheora",
"version": "1.2.0",
"description": "Theora is a free and open video compression format from the Xiph.org Foundation.",
"homepage": "https://github.com/xiph/theora",
"license": null,
"dependencies": [
"libogg",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}