Tom Finegan | e9d70c9 | 2017-05-10 11:31:05 -0700 | [diff] [blame] | 1 | ## |
| 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 | ## |
| 11 | include("${AOM_ROOT}/test/test_data_util.cmake") |
| 12 | |
| 13 | if (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.") |
| 18 | endif () |
| 19 | |
| 20 | set(AOM_TEST_DATA_URL |
Tom Finegan | ff959df | 2018-01-19 14:50:06 -0800 | [diff] [blame] | 21 | "http://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx") |
Tom Finegan | 9a04879 | 2017-07-11 14:42:30 -0700 | [diff] [blame] | 22 | |
| 23 | if (NOT AOM_TEST_DATA_PATH) |
| 24 | set(AOM_TEST_DATA_PATH "$ENV{LIBAOM_TEST_DATA_PATH}") |
| 25 | endif () |
Tom Finegan | e9d70c9 | 2017-05-10 11:31:05 -0700 | [diff] [blame] | 26 | |
| 27 | if ("${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}") |
| 31 | endif () |
| 32 | |
| 33 | if (NOT EXISTS "${AOM_TEST_DATA_PATH}") |
| 34 | file(MAKE_DIRECTORY "${AOM_TEST_DATA_PATH}") |
| 35 | endif () |
| 36 | |
| 37 | expand_test_file_paths("AOM_TEST_FILE" "${AOM_TEST_DATA_PATH}" "filepath") |
| 38 | expand_test_file_paths("AOM_TEST_FILE" "${AOM_TEST_DATA_URL}" "url") |
| 39 | |
| 40 | check_file("${filepath}" "${AOM_TEST_CHECKSUM}" "needs_download") |
| 41 | if (needs_download) |
| 42 | download_test_file("${url}" "${AOM_TEST_CHECKSUM}" "${filepath}") |
| 43 | endif () |