blob: baa29828bb3dd6a6c7f64091178f3c1a33ad4d49 [file] [log] [blame]
Tom Finegan84f2d792017-06-15 23:06:44 -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##
11cmake_minimum_required(VERSION 3.5)
12
13set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "AOM_TARGET_SYSTEM" "AOM_SYM_FILE"
14 "CONFIG_AV1_DECODER" "CONFIG_AV1_ENCODER")
15
16foreach (arg ${REQUIRED_ARGS})
17 if ("${${arg}}" STREQUAL "")
18 message(FATAL_ERROR "${arg} must not be empty.")
19 endif ()
20endforeach ()
21
22include("${AOM_ROOT}/build/cmake/exports_sources.cmake")
23
24if ("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
25 set(symbol_prefix "_")
26elseif ("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND AOM_MSVC)
27 set(symbol_prefix "_")
28 file(WRITE "${AOM_SYM_FILE}"
29 "LIBRARY libaom INITINSTANCE TERMINSTANCE\n"
30 "DATA MULTIPLE NONSHARED\n"
31 "EXPORTS\n")
32else ()
33 set(symbol_suffix ";")
34endif ()
35
36set(aom_sym_file "${AOM_SYM_FILE}")
37
38if ("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
39 file(REMOVE "${aom_sym_file}")
40elseif ("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS")
41 file(WRITE "${aom_sym_file}"
42 "LIBRARY libaom INITINSTANCE TERMINSTANCE\n"
43 "DATA MULTIPLE NONSHARED\n"
44 "EXPORTS\n")
45else ()
46 file(WRITE "${aom_sym_file}" "{ global:\n")
47endif ()
48
49foreach (export_file ${AOM_EXPORTS_SOURCES})
50 file(STRINGS "${export_file}" exported_file_data)
51 set(exported_symbols "${exported_symbols} ${exported_file_data};")
52 string(STRIP "${exported_symbols}" exported_symbols)
53endforeach ()
54
55foreach (exported_symbol ${exported_symbols})
56 string(STRIP "${exported_symbol}" exported_symbol)
57 string(REGEX REPLACE "text \|data " "" "exported_symbol" "${exported_symbol}")
58 set(exported_symbol "${symbol_prefix}${exported_symbol}${symbol_suffix}")
59 file(APPEND "${aom_sym_file}" "${exported_symbol}\n")
60endforeach ()
61
62if ("${aom_sym_file}" MATCHES "ver$")
63 file(APPEND "${aom_sym_file}" " };")
64endif ()