blob: 8b1f9abecf11cf7998867a108b0191a2a79b0ac7 [file] [log] [blame]
Tom Finegane9d70c92017-05-10 11:31:05 -07001##
2## Copyright (c) 2017, Alliance for Open Media. All rights reserved
3##
4## This source code is subject to the terms of the BSD 2 Clause License and
5## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6## was not distributed with this source code in the LICENSE file, you can
7## obtain it at www.aomedia.org/license/software. If the Alliance for Open
8## Media Patent License 1.0 was not distributed with this source code in the
9## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10##
11include("${AOM_ROOT}/test/test_data_util.cmake")
12
13if (NOT AOM_ROOT OR NOT AOM_CONFIG_DIR OR NOT AOM_TEST_FILE
14 OR NOT AOM_TEST_CHECKSUM)
15 message(FATAL_ERROR
16 "AOM_ROOT, AOM_CONFIG_DIR, AOM_TEST_FILE and AOM_TEST_CHECKSUM must be
17 defined.")
18endif ()
19
20set(AOM_TEST_DATA_URL
Tom Fineganff959df2018-01-19 14:50:06 -080021 "http://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx")
Tom Finegan9a048792017-07-11 14:42:30 -070022
23if (NOT AOM_TEST_DATA_PATH)
24 set(AOM_TEST_DATA_PATH "$ENV{LIBAOM_TEST_DATA_PATH}")
25endif ()
Tom Finegane9d70c92017-05-10 11:31:05 -070026
27if ("${AOM_TEST_DATA_PATH}" STREQUAL "")
28 message(WARNING "Writing test data to ${AOM_CONFIG_DIR}, set "
29 "$LIBAOM_TEST_DATA_PATH in your environment to avoid this warning.")
30 set(AOM_TEST_DATA_PATH "${AOM_CONFIG_DIR}")
31endif ()
32
33if (NOT EXISTS "${AOM_TEST_DATA_PATH}")
34 file(MAKE_DIRECTORY "${AOM_TEST_DATA_PATH}")
35endif ()
36
37expand_test_file_paths("AOM_TEST_FILE" "${AOM_TEST_DATA_PATH}" "filepath")
38expand_test_file_paths("AOM_TEST_FILE" "${AOM_TEST_DATA_URL}" "url")
39
40check_file("${filepath}" "${AOM_TEST_CHECKSUM}" "needs_download")
41if (needs_download)
42 download_test_file("${url}" "${AOM_TEST_CHECKSUM}" "${filepath}")
43endif ()