]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | cmake_minimum_required(VERSION 3.0) |
2 | project(theora LANGUAGES C) | |
3 | ||
4 | set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}") | |
5 | FIND_PACKAGE(Ogg REQUIRED) | |
6 | ||
7 | file(GLOB HEADERS | |
8 | "include/theora/codec.h" | |
9 | "include/theora/theora.h" | |
10 | "include/theora/theoradec.h" | |
11 | "include/theora/theoraenc.h" | |
12 | ) | |
13 | ||
14 | set(LIBTHEORA_COMMON | |
15 | "lib/apiwrapper.c" | |
16 | "lib/bitpack.c" | |
17 | "lib/dequant.c" | |
18 | "lib/fragment.c" | |
19 | "lib/idct.c" | |
20 | "lib/info.c" | |
21 | "lib/internal.c" | |
22 | "lib/state.c" | |
23 | "lib/quant.c" | |
24 | ||
25 | "lib/x86_vc/mmxfrag.c" | |
26 | "lib/x86_vc/mmxidct.c" | |
27 | "lib/x86_vc/mmxstate.c" | |
28 | "lib/x86_vc/x86cpu.c" | |
29 | "lib/x86_vc/x86state.c" | |
30 | ) | |
31 | ||
32 | set(LIBTHEORA_ENC | |
33 | "lib/analyze.c" | |
34 | "lib/encapiwrapper.c" | |
35 | "lib/encfrag.c" | |
36 | "lib/encinfo.c" | |
37 | "lib/encode.c" | |
38 | "lib/enquant.c" | |
39 | "lib/fdct.c" | |
40 | "lib/huffenc.c" | |
41 | "lib/mathops.c" | |
42 | "lib/mcenc.c" | |
43 | "lib/rate.c" | |
44 | "lib/tokenize.c" | |
45 | ||
46 | "lib/x86_vc/mmxencfrag.c" | |
47 | "lib/x86_vc/mmxfdct.c" | |
48 | "lib/x86_vc/x86enc.c" | |
49 | ) | |
50 | ||
51 | set(LIBTHEORA_DEC | |
52 | "lib/decapiwrapper.c" | |
53 | "lib/decinfo.c" | |
54 | "lib/decode.c" | |
55 | "lib/huffdec.c" | |
56 | ) | |
57 | ||
58 | add_definitions(-D_CRT_SECURE_NO_DEPRECATE) | |
59 | add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) | |
60 | ||
61 | option(USE_X86 "Use x86 optimization" OFF) | |
62 | if(USE_X86) | |
63 | add_definitions(-DOC_X86_ASM) | |
64 | endif() | |
65 | ||
66 | if (BUILD_SHARED_LIBS) | |
67 | add_definitions(-DLIBTHEORA_EXPORTS) | |
68 | endif() | |
69 | ||
70 | add_library(theora-common OBJECT ${LIBTHEORA_COMMON} ${HEADERS}) | |
71 | target_link_libraries(theora-common PUBLIC Ogg::ogg) | |
72 | target_include_directories(theora-common PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) | |
73 | add_library(theora-enc OBJECT ${LIBTHEORA_ENC} ${HEADERS}) | |
74 | target_link_libraries(theora-enc PUBLIC Ogg::ogg) | |
75 | target_include_directories(theora-enc PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) | |
76 | add_library(theora-dec OBJECT ${LIBTHEORA_DEC} ${HEADERS}) | |
77 | target_link_libraries(theora-dec PUBLIC Ogg::ogg) | |
78 | target_include_directories(theora-dec PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) | |
79 | ||
80 | add_library(theora $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-enc> $<TARGET_OBJECTS:theora-dec> "libtheora.def") | |
81 | target_link_libraries(theora PUBLIC Ogg::ogg) | |
82 | target_include_directories(theora PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) | |
83 | ||
84 | add_library(theoraenc $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-enc> "win32/xmingw32/libtheoraenc-all.def") | |
85 | target_link_libraries(theoraenc PUBLIC Ogg::ogg) | |
86 | target_include_directories(theoraenc PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) | |
87 | ||
88 | add_library(theoradec $<TARGET_OBJECTS:theora-common> $<TARGET_OBJECTS:theora-dec> "win32/xmingw32/libtheoradec-all.def") | |
89 | target_link_libraries(theoradec PUBLIC Ogg::ogg) | |
90 | target_include_directories(theoradec PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) | |
91 | ||
92 | include(CMakePackageConfigHelpers) | |
93 | ||
94 | configure_package_config_file(unofficial-theora-config.cmake.in unofficial-theora-config.cmake | |
95 | INSTALL_DESTINATION "lib/unofficial-theora") | |
96 | ||
97 | install(FILES ${HEADERS} DESTINATION include/theora) | |
98 | ||
99 | install( | |
100 | FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-theora-config.cmake" | |
101 | DESTINATION "lib/unofficial-theora" | |
102 | ) | |
103 | ||
104 | install(TARGETS theora theoraenc theoradec | |
105 | EXPORT unofficial-theora-targets | |
106 | RUNTIME DESTINATION bin | |
107 | LIBRARY DESTINATION bin | |
108 | ARCHIVE DESTINATION lib | |
109 | ) | |
110 | ||
111 | install(EXPORT unofficial-theora-targets | |
112 | NAMESPACE unofficial::theora:: | |
113 | DESTINATION "lib/unofficial-theora" | |
114 | ) |