Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ tests/granulepos_theoraenc
tests/noop
tests/noop_theora
tests/noop_theoraenc

.vs/
out/
114 changes: 114 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
cmake_minimum_required(VERSION 3.0)
project(theora LANGUAGES C)

enable_testing()

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
FIND_PACKAGE(Ogg REQUIRED)

file(GLOB HEADERS
"include/theora/codec.h"
"include/theora/theora.h"
"include/theora/theoradec.h"
"include/theora/theoraenc.h"
)

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"

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

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"

"lib/x86_vc/mmxencfrag.c"
"lib/x86_vc/mmxfdct.c"
"lib/x86_vc/x86enc.c"
)

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

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> "win32/xmingw32/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(theora-config.cmake.in theora-config.cmake
INSTALL_DESTINATION "lib/theora")

install(FILES ${HEADERS} DESTINATION include/theora)

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/theora-config.cmake"
DESTINATION "lib/theora"
)

install(TARGETS theora theoraenc theoradec
EXPORT theora-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin
ARCHIVE DESTINATION lib
)

install(EXPORT theora-targets
NAMESPACE theora::
DESTINATION "lib/theora"
)

add_subdirectory(tests)
76 changes: 76 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"configurations": [
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": [
{
"name": "USE_X86",
"value": "True",
"type": "BOOL"
}
]
},
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": [
{
"name": "USE_X86",
"value": "True",
"type": "BOOL"
}
]
},
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "USE_X86",
"value": "False",
"type": "BOOL"
}
]
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "USE_X86",
"value": "False",
"type": "BOOL"
}
]
}
]
}
21 changes: 21 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.0)
Copy link

Choose a reason for hiding this comment

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

Suggested change
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.10)

Copy link

Choose a reason for hiding this comment

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

You probably missed this @mcmtroffaes

Copy link
Author

Choose a reason for hiding this comment

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

Ah, thanks for bringing to attention. Yes it looks like I forgot to commit the suggestion, however it seems correct in the final patch (i.e. 3.30 like everywhere else, I settled on that one since this is also what vcpkg is using)?

project(tests LANGUAGES C)

add_executable(comment comment.c)
add_executable(comment_theora comment_theora.c)
add_executable(granulepos granulepos.c)
add_executable(granulepos_theora granulepos_theora.c)
add_executable(noop noop.c)
add_executable(noop_theora noop_theora.c)
target_link_libraries(comment PRIVATE theora)
target_link_libraries(comment_theora PRIVATE theora)
target_link_libraries(granulepos PRIVATE theora)
target_link_libraries(granulepos_theora PRIVATE theora)
target_link_libraries(noop PRIVATE theora)
target_link_libraries(noop_theora PRIVATE theora)
add_test(test_comment comment)
add_test(test_comment_theora comment_theora)
add_test(test_granulepos granulepos)
add_test(test_granulepos_theora granulepos_theora)
add_test(test_noop noop)
add_test(test_noop_theora noop_theora)
4 changes: 3 additions & 1 deletion tests/tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

********************************************************************/

#include "config.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>
Expand Down
3 changes: 3 additions & 0 deletions 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}/theora-targets.cmake")
61 changes: 61 additions & 0 deletions win32/xmingw32/libtheora.def
Original file line number Diff line number Diff line change
@@ -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