1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/bin/bash
- while read line; do
- if ! echo "$line" | grep -q "^\".*\", referenced from:$"
- then
-
- continue
- fi
- symbol=`echo "$line" | sed -e "s/^\"\(.*\)\", referenced from:$/\1/"`
-
- filename=`echo "$symbol" | perl -pe "s#.*?igl::([A-z0-9_:]*).*$'$'#\1#"`
- filename=`echo "$filename" | sed -e "s/::/\//g"`
-
- cpp="$LIBIGL/include/igl/$filename.cpp"
-
- if [ ! -e "$cpp" ]
- then
- echo "Warning: $cpp does not exist, skipping ..."
- continue
- fi
- if ! grep -q "^\/\/ Explicit template specialization*$" "$cpp"
- then
- echo "Warning: skipping $cpp because it does not match ^\/\/ Explicit template specialization*$ "
- continue;
- fi
- before=`sed '/^\/\/ Explicit template specialization$/q' "$cpp"`;
-
- after=`sed '1,/^\/\/ Explicit template specialization$/d' $cpp`;
-
- explicit=`echo "template $symbol;" | sed -e "s/std::__1::/std::/g"`
-
- if grep -F "$explicit" "$cpp"
- then
- echo "Error: $cpp already contains $explicit"
- echo " Recompile igl static lib, recompile your project, and try again."
- continue
- fi
- echo "$before" > "$cpp"
- echo "// generated by autoexplicit.sh" >> "$cpp"
- echo "$explicit" >> "$cpp"
- echo "$after" >> "$cpp"
- done
|