]> git.saurik.com Git - wxWidgets.git/blame - utils/ifacecheck/rungccxml.sh.in
correct an example which had no chance of working
[wxWidgets.git] / utils / ifacecheck / rungccxml.sh.in
CommitLineData
2f46438b
FM
1#!/bin/bash
2
3# $Id$
4#
5# Runs gccxml on the wxWidgets include folder, in order to build the XML
6# file to fetch to ifacecheck to check the coherency of the wxWidgets
7# interface headers with the "real" ones.
8
9
10## CONSTANTS
11############
12
13
5570107a
FM
14gccxmloutput="wxapi.xml" # the file where we store the gccXML output
15preprocoutput="wxapi-preproc.txt" # the file where we store the preprocessor's #define values
16allheaders="/tmp/wx-all.h" # the header which includes all wx public headers (autogenerated)
2f46438b
FM
17
18# the list of all wxWidgets public headers
19listcmd="ls wx/*.h wx/aui/*.h wx/html/*.h wx/protocol/*.h wx/richtext/*.h wx/stc/*.h wx/xml/*.h wx/xrc/*.h"
20
21
22
23## MAIN
24#######
25
26if [[ ! -z "$1" ]]; then
27 echo "This script does not accept arguments."
28 echo "Usage: $0"
29 echo "Creates a '$gccxmloutput' file which you can pass to ifacecheck."
30 exit 1
31fi
32
33me=$(basename $0)
027c8a00 34current=$(pwd)/${0%%/$me} # current path
2f46438b 35
027c8a00 36gccxmloutput="$current/$gccxmloutput"
2f46438b
FM
37
38cd @top_srcdir@/include # go to wx include folder
39
40# now filter it
41headerlist=`$listcmd | grep -v wxshl | grep -v wx_cw | grep -v setup | grep -v xti | grep -v dde.h | grep -v fmappriv`
42
43cd $current # return to the original path
44
45# create the header file to pass to gccxml
8e190381 46echo "Creating the $allheaders dummy file which #includes all wxWidgets interface header files..."
2f46438b
FM
47if [[ -f $allheaders ]]; then rm $allheaders; fi
48for f in $headerlist; do
49 echo "#include <$f>" >> $allheaders
50done
51
52# filter the configure flags to pass to gccxml
15b8639e
FM
53wx_top_builddir="@wx_top_builddir@"
54top_srcdir="@top_srcdir@"
55flags="@CPPFLAGS@ @CXXFLAGS@"
2f46438b
FM
56
57# NOTE: it's important to define __WXDEBUG__ because some functions of wx
5570107a
FM
58# are declared (and thus parsed by gcc) only if that symbol is defined.
59# So we remove it from $flags (in case it's defined) and then readd it.
2f46438b
FM
60flags=`echo "$flags" | sed -e 's/-pthread//g' | sed -e 's/__WXDEBUG__//g'`
61
5570107a
FM
62# append some other flags:
63flags="-I . -I @top_srcdir@/include $flags -D__WXDEBUG__ -D__WX@TOOLKIT@__ -DWXBUILDING $allheaders"
64
2f46438b 65# run gccxml with the same flag used for the real compilation of wx sources:
03d4f7b9 66echo "Running gccxml on the $allheaders file... results in $gccxmloutput"
2f46438b 67if [[ -f "$gccxmloutput" ]]; then rm $gccxmloutput; fi
5570107a 68gccxml $flags -fxml=$gccxmloutput
8e190381
FM
69if [[ $? != 0 ]]; then
70 echo "Errors running gccxml... aborting."
71 exit
72fi
5570107a
FM
73
74# now get the list of the #defined values for wx headers, so that the result
75# can be passed to ifacecheck to aid the comparison
03d4f7b9 76echo "Running gccxml's preprocessor on the $allheaders file... results in $preprocoutput"
5570107a 77gccxml -E -dM $flags >$preprocoutput
cbea3ec6
FM
78if [[ $? != 0 ]]; then
79 echo "Errors running gccxml preprocessor... aborting."
80 exit
81fi
82
2f46438b
FM
83# cleanup
84rm $allheaders