fix(build): Impove yaml generator libclang compatibility (from PR#2631) (#3402)
This commit is contained in:
@@ -267,8 +267,8 @@ def parse_union(ast, node):
|
|||||||
return old_st
|
return old_st
|
||||||
|
|
||||||
for c in node.get_children():
|
for c in node.get_children():
|
||||||
parse_field(st,c)
|
if c.kind == CursorKind.FIELD_DECL:
|
||||||
|
parse_field(st,c)
|
||||||
|
|
||||||
ann = get_annotations(node)
|
ann = get_annotations(node)
|
||||||
if len(ann) > 0:
|
if len(ann) > 0:
|
||||||
@@ -383,10 +383,11 @@ def parse_field(ast,node):
|
|||||||
|
|
||||||
ann = get_annotations(node)
|
ann = get_annotations(node)
|
||||||
if len(ann) > 0:
|
if len(ann) > 0:
|
||||||
|
is_cust = False
|
||||||
|
is_enum = False
|
||||||
for a in ann:
|
for a in ann:
|
||||||
if a['type'] == 'enum':
|
if a['type'] == 'enum':
|
||||||
if not hasattr(f,'f_read'):
|
is_enum = True
|
||||||
f.type = 'enum'
|
|
||||||
enum_name = 'enum_' + a['val']
|
enum_name = 'enum_' + a['val']
|
||||||
f.var_type = enum_name
|
f.var_type = enum_name
|
||||||
if not RootAST.has_enum(enum_name):
|
if not RootAST.has_enum(enum_name):
|
||||||
@@ -397,8 +398,10 @@ def parse_field(ast,node):
|
|||||||
f.name = a['val']
|
f.name = a['val']
|
||||||
elif a['type'] == 'read':
|
elif a['type'] == 'read':
|
||||||
f.f_read = a['val']
|
f.f_read = a['val']
|
||||||
|
is_cust = True
|
||||||
elif a['type'] == 'write':
|
elif a['type'] == 'write':
|
||||||
f.f_write = a['val']
|
f.f_write = a['val']
|
||||||
|
is_cust = True
|
||||||
elif a['type'] == 'array':
|
elif a['type'] == 'array':
|
||||||
array_attrs = a['val'].split('|')
|
array_attrs = a['val'].split('|')
|
||||||
elmt_size = int(array_attrs[0])
|
elmt_size = int(array_attrs[0])
|
||||||
@@ -409,8 +412,13 @@ def parse_field(ast,node):
|
|||||||
elif a['type'] == 'skip':
|
elif a['type'] == 'skip':
|
||||||
f.skip = True
|
f.skip = True
|
||||||
|
|
||||||
|
if is_enum and not is_cust:
|
||||||
|
f.type = 'enum'
|
||||||
|
|
||||||
if len(f.name) == 0:
|
if len(f.name) == 0:
|
||||||
print_error("in '{}', field of type '{}' does not have a name".format(ast.name,f.var_type))
|
print_error("in '{}', field of type '{}' does not have a name"
|
||||||
|
.format(ast.name,f.var_type))
|
||||||
|
return
|
||||||
|
|
||||||
ast.append(f)
|
ast.append(f)
|
||||||
|
|
||||||
@@ -487,7 +495,8 @@ CLANG_LIB_LOCATIONS = [
|
|||||||
'/usr/local/Cellar/llvm/6.0.0/lib/libclang.dylib',
|
'/usr/local/Cellar/llvm/6.0.0/lib/libclang.dylib',
|
||||||
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib',
|
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib',
|
||||||
'/Library/Developer/CommandLineTools/usr/lib/libclang.dylib',
|
'/Library/Developer/CommandLineTools/usr/lib/libclang.dylib',
|
||||||
'/usr/lib/x86_64-linux-gnu/libclang-6.0.so.1'
|
'/usr/lib/x86_64-linux-gnu/libclang-6.0.so.1',
|
||||||
|
'/usr/lib/aarch64-linux-gnu/libclang-6.0.so.1'
|
||||||
]
|
]
|
||||||
|
|
||||||
# set clang lib file
|
# set clang lib file
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Stops on first error, echo on
|
# Stops on first error
|
||||||
set -e
|
set -e
|
||||||
set -x
|
|
||||||
|
|
||||||
# Add GCC_ARM to PATH
|
# Add GCC_ARM to PATH
|
||||||
if [[ -n ${GCC_ARM} ]] ; then
|
if [[ -n ${GCC_ARM} ]] ; then
|
||||||
@@ -12,7 +11,7 @@ fi
|
|||||||
: ${FLAVOR:="t12;t8;tlite;tpro;lr3pro;tx12;tx12mk2;boxer;zorro;tx16s;x12s;nv14;x7;x9d;x9dp;x9e;x9lite;x9lites;xlite;xlites"}
|
: ${FLAVOR:="t12;t8;tlite;tpro;lr3pro;tx12;tx12mk2;boxer;zorro;tx16s;x12s;nv14;x7;x9d;x9dp;x9e;x9lite;x9lites;xlite;xlites"}
|
||||||
: ${SRCDIR:=$(dirname "$(pwd)/$0")/..}
|
: ${SRCDIR:=$(dirname "$(pwd)/$0")/..}
|
||||||
|
|
||||||
: ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DYAML_STORAGE=YES "}
|
: ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DDISABLE_COMPANION=YES -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"}
|
||||||
|
|
||||||
# wipe build directory clean
|
# wipe build directory clean
|
||||||
rm -rf build && mkdir -p build && cd build
|
rm -rf build && mkdir -p build && cd build
|
||||||
@@ -22,6 +21,7 @@ target_names=$(echo "$FLAVOR" | tr '[:upper:]' '[:lower:]' | tr ';' '\n')
|
|||||||
for target_name in $target_names
|
for target_name in $target_names
|
||||||
do
|
do
|
||||||
BUILD_OPTIONS=${COMMON_OPTIONS}
|
BUILD_OPTIONS=${COMMON_OPTIONS}
|
||||||
|
BUILD_OPTIONS+=" $EXTRA_OPTIONS "
|
||||||
|
|
||||||
echo "Generating YAML structures for ${target_name}"
|
echo "Generating YAML structures for ${target_name}"
|
||||||
case $target_name in
|
case $target_name in
|
||||||
@@ -110,8 +110,8 @@ do
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
cmake ${BUILD_OPTIONS} "${SRCDIR}"
|
cmake ${BUILD_OPTIONS} "${SRCDIR}"
|
||||||
make arm-none-eabi-configure
|
make native-configure
|
||||||
make -C arm-none-eabi yaml_data
|
make -C native yaml_data
|
||||||
|
|
||||||
rm -f CMakeCache.txt arm-none-eabi/CMakeCache.txt
|
rm -f CMakeCache.txt arm-none-eabi/CMakeCache.txt
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user