xref: /aosp_15_r20/external/libgav1/src/libgav1_decoder.cmake (revision 095378508e87ed692bf8dfeb34008b65b3735891)
1# Copyright 2019 The libgav1 Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15if(LIBGAV1_SRC_LIBGAV1_DECODER_CMAKE_)
16  return()
17endif() # LIBGAV1_SRC_LIBGAV1_DECODER_CMAKE_
18set(LIBGAV1_SRC_LIBGAV1_DECODER_CMAKE_ 1)
19
20list(APPEND libgav1_decoder_sources
21            "${libgav1_source}/buffer_pool.cc"
22            "${libgav1_source}/buffer_pool.h"
23            "${libgav1_source}/decoder_impl.cc"
24            "${libgav1_source}/decoder_impl.h"
25            "${libgav1_source}/decoder_state.h"
26            "${libgav1_source}/tile_scratch_buffer.cc"
27            "${libgav1_source}/tile_scratch_buffer.h"
28            "${libgav1_source}/film_grain.cc"
29            "${libgav1_source}/film_grain.h"
30            "${libgav1_source}/frame_buffer.cc"
31            "${libgav1_source}/frame_buffer_utils.h"
32            "${libgav1_source}/frame_scratch_buffer.h"
33            "${libgav1_source}/inter_intra_masks.inc"
34            "${libgav1_source}/internal_frame_buffer_list.cc"
35            "${libgav1_source}/internal_frame_buffer_list.h"
36            "${libgav1_source}/loop_restoration_info.cc"
37            "${libgav1_source}/loop_restoration_info.h"
38            "${libgav1_source}/motion_vector.cc"
39            "${libgav1_source}/motion_vector.h"
40            "${libgav1_source}/obu_parser.cc"
41            "${libgav1_source}/obu_parser.h"
42            "${libgav1_source}/post_filter/cdef.cc"
43            "${libgav1_source}/post_filter/deblock.cc"
44            "${libgav1_source}/post_filter/deblock_thresholds.inc"
45            "${libgav1_source}/post_filter/loop_restoration.cc"
46            "${libgav1_source}/post_filter/post_filter.cc"
47            "${libgav1_source}/post_filter/super_res.cc"
48            "${libgav1_source}/post_filter.h"
49            "${libgav1_source}/prediction_mask.cc"
50            "${libgav1_source}/prediction_mask.h"
51            "${libgav1_source}/quantizer.cc"
52            "${libgav1_source}/quantizer.h"
53            "${libgav1_source}/quantizer_tables.inc"
54            "${libgav1_source}/reconstruction.cc"
55            "${libgav1_source}/reconstruction.h"
56            "${libgav1_source}/residual_buffer_pool.cc"
57            "${libgav1_source}/residual_buffer_pool.h"
58            "${libgav1_source}/scan_tables.inc"
59            "${libgav1_source}/symbol_decoder_context.cc"
60            "${libgav1_source}/symbol_decoder_context.h"
61            "${libgav1_source}/symbol_decoder_context_cdfs.inc"
62            "${libgav1_source}/threading_strategy.cc"
63            "${libgav1_source}/threading_strategy.h"
64            "${libgav1_source}/tile.h"
65            "${libgav1_source}/tile/bitstream/mode_info.cc"
66            "${libgav1_source}/tile/bitstream/palette.cc"
67            "${libgav1_source}/tile/bitstream/partition.cc"
68            "${libgav1_source}/tile/bitstream/transform_size.cc"
69            "${libgav1_source}/tile/prediction.cc"
70            "${libgav1_source}/tile/tile.cc"
71            "${libgav1_source}/warp_prediction.cc"
72            "${libgav1_source}/warp_prediction.h"
73            "${libgav1_source}/yuv_buffer.cc"
74            "${libgav1_source}/yuv_buffer.h")
75
76list(APPEND libgav1_api_includes "${libgav1_source}/gav1/decoder.h"
77            "${libgav1_source}/gav1/decoder_buffer.h"
78            "${libgav1_source}/gav1/decoder_settings.h"
79            "${libgav1_source}/gav1/frame_buffer.h"
80            "${libgav1_source}/gav1/status_code.h"
81            "${libgav1_source}/gav1/symbol_visibility.h"
82            "${libgav1_source}/gav1/version.h")
83
84list(APPEND libgav1_api_sources "${libgav1_source}/decoder.cc"
85            "${libgav1_source}/decoder_settings.cc"
86            "${libgav1_source}/status_code.cc"
87            "${libgav1_source}/version.cc"
88            ${libgav1_api_includes})
89
90macro(libgav1_add_decoder_targets)
91  if(BUILD_SHARED_LIBS)
92    if(MSVC OR WIN32)
93      # In order to produce a DLL and import library the Windows tools require
94      # that the exported symbols are part of the DLL target. The unfortunate
95      # side effect of this is that a single configuration cannot output both
96      # the static library and the DLL: This results in an either/or situation.
97      # Windows users of the libgav1 build can have a DLL and an import library,
98      # or they can have a static library; they cannot have both from a single
99      # configuration of the build.
100      list(APPEND libgav1_shared_lib_sources ${libgav1_api_sources})
101      list(APPEND libgav1_static_lib_sources ${libgav1_api_includes})
102    else()
103      list(APPEND libgav1_shared_lib_sources ${libgav1_api_includes})
104      list(APPEND libgav1_static_lib_sources ${libgav1_api_sources})
105    endif()
106  else()
107    list(APPEND libgav1_static_lib_sources ${libgav1_api_sources})
108  endif()
109
110  if(use_absl_threading)
111    list(APPEND libgav1_absl_deps absl::base absl::synchronization)
112  endif()
113
114  libgav1_add_library(NAME libgav1_decoder TYPE OBJECT SOURCES
115                      ${libgav1_decoder_sources} DEFINES ${libgav1_defines}
116                      INCLUDES ${libgav1_include_paths})
117
118  libgav1_add_library(NAME
119                      libgav1_static
120                      OUTPUT_NAME
121                      libgav1
122                      TYPE
123                      STATIC
124                      SOURCES
125                      ${libgav1_static_lib_sources}
126                      DEFINES
127                      ${libgav1_defines}
128                      INCLUDES
129                      ${libgav1_include_paths}
130                      LIB_DEPS
131                      ${libgav1_absl_deps}
132                      OBJLIB_DEPS
133                      libgav1_dsp
134                      libgav1_decoder
135                      libgav1_utils
136                      PUBLIC_INCLUDES
137                      ${libgav1_source})
138
139  if(BUILD_SHARED_LIBS)
140    libgav1_add_library(NAME
141                        libgav1_shared
142                        OUTPUT_NAME
143                        libgav1
144                        TYPE
145                        SHARED
146                        SOURCES
147                        ${libgav1_shared_lib_sources}
148                        DEFINES
149                        ${libgav1_defines}
150                        INCLUDES
151                        ${libgav1_include_paths}
152                        LIB_DEPS
153                        libgav1_static
154                        PUBLIC_INCLUDES
155                        ${libgav1_source})
156  endif()
157endmacro()
158