• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#
11cmake_minimum_required(VERSION 3.5)
12
13# Converts spaces in $in_string to semicolons and writes the output to
14# $out_string. In CMake's eyes this converts the input string to a list.
15function(listify_string in_string out_string)
16  string(REPLACE " " ";" ${out_string} ${in_string})
17  set(${out_string} "${${out_string}}" PARENT_SCOPE)
18endfunction()
19
20set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "AOM_DIST_DIR"
21    "AOM_DIST_INCLUDES" "AOM_DIST_LIBS" "ENABLE_DOCS")
22
23foreach(arg ${REQUIRED_ARGS})
24  if("${${arg}}" STREQUAL "")
25    message(FATAL_ERROR "${arg} must not be empty.")
26  endif()
27endforeach()
28
29if(ENABLE_DOCS)
30  file(INSTALL "${AOM_CONFIG_DIR}/docs" DESTINATION "${AOM_DIST_DIR}")
31endif()
32
33if(AOM_DIST_EXAMPLES)
34  listify_string("${AOM_DIST_EXAMPLES}" "AOM_DIST_EXAMPLES")
35  foreach(example ${AOM_DIST_EXAMPLES})
36    if(NOT "${example}" MATCHES "aomdec\|aomenc")
37      file(INSTALL "${example}" DESTINATION "${AOM_DIST_DIR}/bin/examples")
38    endif()
39  endforeach()
40endif()
41
42if(AOM_DIST_TOOLS)
43  listify_string("${AOM_DIST_TOOLS}" "AOM_DIST_TOOLS")
44  foreach(tool ${AOM_DIST_TOOLS})
45    file(INSTALL "${tool}" DESTINATION "${AOM_DIST_DIR}/bin/tools")
46  endforeach()
47endif()
48
49if(AOM_DIST_APPS)
50  listify_string("${AOM_DIST_APPS}" "AOM_DIST_APPS")
51  foreach(app ${AOM_DIST_APPS})
52    file(INSTALL "${app}" DESTINATION "${AOM_DIST_DIR}/bin")
53  endforeach()
54endif()
55
56listify_string("${AOM_DIST_INCLUDES}" "AOM_DIST_INCLUDES")
57foreach(inc ${AOM_DIST_INCLUDES})
58  file(INSTALL "${inc}" DESTINATION "${AOM_DIST_DIR}/include/aom")
59endforeach()
60
61listify_string("${AOM_DIST_LIBS}" "AOM_DIST_LIBS")
62foreach(lib ${AOM_DIST_LIBS})
63  file(INSTALL "${lib}" DESTINATION "${AOM_DIST_DIR}/lib")
64endforeach()
65