]>
Commit | Line | Data |
---|---|---|
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 | ||
14 | gccxmloutput="wxapi.xml" # the file where we store the gccXML output | |
15 | preprocoutput="wxapi-preproc.txt" # the file where we store the preprocessor's #define values | |
16 | allheaders="/tmp/wx-all.h" # the header which includes all wx public headers (autogenerated) | |
17 | ||
18 | # the list of all wxWidgets public headers | |
19 | 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" | |
20 | ||
21 | ||
22 | ||
23 | ## MAIN | |
24 | ####### | |
25 | ||
26 | if [[ ! -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 | |
31 | fi | |
32 | ||
33 | me=$(basename $0) | |
34 | path=${0%%/$me} | |
35 | current=$(pwd) # current path | |
36 | ||
37 | #gccxmloutput="$current/$gccxmloutput" | |
38 | ||
39 | cd @top_srcdir@/include # go to wx include folder | |
40 | ||
41 | # now filter it | |
42 | headerlist=`$listcmd | grep -v wxshl | grep -v wx_cw | grep -v setup | grep -v xti | grep -v dde.h | grep -v fmappriv` | |
43 | ||
44 | cd $current # return to the original path | |
45 | ||
46 | # create the header file to pass to gccxml | |
47 | if [[ -f $allheaders ]]; then rm $allheaders; fi | |
48 | for f in $headerlist; do | |
49 | echo "#include <$f>" >> $allheaders | |
50 | done | |
51 | ||
52 | # filter the configure flags to pass to gccxml | |
53 | flags="@CXXFLAGS@" | |
54 | ||
55 | # NOTE: it's important to define __WXDEBUG__ because some functions of wx | |
56 | # are declared (and thus parsed by gcc) only if that symbol is defined. | |
57 | # So we remove it from $flags (in case it's defined) and then readd it. | |
58 | flags=`echo "$flags" | sed -e 's/-pthread//g' | sed -e 's/__WXDEBUG__//g'` | |
59 | ||
60 | # append some other flags: | |
61 | flags="-I . -I @top_srcdir@/include $flags -D__WXDEBUG__ -D__WX@TOOLKIT@__ -DWXBUILDING $allheaders" | |
62 | ||
63 | # run gccxml with the same flag used for the real compilation of wx sources: | |
64 | echo "Running gccxml on the $allheaders file... results in $gccxmloutput" | |
65 | if [[ -f "$gccxmloutput" ]]; then rm $gccxmloutput; fi | |
66 | gccxml $flags -fxml=$gccxmloutput | |
67 | ||
68 | # now get the list of the #defined values for wx headers, so that the result | |
69 | # can be passed to ifacecheck to aid the comparison | |
70 | echo "Running gccxml's preprocessor on the $allheaders file... results in $preprocoutput" | |
71 | gccxml -E -dM $flags >$preprocoutput | |
72 | ||
73 | # cleanup | |
74 | rm $allheaders |