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# CMAKE_SHARED_LIBRARY_PREFIX can be empty 14set(REQUIRED_ARGS "AOM_ROOT" "AOM_CONFIG_DIR" "AOM_TARGET_SYSTEM" "AOM_SYM_FILE" 15 "CONFIG_AV1_DECODER" "CONFIG_AV1_ENCODER") 16 17foreach(arg ${REQUIRED_ARGS}) 18 if("${${arg}}" STREQUAL "") 19 message(FATAL_ERROR "${arg} must not be empty.") 20 endif() 21endforeach() 22 23include("${AOM_ROOT}/build/cmake/exports_sources.cmake") 24 25if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin") 26 set(symbol_prefix "_") 27elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS") 28 file(WRITE "${AOM_SYM_FILE}" "LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}aom\n" 29 "EXPORTS\n") 30else() 31 set(symbol_suffix ";") 32endif() 33 34set(aom_sym_file "${AOM_SYM_FILE}") 35 36if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin") 37 file(REMOVE "${aom_sym_file}") 38elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS") 39 file(WRITE "${aom_sym_file}" "LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}aom\n" 40 "EXPORTS\n") 41else() 42 file(WRITE "${aom_sym_file}" "{\nglobal:\n") 43endif() 44 45foreach(export_file ${AOM_EXPORTS_SOURCES}) 46 file(STRINGS "${export_file}" exported_file_data) 47 set(exported_symbols "${exported_symbols} ${exported_file_data};") 48 string(STRIP "${exported_symbols}" exported_symbols) 49endforeach() 50 51foreach(exported_symbol ${exported_symbols}) 52 string(STRIP "${exported_symbol}" exported_symbol) 53 if("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS") 54 string(SUBSTRING ${exported_symbol} 0 4 export_type) 55 string(COMPARE EQUAL "${export_type}" "data" is_data) 56 if(is_data) 57 set(symbol_suffix " DATA") 58 else() 59 set(symbol_suffix "") 60 endif() 61 endif() 62 string(REGEX REPLACE "text \|data " "" "exported_symbol" "${exported_symbol}") 63 set(exported_symbol " ${symbol_prefix}${exported_symbol}${symbol_suffix}") 64 file(APPEND "${aom_sym_file}" "${exported_symbol}\n") 65endforeach() 66 67if("${aom_sym_file}" MATCHES "ver$") 68 file(APPEND "${aom_sym_file}" " \nlocal:\n *;\n};") 69endif() 70