test_data_download_worker.cmake (1698B)
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 the 5 # Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was 6 # not distributed with this source code in the LICENSE file, you can obtain it 7 # at www.aomedia.org/license/software. If the Alliance for Open Media Patent 8 # License 1.0 was not distributed with this source code in the PATENTS file, you 9 # can obtain it at www.aomedia.org/license/patent. 10 # 11 include("${AOM_ROOT}/test/test_data_util.cmake") 12 13 # https://github.com/cheshirekow/cmake_format/issues/34 14 # cmake-format: off 15 if (NOT AOM_ROOT OR NOT AOM_CONFIG_DIR OR NOT AOM_TEST_FILE 16 OR NOT AOM_TEST_CHECKSUM) 17 message(FATAL_ERROR 18 "AOM_ROOT, AOM_CONFIG_DIR, AOM_TEST_FILE and AOM_TEST_CHECKSUM must be 19 defined.") 20 endif () 21 # cmake-format: on 22 23 set(AOM_TEST_DATA_URL "https://storage.googleapis.com/aom-test-data") 24 25 if(NOT AOM_TEST_DATA_PATH) 26 set(AOM_TEST_DATA_PATH "$ENV{LIBAOM_TEST_DATA_PATH}") 27 endif() 28 29 if("${AOM_TEST_DATA_PATH}" STREQUAL "") 30 message( 31 WARNING "Writing test data to ${AOM_CONFIG_DIR}, set " 32 "$LIBAOM_TEST_DATA_PATH in your environment to avoid this warning.") 33 set(AOM_TEST_DATA_PATH "${AOM_CONFIG_DIR}") 34 endif() 35 36 if(NOT EXISTS "${AOM_TEST_DATA_PATH}") 37 file(MAKE_DIRECTORY "${AOM_TEST_DATA_PATH}") 38 endif() 39 40 expand_test_file_paths("AOM_TEST_FILE" "${AOM_TEST_DATA_PATH}" "filepath") 41 expand_test_file_paths("AOM_TEST_FILE" "${AOM_TEST_DATA_URL}" "url") 42 43 check_file("${filepath}" "${AOM_TEST_CHECKSUM}" "needs_download") 44 if(needs_download) 45 download_test_file("${url}" "${AOM_TEST_CHECKSUM}" "${filepath}") 46 endif()