1*77c1e3ccSAndroid Build Coastguard Worker# 2*77c1e3ccSAndroid Build Coastguard Worker# Copyright (c) 2017, Alliance for Open Media. All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker# 4*77c1e3ccSAndroid Build Coastguard Worker# This source code is subject to the terms of the BSD 2 Clause License and the 5*77c1e3ccSAndroid Build Coastguard Worker# Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was 6*77c1e3ccSAndroid Build Coastguard Worker# not distributed with this source code in the LICENSE file, you can obtain it 7*77c1e3ccSAndroid Build Coastguard Worker# at www.aomedia.org/license/software. If the Alliance for Open Media Patent 8*77c1e3ccSAndroid Build Coastguard Worker# License 1.0 was not distributed with this source code in the PATENTS file, you 9*77c1e3ccSAndroid Build Coastguard Worker# can obtain it at www.aomedia.org/license/patent. 10*77c1e3ccSAndroid Build Coastguard Worker# 11*77c1e3ccSAndroid Build Coastguard Workerif(AOM_BUILD_CMAKE_EXPORTS_CMAKE_) 12*77c1e3ccSAndroid Build Coastguard Worker return() 13*77c1e3ccSAndroid Build Coastguard Workerendif() # AOM_BUILD_CMAKE_EXPORTS_CMAKE_ 14*77c1e3ccSAndroid Build Coastguard Workerset(AOM_BUILD_CMAKE_EXPORTS_CMAKE_ 1) 15*77c1e3ccSAndroid Build Coastguard Worker 16*77c1e3ccSAndroid Build Coastguard Workerinclude("${AOM_ROOT}/build/cmake/exports_sources.cmake") 17*77c1e3ccSAndroid Build Coastguard Worker 18*77c1e3ccSAndroid Build Coastguard Worker# Creates the custom target which handles generation of the symbol export lists. 19*77c1e3ccSAndroid Build Coastguard Workerfunction(setup_exports_target) 20*77c1e3ccSAndroid Build Coastguard Worker if(APPLE) 21*77c1e3ccSAndroid Build Coastguard Worker set(symbol_file_ext "syms") 22*77c1e3ccSAndroid Build Coastguard Worker elseif(WIN32) 23*77c1e3ccSAndroid Build Coastguard Worker set(symbol_file_ext "def") 24*77c1e3ccSAndroid Build Coastguard Worker else() 25*77c1e3ccSAndroid Build Coastguard Worker set(symbol_file_ext "ver") 26*77c1e3ccSAndroid Build Coastguard Worker endif() 27*77c1e3ccSAndroid Build Coastguard Worker 28*77c1e3ccSAndroid Build Coastguard Worker set(aom_sym_file "${AOM_CONFIG_DIR}/libaom.${symbol_file_ext}") 29*77c1e3ccSAndroid Build Coastguard Worker 30*77c1e3ccSAndroid Build Coastguard Worker add_custom_target( 31*77c1e3ccSAndroid Build Coastguard Worker generate_exports 32*77c1e3ccSAndroid Build Coastguard Worker COMMAND ${CMAKE_COMMAND} 33*77c1e3ccSAndroid Build Coastguard Worker -DAOM_ROOT="${AOM_ROOT}" 34*77c1e3ccSAndroid Build Coastguard Worker -DAOM_CONFIG_DIR="${AOM_CONFIG_DIR}" 35*77c1e3ccSAndroid Build Coastguard Worker -DAOM_TARGET_SYSTEM=${AOM_TARGET_SYSTEM} 36*77c1e3ccSAndroid Build Coastguard Worker -DAOM_SYM_FILE="${aom_sym_file}" 37*77c1e3ccSAndroid Build Coastguard Worker -DAOM_MSVC=${MSVC} 38*77c1e3ccSAndroid Build Coastguard Worker -DAOM_XCODE=${XCODE} 39*77c1e3ccSAndroid Build Coastguard Worker -DCMAKE_SHARED_LIBRARY_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}" 40*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_NAME=$<CONFIG> 41*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_AV1_DECODER=${CONFIG_AV1_DECODER} 42*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_AV1_ENCODER=${CONFIG_AV1_ENCODER} 43*77c1e3ccSAndroid Build Coastguard Worker -DCONFIG_INSPECTION=${CONFIG_INSPECTION} 44*77c1e3ccSAndroid Build Coastguard Worker -DENABLE_TESTS=${ENABLE_TESTS} 45*77c1e3ccSAndroid Build Coastguard Worker -P 46*77c1e3ccSAndroid Build Coastguard Worker "${AOM_ROOT}/build/cmake/generate_exports.cmake" 47*77c1e3ccSAndroid Build Coastguard Worker SOURCES ${AOM_EXPORTS_SOURCES} 48*77c1e3ccSAndroid Build Coastguard Worker DEPENDS ${AOM_EXPORTS_SOURCES} BYPRODUCTS ${aom_sym_file}) 49*77c1e3ccSAndroid Build Coastguard Worker 50*77c1e3ccSAndroid Build Coastguard Worker # Make libaom depend on the exports file, and set flags to pick it up when 51*77c1e3ccSAndroid Build Coastguard Worker # creating the dylib. 52*77c1e3ccSAndroid Build Coastguard Worker add_dependencies(aom generate_exports) 53*77c1e3ccSAndroid Build Coastguard Worker 54*77c1e3ccSAndroid Build Coastguard Worker if(APPLE) 55*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET aom 56*77c1e3ccSAndroid Build Coastguard Worker APPEND_STRING 57*77c1e3ccSAndroid Build Coastguard Worker PROPERTY LINK_FLAGS "-exported_symbols_list ${aom_sym_file}") 58*77c1e3ccSAndroid Build Coastguard Worker elseif(WIN32) 59*77c1e3ccSAndroid Build Coastguard Worker if(MSVC) 60*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET aom 61*77c1e3ccSAndroid Build Coastguard Worker APPEND_STRING 62*77c1e3ccSAndroid Build Coastguard Worker PROPERTY LINK_FLAGS "/DEF:${aom_sym_file}") 63*77c1e3ccSAndroid Build Coastguard Worker else() 64*77c1e3ccSAndroid Build Coastguard Worker # For MinGW and MSYS compilers, you can use either version scripts or 65*77c1e3ccSAndroid Build Coastguard Worker # module definition files. If the latter, it must be supplied as an 66*77c1e3ccSAndroid Build Coastguard Worker # "object". 67*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET aom 68*77c1e3ccSAndroid Build Coastguard Worker APPEND_STRING 69*77c1e3ccSAndroid Build Coastguard Worker PROPERTY LINK_FLAGS "${aom_sym_file}") 70*77c1e3ccSAndroid Build Coastguard Worker endif() 71*77c1e3ccSAndroid Build Coastguard Worker else() 72*77c1e3ccSAndroid Build Coastguard Worker set_property(TARGET aom 73*77c1e3ccSAndroid Build Coastguard Worker APPEND_STRING 74*77c1e3ccSAndroid Build Coastguard Worker PROPERTY LINK_FLAGS "-Wl,--version-script,${aom_sym_file}") 75*77c1e3ccSAndroid Build Coastguard Worker endif() 76*77c1e3ccSAndroid Build Coastguard Workerendfunction() 77