summaryrefslogtreecommitdiffstats
path: root/third_party/aom/build/cmake/generate_aom_config_templates.cmake
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-15 21:45:30 -0500
committertrav90 <travawine@palemoon.org>2018-10-15 21:45:30 -0500
commit68569dee1416593955c1570d638b3d9250b33012 (patch)
treed960f017cd7eba3f125b7e8a813789ee2e076310 /third_party/aom/build/cmake/generate_aom_config_templates.cmake
parent07c17b6b98ed32fcecff15c083ab0fd878de3cf0 (diff)
downloadUXP-68569dee1416593955c1570d638b3d9250b33012.tar
UXP-68569dee1416593955c1570d638b3d9250b33012.tar.gz
UXP-68569dee1416593955c1570d638b3d9250b33012.tar.lz
UXP-68569dee1416593955c1570d638b3d9250b33012.tar.xz
UXP-68569dee1416593955c1570d638b3d9250b33012.zip
Import aom library
This is the reference implementation for the Alliance for Open Media's av1 video code. The commit used was 4d668d7feb1f8abd809d1bca0418570a7f142a36.
Diffstat (limited to 'third_party/aom/build/cmake/generate_aom_config_templates.cmake')
-rw-r--r--third_party/aom/build/cmake/generate_aom_config_templates.cmake84
1 files changed, 84 insertions, 0 deletions
diff --git a/third_party/aom/build/cmake/generate_aom_config_templates.cmake b/third_party/aom/build/cmake/generate_aom_config_templates.cmake
new file mode 100644
index 000000000..aea4253bb
--- /dev/null
+++ b/third_party/aom/build/cmake/generate_aom_config_templates.cmake
@@ -0,0 +1,84 @@
+##
+## Copyright (c) 2017, Alliance for Open Media. All rights reserved
+##
+## This source code is subject to the terms of the BSD 2 Clause License and
+## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+## was not distributed with this source code in the LICENSE file, you can
+## obtain it at www.aomedia.org/license/software. If the Alliance for Open
+## Media Patent License 1.0 was not distributed with this source code in the
+## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+##
+cmake_minimum_required(VERSION 3.5)
+
+string(TIMESTAMP year "%Y")
+set(asm_file_header_block
+"\;
+\; Copyright (c) ${year}, Alliance for Open Media. All rights reserved
+\;
+\; This source code is subject to the terms of the BSD 2 Clause License and
+\; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+\; was not distributed with this source code in the LICENSE file, you can
+\; obtain it at www.aomedia.org/license/software. If the Alliance for Open
+\; Media Patent License 1.0 was not distributed with this source code in the
+\; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+\;
+")
+set(h_file_header_block
+"/*
+ * Copyright (c) ${year}, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+\#ifndef AOM_CONFIG_H_
+\#define AOM_CONFIG_H_
+")
+
+# Terminates cmake execution when $var_name is an empty string, or the variable
+# name it contains does not expand to an existing directory.
+function (check_directory_var var_name)
+ if ("${var_name}" STREQUAL "")
+ message(FATAL_ERROR "The CMake variable ${var_name} must be defined.")
+ endif ()
+
+ if (NOT EXISTS "${${var_name}}")
+ message(FATAL_ERROR "${${var_name}} (${var_name}) missing.")
+ endif ()
+endfunction ()
+
+check_directory_var(AOM_CONFIG_DIR)
+check_directory_var(AOM_ROOT)
+
+set(AOM_DEFAULTS "${AOM_ROOT}/build/cmake/aom_config_defaults.cmake")
+if (NOT EXISTS "${AOM_DEFAULTS}")
+ message(FATAL_ERROR
+ "Configuration default values file (${AOM_DEFAULTS}) missing.")
+endif ()
+
+include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake")
+get_cmake_property(cmake_cache_vars CACHE_VARIABLES)
+
+set(aom_config_h_template "${AOM_CONFIG_DIR}/aom_config.h.cmake")
+file(WRITE "${aom_config_h_template}" ${h_file_header_block})
+foreach(cache_var ${cmake_cache_vars})
+ if (NOT "${cache_var}" MATCHES "AOM_CONFIG_DIR\|AOM_ROOT\|^CMAKE_")
+ file(APPEND
+ "${aom_config_h_template}" "\#define ${cache_var} \${${cache_var}}\n")
+ endif ()
+endforeach()
+file(APPEND "${aom_config_h_template}" "\#endif /* AOM_CONFIG_H_ */")
+
+set(aom_asm_config_template "${AOM_CONFIG_DIR}/aom_config.asm.cmake")
+file(WRITE "${aom_asm_config_template}" ${asm_file_header_block})
+foreach(cache_var ${cmake_cache_vars})
+ if (NOT "${cache_var}" MATCHES
+ "AOM_CONFIG_DIR\|AOM_ROOT\|^CMAKE_\|INLINE\|RESTRICT")
+ file(APPEND "${aom_asm_config_template}"
+ "${cache_var} equ \${${cache_var}}\n")
+ endif ()
+endforeach ()
+