Include symbols from fdb_c_internal.h to C bindings client library for Apple platform (#7292)

This commit is contained in:
Marian Dvorsky 2022-06-01 23:04:53 +02:00 committed by GitHub
parent 8cc51064a5
commit 138618eef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -58,8 +58,9 @@ if(APPLE)
add_custom_command(OUTPUT ${symbols} add_custom_command(OUTPUT ${symbols}
COMMAND $<TARGET_FILE:Python::Interpreter> ${CMAKE_CURRENT_SOURCE_DIR}/symbolify.py COMMAND $<TARGET_FILE:Python::Interpreter> ${CMAKE_CURRENT_SOURCE_DIR}/symbolify.py
${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c.h ${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c.h
${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c_internal.h
${symbols} ${symbols}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/symbolify.py ${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/symbolify.py ${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c.h ${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c_internal.h
COMMENT "Generate exported_symbols_list") COMMENT "Generate exported_symbols_list")
add_custom_target(exported_symbols_list DEPENDS ${symbols}) add_custom_target(exported_symbols_list DEPENDS ${symbols})
add_dependencies(fdb_c exported_symbols_list) add_dependencies(fdb_c exported_symbols_list)

View File

@ -2,9 +2,13 @@ if __name__ == '__main__':
import re import re
import sys import sys
r = re.compile('DLLEXPORT[^(]*(fdb_[^(]*)[(]') r = re.compile('DLLEXPORT[^(]*(fdb_[^(]*)[(]')
(fdb_c_h, symbols_file) = sys.argv[1:] header_files = sys.argv[1:-1]
with open(fdb_c_h, 'r') as f: symbols_file = sys.argv[-1]
symbols = sorted(set('_' + m.group(1) for m in r.finditer(f.read()))) symbols = set()
for header_file in header_files:
with open(header_file, 'r') as f:
symbols.update('_' + m.group(1) for m in r.finditer(f.read()))
symbols = sorted(symbols)
with open(symbols_file, 'w') as f: with open(symbols_file, 'w') as f:
f.write('\n'.join(symbols)) f.write('\n'.join(symbols))
f.write('\n') f.write('\n')