1## Copyright (c) 2015 The WebM project authors. All Rights Reserved. 2## 3## Use of this source code is governed by a BSD-style license 4## that can be found in the LICENSE file in the root of the source 5## tree. An additional intellectual property rights grant can be found 6## in the file PATENTS. All contributing project authors may 7## be found in the AUTHORS file in the root of the source tree. 8cmake_minimum_required(VERSION 3.2) 9project(LIBWEBM CXX) 10 11include(GNUInstallDirs) 12include("${CMAKE_CURRENT_SOURCE_DIR}/build/cxx_flags.cmake") 13 14if (NOT BUILD_SHARED_LIBS) 15 include("${CMAKE_CURRENT_SOURCE_DIR}/build/msvc_runtime.cmake") 16endif () 17 18set(LIBWEBM_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 19 20# Build/test configuration flags. 21option(ENABLE_WEBMTS "Enables WebM PES/TS support." ON) 22option(ENABLE_WEBMINFO "Enables building webm_info." ON) 23option(ENABLE_TESTS "Enables tests." OFF) 24option(ENABLE_IWYU "Enables include-what-you-use support." OFF) 25option(ENABLE_WERROR "Enable warnings as errors." OFF) 26option(ENABLE_WEBM_PARSER "Enables new parser API." OFF) 27 28if(WIN32) 29 require_cxx_flag_nomsvc("-std=gnu++11") 30else() 31 require_cxx_flag_nomsvc("-std=c++11") 32endif() 33 34add_cxx_preproc_definition("__STDC_CONSTANT_MACROS") 35add_cxx_preproc_definition("__STDC_FORMAT_MACROS") 36add_cxx_preproc_definition("__STDC_LIMIT_MACROS") 37 38# Set up compiler flags and build properties. 39include_directories("${LIBWEBM_SRC_DIR}") 40 41if (MSVC) 42 add_cxx_flag_if_supported("/W4") 43 # Disable MSVC warnings that suggest making code non-portable. 44 add_cxx_flag_if_supported("/wd4996") 45 if (ENABLE_WERROR) 46 add_cxx_flag_if_supported("/WX") 47 endif () 48else () 49 add_cxx_flag_if_supported("-Wall") 50 add_cxx_flag_if_supported("-Wextra") 51 add_cxx_flag_if_supported("-Wnarrowing") 52 add_cxx_flag_if_supported("-Wno-deprecated") 53 add_cxx_flag_if_supported("-Wshorten-64-to-32") 54 if (ENABLE_WERROR) 55 add_cxx_flag_if_supported("-Werror") 56 endif () 57endif () 58 59# Source list variables. 60set(dumpvtt_sources "${LIBWEBM_SRC_DIR}/dumpvtt.cc") 61 62set(libwebm_common_sources 63 "${LIBWEBM_SRC_DIR}/common/file_util.cc" 64 "${LIBWEBM_SRC_DIR}/common/file_util.h" 65 "${LIBWEBM_SRC_DIR}/common/hdr_util.cc" 66 "${LIBWEBM_SRC_DIR}/common/hdr_util.h" 67 "${LIBWEBM_SRC_DIR}/common/webmids.h") 68 69set(mkvmuxer_sources 70 "${LIBWEBM_SRC_DIR}/mkvmuxer/mkvmuxer.cc" 71 "${LIBWEBM_SRC_DIR}/mkvmuxer/mkvmuxer.h" 72 "${LIBWEBM_SRC_DIR}/mkvmuxer/mkvmuxertypes.h" 73 "${LIBWEBM_SRC_DIR}/mkvmuxer/mkvmuxerutil.cc" 74 "${LIBWEBM_SRC_DIR}/mkvmuxer/mkvmuxerutil.h" 75 "${LIBWEBM_SRC_DIR}/mkvmuxer/mkvwriter.cc" 76 "${LIBWEBM_SRC_DIR}/mkvmuxer/mkvwriter.h" 77 "${LIBWEBM_SRC_DIR}/common/webmids.h") 78 79set(mkvmuxer_sample_sources 80 "${LIBWEBM_SRC_DIR}/mkvmuxer_sample.cc" 81 "${LIBWEBM_SRC_DIR}/sample_muxer_metadata.cc" 82 "${LIBWEBM_SRC_DIR}/sample_muxer_metadata.h") 83 84set(mkvmuxer_tests_sources 85 "${LIBWEBM_SRC_DIR}/testing/mkvmuxer_tests.cc" 86 "${LIBWEBM_SRC_DIR}/testing/test_util.cc" 87 "${LIBWEBM_SRC_DIR}/testing/test_util.h") 88 89set(mkvparser_sources 90 "${LIBWEBM_SRC_DIR}/mkvparser/mkvparser.cc" 91 "${LIBWEBM_SRC_DIR}/mkvparser/mkvparser.h" 92 "${LIBWEBM_SRC_DIR}/mkvparser/mkvreader.cc" 93 "${LIBWEBM_SRC_DIR}/mkvparser/mkvreader.h" 94 "${LIBWEBM_SRC_DIR}/common/webmids.h") 95 96set(mkvparser_sample_sources "${LIBWEBM_SRC_DIR}/mkvparser_sample.cc") 97set(mkvparser_tests_sources 98 "${LIBWEBM_SRC_DIR}/testing/mkvparser_tests.cc" 99 "${LIBWEBM_SRC_DIR}/testing/test_util.cc" 100 "${LIBWEBM_SRC_DIR}/testing/test_util.h") 101 102set(vp9_header_parser_tests_sources 103 "${LIBWEBM_SRC_DIR}/common/vp9_header_parser_tests.cc" 104 "${LIBWEBM_SRC_DIR}/common/vp9_header_parser.cc" 105 "${LIBWEBM_SRC_DIR}/common/vp9_header_parser.h" 106 "${LIBWEBM_SRC_DIR}/testing/test_util.cc" 107 "${LIBWEBM_SRC_DIR}/testing/test_util.h") 108 109set(vp9_level_stats_tests_sources 110 "${LIBWEBM_SRC_DIR}/common/vp9_header_parser.cc" 111 "${LIBWEBM_SRC_DIR}/common/vp9_header_parser.h" 112 "${LIBWEBM_SRC_DIR}/common/vp9_level_stats_tests.cc" 113 "${LIBWEBM_SRC_DIR}/common/vp9_level_stats.cc" 114 "${LIBWEBM_SRC_DIR}/common/vp9_level_stats.h" 115 "${LIBWEBM_SRC_DIR}/testing/test_util.cc" 116 "${LIBWEBM_SRC_DIR}/testing/test_util.h") 117 118set(vttdemux_sources 119 "${LIBWEBM_SRC_DIR}/vttdemux.cc" 120 "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.cc" 121 "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.h") 122 123set(webm_parser_public_headers 124 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/buffer_reader.h" 125 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/callback.h" 126 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/dom_types.h" 127 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/element.h" 128 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/file_reader.h" 129 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/id.h" 130 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/istream_reader.h" 131 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/reader.h" 132 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/status.h" 133 "${LIBWEBM_SRC_DIR}/webm_parser/include/webm/webm_parser.h") 134 135set(webm_parser_sources 136 ${webm_parser_public_headers} 137 "${LIBWEBM_SRC_DIR}/webm_parser/src/ancestory.cc" 138 "${LIBWEBM_SRC_DIR}/webm_parser/src/ancestory.h" 139 "${LIBWEBM_SRC_DIR}/webm_parser/src/audio_parser.h" 140 "${LIBWEBM_SRC_DIR}/webm_parser/src/bit_utils.cc" 141 "${LIBWEBM_SRC_DIR}/webm_parser/src/bit_utils.h" 142 "${LIBWEBM_SRC_DIR}/webm_parser/src/block_additions_parser.h" 143 "${LIBWEBM_SRC_DIR}/webm_parser/src/block_group_parser.h" 144 "${LIBWEBM_SRC_DIR}/webm_parser/src/block_header_parser.cc" 145 "${LIBWEBM_SRC_DIR}/webm_parser/src/block_header_parser.h" 146 "${LIBWEBM_SRC_DIR}/webm_parser/src/block_more_parser.h" 147 "${LIBWEBM_SRC_DIR}/webm_parser/src/block_parser.cc" 148 "${LIBWEBM_SRC_DIR}/webm_parser/src/block_parser.h" 149 "${LIBWEBM_SRC_DIR}/webm_parser/src/bool_parser.h" 150 "${LIBWEBM_SRC_DIR}/webm_parser/src/buffer_reader.cc" 151 "${LIBWEBM_SRC_DIR}/webm_parser/src/byte_parser.h" 152 "${LIBWEBM_SRC_DIR}/webm_parser/src/callback.cc" 153 "${LIBWEBM_SRC_DIR}/webm_parser/src/chapter_atom_parser.h" 154 "${LIBWEBM_SRC_DIR}/webm_parser/src/chapter_display_parser.h" 155 "${LIBWEBM_SRC_DIR}/webm_parser/src/chapters_parser.h" 156 "${LIBWEBM_SRC_DIR}/webm_parser/src/cluster_parser.h" 157 "${LIBWEBM_SRC_DIR}/webm_parser/src/colour_parser.h" 158 "${LIBWEBM_SRC_DIR}/webm_parser/src/content_enc_aes_settings_parser.h" 159 "${LIBWEBM_SRC_DIR}/webm_parser/src/content_encoding_parser.h" 160 "${LIBWEBM_SRC_DIR}/webm_parser/src/content_encodings_parser.h" 161 "${LIBWEBM_SRC_DIR}/webm_parser/src/content_encryption_parser.h" 162 "${LIBWEBM_SRC_DIR}/webm_parser/src/cue_point_parser.h" 163 "${LIBWEBM_SRC_DIR}/webm_parser/src/cue_track_positions_parser.h" 164 "${LIBWEBM_SRC_DIR}/webm_parser/src/cues_parser.h" 165 "${LIBWEBM_SRC_DIR}/webm_parser/src/date_parser.cc" 166 "${LIBWEBM_SRC_DIR}/webm_parser/src/date_parser.h" 167 "${LIBWEBM_SRC_DIR}/webm_parser/src/ebml_parser.h" 168 "${LIBWEBM_SRC_DIR}/webm_parser/src/edition_entry_parser.h" 169 "${LIBWEBM_SRC_DIR}/webm_parser/src/element_parser.h" 170 "${LIBWEBM_SRC_DIR}/webm_parser/src/file_reader.cc" 171 "${LIBWEBM_SRC_DIR}/webm_parser/src/float_parser.cc" 172 "${LIBWEBM_SRC_DIR}/webm_parser/src/float_parser.h" 173 "${LIBWEBM_SRC_DIR}/webm_parser/src/id_element_parser.cc" 174 "${LIBWEBM_SRC_DIR}/webm_parser/src/id_element_parser.h" 175 "${LIBWEBM_SRC_DIR}/webm_parser/src/id_parser.cc" 176 "${LIBWEBM_SRC_DIR}/webm_parser/src/id_parser.h" 177 "${LIBWEBM_SRC_DIR}/webm_parser/src/info_parser.h" 178 "${LIBWEBM_SRC_DIR}/webm_parser/src/int_parser.h" 179 "${LIBWEBM_SRC_DIR}/webm_parser/src/istream_reader.cc" 180 "${LIBWEBM_SRC_DIR}/webm_parser/src/master_parser.cc" 181 "${LIBWEBM_SRC_DIR}/webm_parser/src/master_parser.h" 182 "${LIBWEBM_SRC_DIR}/webm_parser/src/master_value_parser.h" 183 "${LIBWEBM_SRC_DIR}/webm_parser/src/mastering_metadata_parser.h" 184 "${LIBWEBM_SRC_DIR}/webm_parser/src/parser.h" 185 "${LIBWEBM_SRC_DIR}/webm_parser/src/parser_utils.cc" 186 "${LIBWEBM_SRC_DIR}/webm_parser/src/parser_utils.h" 187 "${LIBWEBM_SRC_DIR}/webm_parser/src/projection_parser.h" 188 "${LIBWEBM_SRC_DIR}/webm_parser/src/recursive_parser.h" 189 "${LIBWEBM_SRC_DIR}/webm_parser/src/seek_head_parser.h" 190 "${LIBWEBM_SRC_DIR}/webm_parser/src/seek_parser.h" 191 "${LIBWEBM_SRC_DIR}/webm_parser/src/segment_parser.cc" 192 "${LIBWEBM_SRC_DIR}/webm_parser/src/segment_parser.h" 193 "${LIBWEBM_SRC_DIR}/webm_parser/src/simple_tag_parser.h" 194 "${LIBWEBM_SRC_DIR}/webm_parser/src/size_parser.cc" 195 "${LIBWEBM_SRC_DIR}/webm_parser/src/size_parser.h" 196 "${LIBWEBM_SRC_DIR}/webm_parser/src/skip_callback.h" 197 "${LIBWEBM_SRC_DIR}/webm_parser/src/skip_parser.cc" 198 "${LIBWEBM_SRC_DIR}/webm_parser/src/skip_parser.h" 199 "${LIBWEBM_SRC_DIR}/webm_parser/src/slices_parser.h" 200 "${LIBWEBM_SRC_DIR}/webm_parser/src/tag_parser.h" 201 "${LIBWEBM_SRC_DIR}/webm_parser/src/tags_parser.h" 202 "${LIBWEBM_SRC_DIR}/webm_parser/src/targets_parser.h" 203 "${LIBWEBM_SRC_DIR}/webm_parser/src/time_slice_parser.h" 204 "${LIBWEBM_SRC_DIR}/webm_parser/src/track_entry_parser.h" 205 "${LIBWEBM_SRC_DIR}/webm_parser/src/tracks_parser.h" 206 "${LIBWEBM_SRC_DIR}/webm_parser/src/unknown_parser.cc" 207 "${LIBWEBM_SRC_DIR}/webm_parser/src/unknown_parser.h" 208 "${LIBWEBM_SRC_DIR}/webm_parser/src/var_int_parser.cc" 209 "${LIBWEBM_SRC_DIR}/webm_parser/src/var_int_parser.h" 210 "${LIBWEBM_SRC_DIR}/webm_parser/src/video_parser.h" 211 "${LIBWEBM_SRC_DIR}/webm_parser/src/virtual_block_parser.cc" 212 "${LIBWEBM_SRC_DIR}/webm_parser/src/virtual_block_parser.h" 213 "${LIBWEBM_SRC_DIR}/webm_parser/src/void_parser.cc" 214 "${LIBWEBM_SRC_DIR}/webm_parser/src/void_parser.h" 215 "${LIBWEBM_SRC_DIR}/webm_parser/src/webm_parser.cc") 216 217set(webm_parser_demo_sources "${LIBWEBM_SRC_DIR}/webm_parser/demo/demo.cc") 218set(webm_parser_tests_sources 219 "${LIBWEBM_SRC_DIR}/webm_parser/tests/audio_parser_test.cc" 220 "${LIBWEBM_SRC_DIR}/webm_parser/tests/bit_utils_test.cc" 221 "${LIBWEBM_SRC_DIR}/webm_parser/tests/block_additions_parser_test.cc" 222 "${LIBWEBM_SRC_DIR}/webm_parser/tests/block_group_parser_test.cc" 223 "${LIBWEBM_SRC_DIR}/webm_parser/tests/block_header_parser_test.cc" 224 "${LIBWEBM_SRC_DIR}/webm_parser/tests/block_more_parser_test.cc" 225 "${LIBWEBM_SRC_DIR}/webm_parser/tests/block_parser_test.cc" 226 "${LIBWEBM_SRC_DIR}/webm_parser/tests/bool_parser_test.cc" 227 "${LIBWEBM_SRC_DIR}/webm_parser/tests/buffer_reader_test.cc" 228 "${LIBWEBM_SRC_DIR}/webm_parser/tests/byte_parser_test.cc" 229 "${LIBWEBM_SRC_DIR}/webm_parser/tests/callback_test.cc" 230 "${LIBWEBM_SRC_DIR}/webm_parser/tests/chapter_atom_parser_test.cc" 231 "${LIBWEBM_SRC_DIR}/webm_parser/tests/chapter_display_parser_test.cc" 232 "${LIBWEBM_SRC_DIR}/webm_parser/tests/chapters_parser_test.cc" 233 "${LIBWEBM_SRC_DIR}/webm_parser/tests/cluster_parser_test.cc" 234 "${LIBWEBM_SRC_DIR}/webm_parser/tests/colour_parser_test.cc" 235 "${LIBWEBM_SRC_DIR}/webm_parser/tests/content_enc_aes_settings_parser_test.cc" 236 "${LIBWEBM_SRC_DIR}/webm_parser/tests/content_encoding_parser_test.cc" 237 "${LIBWEBM_SRC_DIR}/webm_parser/tests/content_encodings_parser_test.cc" 238 "${LIBWEBM_SRC_DIR}/webm_parser/tests/content_encryption_parser_test.cc" 239 "${LIBWEBM_SRC_DIR}/webm_parser/tests/cue_point_parser_test.cc" 240 "${LIBWEBM_SRC_DIR}/webm_parser/tests/cue_track_positions_parser_test.cc" 241 "${LIBWEBM_SRC_DIR}/webm_parser/tests/cues_parser_test.cc" 242 "${LIBWEBM_SRC_DIR}/webm_parser/tests/date_parser_test.cc" 243 "${LIBWEBM_SRC_DIR}/webm_parser/tests/ebml_parser_test.cc" 244 "${LIBWEBM_SRC_DIR}/webm_parser/tests/edition_entry_parser_test.cc" 245 "${LIBWEBM_SRC_DIR}/webm_parser/tests/element_test.cc" 246 "${LIBWEBM_SRC_DIR}/webm_parser/tests/float_parser_test.cc" 247 "${LIBWEBM_SRC_DIR}/webm_parser/tests/id_element_parser_test.cc" 248 "${LIBWEBM_SRC_DIR}/webm_parser/tests/id_parser_test.cc" 249 "${LIBWEBM_SRC_DIR}/webm_parser/tests/info_parser_test.cc" 250 "${LIBWEBM_SRC_DIR}/webm_parser/tests/int_parser_test.cc" 251 "${LIBWEBM_SRC_DIR}/webm_parser/tests/istream_reader_test.cc" 252 "${LIBWEBM_SRC_DIR}/webm_parser/tests/limited_reader_test.cc" 253 "${LIBWEBM_SRC_DIR}/webm_parser/tests/master_parser_test.cc" 254 "${LIBWEBM_SRC_DIR}/webm_parser/tests/master_value_parser_test.cc" 255 "${LIBWEBM_SRC_DIR}/webm_parser/tests/mastering_metadata_parser_test.cc" 256 "${LIBWEBM_SRC_DIR}/webm_parser/tests/parser_utils_test.cc" 257 "${LIBWEBM_SRC_DIR}/webm_parser/tests/projection_parser_test.cc" 258 "${LIBWEBM_SRC_DIR}/webm_parser/tests/recursive_parser_test.cc" 259 "${LIBWEBM_SRC_DIR}/webm_parser/tests/seek_head_parser_test.cc" 260 "${LIBWEBM_SRC_DIR}/webm_parser/tests/seek_parser_test.cc" 261 "${LIBWEBM_SRC_DIR}/webm_parser/tests/segment_parser_test.cc" 262 "${LIBWEBM_SRC_DIR}/webm_parser/tests/simple_tag_parser_test.cc" 263 "${LIBWEBM_SRC_DIR}/webm_parser/tests/size_parser_test.cc" 264 "${LIBWEBM_SRC_DIR}/webm_parser/tests/skip_parser_test.cc" 265 "${LIBWEBM_SRC_DIR}/webm_parser/tests/slices_parser_test.cc" 266 "${LIBWEBM_SRC_DIR}/webm_parser/tests/tag_parser_test.cc" 267 "${LIBWEBM_SRC_DIR}/webm_parser/tests/tags_parser_test.cc" 268 "${LIBWEBM_SRC_DIR}/webm_parser/tests/targets_parser_test.cc" 269 "${LIBWEBM_SRC_DIR}/webm_parser/tests/time_slice_parser_test.cc" 270 "${LIBWEBM_SRC_DIR}/webm_parser/tests/track_entry_parser_test.cc" 271 "${LIBWEBM_SRC_DIR}/webm_parser/tests/tracks_parser_test.cc" 272 "${LIBWEBM_SRC_DIR}/webm_parser/tests/unknown_parser_test.cc" 273 "${LIBWEBM_SRC_DIR}/webm_parser/tests/var_int_parser_test.cc" 274 "${LIBWEBM_SRC_DIR}/webm_parser/tests/video_parser_test.cc" 275 "${LIBWEBM_SRC_DIR}/webm_parser/tests/virtual_block_parser_test.cc" 276 "${LIBWEBM_SRC_DIR}/webm_parser/tests/void_parser_test.cc" 277 "${LIBWEBM_SRC_DIR}/webm_parser/tests/webm_parser_test.cc" 278 "${LIBWEBM_SRC_DIR}/webm_parser/test_utils/element_parser_test.h" 279 "${LIBWEBM_SRC_DIR}/webm_parser/test_utils/limited_reader.cc" 280 "${LIBWEBM_SRC_DIR}/webm_parser/test_utils/limited_reader.h" 281 "${LIBWEBM_SRC_DIR}/webm_parser/test_utils/mock_callback.h" 282 "${LIBWEBM_SRC_DIR}/webm_parser/test_utils/parser_test.h" 283 "${LIBWEBM_SRC_DIR}/webm_parser/tests/webm_parser_tests.cc") 284 285set(webm_info_sources 286 "${LIBWEBM_SRC_DIR}/common/indent.cc" 287 "${LIBWEBM_SRC_DIR}/common/indent.h" 288 "${LIBWEBM_SRC_DIR}/common/vp9_header_parser.cc" 289 "${LIBWEBM_SRC_DIR}/common/vp9_header_parser.h" 290 "${LIBWEBM_SRC_DIR}/common/vp9_level_stats.cc" 291 "${LIBWEBM_SRC_DIR}/common/vp9_level_stats.h" 292 "${LIBWEBM_SRC_DIR}/common/webm_constants.h" 293 "${LIBWEBM_SRC_DIR}/common/webm_endian.cc" 294 "${LIBWEBM_SRC_DIR}/common/webm_endian.h" 295 "${LIBWEBM_SRC_DIR}/webm_info.cc") 296 297set(webmts_sources 298 "${LIBWEBM_SRC_DIR}/common/libwebm_util.cc" 299 "${LIBWEBM_SRC_DIR}/common/libwebm_util.h" 300 "${LIBWEBM_SRC_DIR}/common/video_frame.cc" 301 "${LIBWEBM_SRC_DIR}/common/video_frame.h" 302 "${LIBWEBM_SRC_DIR}/m2ts/vpxpes2ts.cc" 303 "${LIBWEBM_SRC_DIR}/m2ts/vpxpes2ts.h" 304 "${LIBWEBM_SRC_DIR}/m2ts/vpxpes_parser.cc" 305 "${LIBWEBM_SRC_DIR}/m2ts/vpxpes_parser.h" 306 "${LIBWEBM_SRC_DIR}/m2ts/webm2pes.cc" 307 "${LIBWEBM_SRC_DIR}/m2ts/webm2pes.h") 308 309set(webm2pes_sources "${LIBWEBM_SRC_DIR}/m2ts/webm2pes_main.cc") 310set(webm2pes_tests_sources 311 "${LIBWEBM_SRC_DIR}/testing/test_util.cc" 312 "${LIBWEBM_SRC_DIR}/testing/test_util.h" 313 "${LIBWEBM_SRC_DIR}/testing/video_frame_tests.cc" 314 "${LIBWEBM_SRC_DIR}/m2ts/tests/webm2pes_tests.cc") 315set(webm2ts_sources "${LIBWEBM_SRC_DIR}/m2ts/vpxpes2ts_main.cc") 316 317set(webvtt_common_sources 318 "${LIBWEBM_SRC_DIR}/webvtt/vttreader.cc" 319 "${LIBWEBM_SRC_DIR}/webvtt/vttreader.h" 320 "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.cc" 321 "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.h") 322 323# Targets. 324add_library(mkvmuxer OBJECT ${mkvmuxer_sources}) 325add_library(mkvparser OBJECT ${mkvparser_sources}) 326add_library(webvtt_common OBJECT ${webvtt_common_sources}) 327 328add_library(webm ${libwebm_common_sources} 329 $<TARGET_OBJECTS:mkvmuxer> 330 $<TARGET_OBJECTS:mkvparser>) 331 332if (WIN32) 333 # Use libwebm and libwebm.lib for project and library name on Windows (instead 334 # webm and webm.lib). 335 set_target_properties(webm PROPERTIES PROJECT_LABEL libwebm) 336 set_target_properties(webm PROPERTIES PREFIX lib) 337endif () 338 339add_executable(mkvparser_sample ${mkvparser_sample_sources}) 340target_link_libraries(mkvparser_sample LINK_PUBLIC webm) 341 342add_executable(mkvmuxer_sample ${mkvmuxer_sample_sources} 343 $<TARGET_OBJECTS:webvtt_common>) 344target_link_libraries(mkvmuxer_sample LINK_PUBLIC webm) 345 346add_executable(dumpvtt ${dumpvtt_sources} $<TARGET_OBJECTS:webvtt_common>) 347target_link_libraries(dumpvtt LINK_PUBLIC webm) 348 349add_executable(vttdemux ${vttdemux_sources}) 350target_link_libraries(vttdemux LINK_PUBLIC webm) 351 352if (ENABLE_WEBMINFO) 353 add_executable(webm_info ${webm_info_sources}) 354 target_link_libraries(webm_info LINK_PUBLIC webm) 355endif () 356 357if (ENABLE_WEBM_PARSER) 358 include_directories(webm_parser webm_parser/include) 359 add_library(webm_parser OBJECT ${webm_parser_sources}) 360 target_sources(webm PUBLIC $<TARGET_OBJECTS:webm_parser>) 361 set_target_properties(webm PROPERTIES PUBLIC_HEADER 362 "${webm_parser_public_headers}") 363 364 add_executable(webm_parser_demo ${webm_parser_demo_sources}) 365 target_link_libraries(webm_parser_demo LINK_PUBLIC webm) 366 367 install(TARGETS webm 368 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 369 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 370 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 371 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webm) 372endif () 373 374if (ENABLE_WEBMTS) 375 add_library(webmts OBJECT ${webmts_sources}) 376 377 add_executable(webm2pes ${webm2pes_sources} $<TARGET_OBJECTS:webmts>) 378 target_link_libraries(webm2pes LINK_PUBLIC webm) 379 380 add_executable(webm2ts ${webm2ts_sources} $<TARGET_OBJECTS:webmts>) 381 target_link_libraries(webm2ts LINK_PUBLIC webm) 382endif () 383 384if (ENABLE_TESTS) 385 set(GTEST_SRC_DIR "${LIBWEBM_SRC_DIR}/../googletest" CACHE PATH 386 "Path to Googletest git repository.") 387 # This directory is where libwebm will build googletest dependencies. 388 set(GTEST_BUILD_DIR "${CMAKE_BINARY_DIR}/googletest_build") 389 390 if (LIBWEBM_DISABLE_GTEST_CMAKE) 391 add_library(gtest STATIC "${GTEST_SRC_DIR}/googletest/src/gtest-all.cc") 392 include_directories("${GTEST_SRC_DIR}/googletest") 393 else () 394 add_subdirectory("${GTEST_SRC_DIR}" "${GTEST_BUILD_DIR}") 395 endif () 396 include_directories("${GTEST_SRC_DIR}/googletest/include") 397 398 add_executable(mkvmuxer_tests ${mkvmuxer_tests_sources}) 399 target_link_libraries(mkvmuxer_tests LINK_PUBLIC gtest webm) 400 401 add_executable(mkvparser_tests ${mkvparser_tests_sources}) 402 target_link_libraries(mkvparser_tests LINK_PUBLIC gtest webm) 403 404 add_executable(vp9_header_parser_tests ${vp9_header_parser_tests_sources}) 405 target_link_libraries(vp9_header_parser_tests LINK_PUBLIC gtest webm) 406 407 add_executable(vp9_level_stats_tests ${vp9_level_stats_tests_sources}) 408 target_link_libraries(vp9_level_stats_tests LINK_PUBLIC gtest webm) 409 410 if (ENABLE_WEBMTS) 411 add_executable(webm2pes_tests ${webm2pes_tests_sources} 412 $<TARGET_OBJECTS:webmts>) 413 target_link_libraries(webm2pes_tests LINK_PUBLIC gtest webm) 414 endif () 415 416 if (ENABLE_WEBM_PARSER) 417 include_directories("${GTEST_SRC_DIR}/googlemock/include") 418 add_executable(webm_parser_tests ${webm_parser_tests_sources}) 419 target_link_libraries(webm_parser_tests LINK_PUBLIC gmock gtest webm) 420 endif () 421endif () 422 423# Include-what-you-use. 424if (ENABLE_IWYU) 425 # Make sure all the tools necessary for IWYU are present. 426 find_program(iwyu_path NAMES include-what-you-use) 427 find_program(iwyu_tool_path NAMES iwyu_tool.py) 428 429 # Some odd behavior on cmake's part: PYTHON_EXECUTABLE and PYTHON_VERSION_* 430 # are set by cmake when it does its internal python check, but 431 # PYTHONINTERP_FOUND is empty without explicitly looking for it. 432 find_package(PythonInterp) 433 434 if (iwyu_path AND iwyu_tool_path AND PYTHONINTERP_FOUND) 435 # Enable compilation command export (needed for iwyu_tool.py) 436 set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 437 438 # Add a custom target to run iwyu across all targets. 439 add_custom_target(iwyu 440 ALL 441 COMMAND "${PYTHON_EXECUTABLE}" "${iwyu_tool_path}" -p 442 "${CMAKE_BINARY_DIR}" 443 COMMENT "Running include-what-you-use..." 444 VERBATIM) 445 else () 446 message(STATUS "Ignoring ENABLE_IWYU because reasons:") 447 message(STATUS " iwyu_path=" ${iwyu_path}) 448 message(STATUS " iwyu_tool_path=" ${iwyu_tool_path}) 449 message(STATUS " PYTHONINTERP_FOUND=" ${PYTHONINTERP_FOUND}) 450 message(STATUS " See README.libwebm for more information.") 451 endif () 452endif () 453