2008-03-26 12:40:54 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# Runs gccxml on the wxWidgets include folder, in order to build the XML
|
|
|
|
# file to fetch to ifacecheck to check the coherency of the wxWidgets
|
|
|
|
# interface headers with the "real" ones.
|
|
|
|
|
|
|
|
|
|
|
|
## CONSTANTS
|
|
|
|
############
|
|
|
|
|
|
|
|
|
2008-03-27 15:15:00 -04:00
|
|
|
gccxmloutput="wxapi.xml" # the file where we store the gccXML output
|
|
|
|
preprocoutput="wxapi-preproc.txt" # the file where we store the preprocessor's #define values
|
|
|
|
allheaders="/tmp/wx-all.h" # the header which includes all wx public headers (autogenerated)
|
2008-03-26 12:40:54 -04:00
|
|
|
|
|
|
|
# the list of all wxWidgets public headers
|
|
|
|
listcmd="ls wx/*.h wx/aui/*.h wx/html/*.h wx/protocol/*.h wx/richtext/*.h wx/stc/*.h wx/xml/*.h wx/xrc/*.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## MAIN
|
|
|
|
#######
|
|
|
|
|
|
|
|
if [[ ! -z "$1" ]]; then
|
|
|
|
echo "This script does not accept arguments."
|
|
|
|
echo "Usage: $0"
|
|
|
|
echo "Creates a '$gccxmloutput' file which you can pass to ifacecheck."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
me=$(basename $0)
|
2008-11-08 09:38:36 -05:00
|
|
|
current=$(pwd)/${0%%/$me} # current path
|
2008-03-26 12:40:54 -04:00
|
|
|
|
2008-11-08 09:38:36 -05:00
|
|
|
gccxmloutput="$current/$gccxmloutput"
|
2008-03-26 12:40:54 -04:00
|
|
|
|
|
|
|
cd @top_srcdir@/include # go to wx include folder
|
|
|
|
|
|
|
|
# now filter it
|
|
|
|
headerlist=`$listcmd | grep -v wxshl | grep -v wx_cw | grep -v setup | grep -v xti | grep -v dde.h | grep -v fmappriv`
|
|
|
|
|
|
|
|
cd $current # return to the original path
|
|
|
|
|
|
|
|
# create the header file to pass to gccxml
|
2008-09-18 14:47:57 -04:00
|
|
|
echo "Creating the $allheaders dummy file which #includes all wxWidgets interface header files..."
|
2008-03-26 12:40:54 -04:00
|
|
|
if [[ -f $allheaders ]]; then rm $allheaders; fi
|
|
|
|
for f in $headerlist; do
|
|
|
|
echo "#include <$f>" >> $allheaders
|
|
|
|
done
|
|
|
|
|
|
|
|
# filter the configure flags to pass to gccxml
|
|
|
|
flags="@CXXFLAGS@"
|
|
|
|
|
|
|
|
# NOTE: it's important to define __WXDEBUG__ because some functions of wx
|
2008-03-27 15:15:00 -04:00
|
|
|
# are declared (and thus parsed by gcc) only if that symbol is defined.
|
|
|
|
# So we remove it from $flags (in case it's defined) and then readd it.
|
2008-03-26 12:40:54 -04:00
|
|
|
flags=`echo "$flags" | sed -e 's/-pthread//g' | sed -e 's/__WXDEBUG__//g'`
|
|
|
|
|
2008-03-27 15:15:00 -04:00
|
|
|
# append some other flags:
|
|
|
|
flags="-I . -I @top_srcdir@/include $flags -D__WXDEBUG__ -D__WX@TOOLKIT@__ -DWXBUILDING $allheaders"
|
|
|
|
|
2008-03-26 12:40:54 -04:00
|
|
|
# run gccxml with the same flag used for the real compilation of wx sources:
|
2008-03-27 16:57:05 -04:00
|
|
|
echo "Running gccxml on the $allheaders file... results in $gccxmloutput"
|
2008-03-26 12:40:54 -04:00
|
|
|
if [[ -f "$gccxmloutput" ]]; then rm $gccxmloutput; fi
|
2008-03-27 15:15:00 -04:00
|
|
|
gccxml $flags -fxml=$gccxmloutput
|
2008-09-18 14:47:57 -04:00
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
echo "Errors running gccxml... aborting."
|
|
|
|
exit
|
|
|
|
fi
|
2008-03-27 15:15:00 -04:00
|
|
|
|
|
|
|
# now get the list of the #defined values for wx headers, so that the result
|
|
|
|
# can be passed to ifacecheck to aid the comparison
|
2008-03-27 16:57:05 -04:00
|
|
|
echo "Running gccxml's preprocessor on the $allheaders file... results in $preprocoutput"
|
2008-03-27 15:15:00 -04:00
|
|
|
gccxml -E -dM $flags >$preprocoutput
|
2008-09-21 16:03:14 -04:00
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
echo "Errors running gccxml preprocessor... aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2008-03-26 12:40:54 -04:00
|
|
|
# cleanup
|
|
|
|
rm $allheaders
|