Skip to content

Commit

Permalink
Add the script
Browse files Browse the repository at this point in the history
  • Loading branch information
hiili committed Aug 13, 2017
1 parent 77e9ce6 commit 8508e6e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

if [ "$#" -ne 1 ]; then
echo "Usage: $0 <UE version>, e.g. '4.17'>"
exit 1
fi

ueversion=$1
uepath=/c/Program\ Files/Epic\ Games/UE_$ueversion/Engine/Source/Runtime

echo Scanning $uepath/*
pushd >/dev/null "$uepath" || exit 1
grep '^[[:space:]]*#define' -r --include='*.h' * | sed 's/.*#define[[:space:]]*\([a-zA-Z0-9_]*\)\(.*\)/\1/' | sort | uniq | cat > ~1/Macros_UE_${ueversion}.txt
echo "Missed macros due to empty first line:"
grep '^[[:space:]]*#define[[:space:]]*\\' -r --include='*.h' *
echo
popd >/dev/null

echo Generating UndefineMacros_UE_$ueversion.h and RedefineMacros_UE_$ueversion.h
cat < Macros_UE_${ueversion}.txt | grep -v '^_' | awk > UndefineMacros_UE_$ueversion.h '// { print "#pragma push_macro(\"" $1 "\")"; print "#undef " $1; }'
tac < Macros_UE_${ueversion}.txt | grep -v '^_' | awk > RedefineMacros_UE_$ueversion.h '// { print "#pragma pop_macro(\"" $1 "\")"; }'

0 comments on commit 8508e6e

Please sign in to comment.