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