90 lines
3.4 KiB
Diff
90 lines
3.4 KiB
Diff
From f19edfa95f8dc9fa596282a210757e4d6d0cd490 Mon Sep 17 00:00:00 2001
|
|
From: Christopher Degawa <christopher.degawa@intel.com>
|
|
Date: Thu, 03 Jun 2021 18:05:47 -0500
|
|
Subject: [PATCH] exports.cmake: use APPLE and WIN32 and use def for mingw-w64
|
|
|
|
mingw-w64's ld and lld automatically accepts MSVC's def files and CMake
|
|
can handle the proper flags for .def files added to a library's sources.
|
|
|
|
This fixes the export file handling for mingw-w64 lld as that lld does
|
|
not support the --version-script argument
|
|
|
|
Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
|
|
Change-Id: I18a1ce2696e2f9b083ecab3d0d60566d48b68cf0
|
|
---
|
|
|
|
diff --git a/build/cmake/exports.cmake b/build/cmake/exports.cmake
|
|
index fa7842c..4f9d043 100644
|
|
--- a/build/cmake/exports.cmake
|
|
+++ b/build/cmake/exports.cmake
|
|
@@ -17,9 +17,9 @@
|
|
|
|
# Creates the custom target which handles generation of the symbol export lists.
|
|
function(setup_exports_target)
|
|
- if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
|
|
+ if(APPLE)
|
|
set(symbol_file_ext "syms")
|
|
- elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND MSVC)
|
|
+ elseif(WIN32)
|
|
set(symbol_file_ext "def")
|
|
else()
|
|
set(symbol_file_ext "ver")
|
|
@@ -43,7 +43,7 @@
|
|
-P
|
|
"${AOM_ROOT}/build/cmake/generate_exports.cmake"
|
|
SOURCES ${AOM_EXPORTS_SOURCES}
|
|
- DEPENDS ${AOM_EXPORTS_SOURCES})
|
|
+ DEPENDS ${AOM_EXPORTS_SOURCES} BYPRODUCTS ${aom_sym_file})
|
|
|
|
# Make libaom depend on the exports file, and set flags to pick it up when
|
|
# creating the dylib.
|
|
@@ -54,14 +54,12 @@
|
|
APPEND_STRING
|
|
PROPERTY LINK_FLAGS "-exported_symbols_list ${aom_sym_file}")
|
|
elseif(WIN32)
|
|
- if(NOT MSVC)
|
|
- set_property(TARGET aom
|
|
- APPEND_STRING
|
|
- PROPERTY LINK_FLAGS "-Wl,--version-script ${aom_sym_file}")
|
|
- else()
|
|
+ if(MSVC)
|
|
set_property(TARGET aom
|
|
APPEND_STRING
|
|
PROPERTY LINK_FLAGS "/DEF:${aom_sym_file}")
|
|
+ else()
|
|
+ target_sources(aom PRIVATE "${aom_sym_file}")
|
|
endif()
|
|
|
|
# TODO(tomfinegan): Sort out the import lib situation and flags for MSVC.
|
|
diff --git a/build/cmake/generate_exports.cmake b/build/cmake/generate_exports.cmake
|
|
index f1d15a0..8720ac8 100644
|
|
--- a/build/cmake/generate_exports.cmake
|
|
+++ b/build/cmake/generate_exports.cmake
|
|
@@ -23,7 +23,7 @@
|
|
|
|
if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
|
|
set(symbol_prefix "_")
|
|
-elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND AOM_MSVC)
|
|
+elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS")
|
|
file(WRITE "${AOM_SYM_FILE}" "LIBRARY aom\n" "EXPORTS\n")
|
|
else()
|
|
set(symbol_suffix ";")
|
|
@@ -33,7 +33,7 @@
|
|
|
|
if("${AOM_TARGET_SYSTEM}" STREQUAL "Darwin")
|
|
file(REMOVE "${aom_sym_file}")
|
|
-elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND AOM_MSVC)
|
|
+elseif("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS")
|
|
file(WRITE "${aom_sym_file}" "LIBRARY aom\n" "EXPORTS\n")
|
|
else()
|
|
file(WRITE "${aom_sym_file}" "{\nglobal:\n")
|
|
@@ -47,7 +47,7 @@
|
|
|
|
foreach(exported_symbol ${exported_symbols})
|
|
string(STRIP "${exported_symbol}" exported_symbol)
|
|
- if("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS" AND AOM_MSVC)
|
|
+ if("${AOM_TARGET_SYSTEM}" MATCHES "Windows\|MSYS")
|
|
string(SUBSTRING ${exported_symbol} 0 4 export_type)
|
|
string(COMPARE EQUAL "${export_type}" "data" is_data)
|
|
if(is_data)
|