build: Add gengir.bat to build introspection for ATK.
[atk.git] / build / win32 / gengir.bat
blobf85adc6a14c6d9c616c5a31b775cdbe01b078c85
1 @echo off
3 setlocal EnableDelayedExpansion
5 rem Needed environmental variables:
6 rem PLAT: Windows platform-Win32 (i.e. x86) or x64 (i.e. x86-64)
7 rem CONF: Configuration Type, Release or Debug
8 rem VSVER: Visual C++ version used
10 rem Check the environemental variables...
11 if /i "%PLAT%" == "Win32" goto PLAT_OK
12 if /i "%PLAT%" == "x64" goto PLAT_OK
13 if /i "%PLAT%" == "x86" (
14    set PLAT=Win32
15    goto PLAT_OK
17 if /i "%PLAT%" == "x86-64" (
18    set PLAT=x64
19    goto PLAT_OK
21 goto ERR_PLAT
23 :PLAT_OK
24 if "%VSVER%" == "9" goto VSVER_OK
25 if "%VSVER%" == "10" goto VSVER_OK
26 if "%VSVER%" == "11" goto VSVER_OK
27 goto ERR_VSVER
28 :VSVER_OK
29 if /i "%CONF%" == "Release" goto CONF_OK
30 if /i "%CONF%" == "Debug" goto CONF_OK
31 goto ERR_CONF
32 :CONF_OK
33 if "%BASEDIR%" == "" goto ERR_BASEDIR
34 if not exist %BASEDIR% goto ERR_BASEDIR
36 if "%PKG_CONFIG_PATH%" == "" goto ERR_PKGCONFIG
37 if not exist %PKG_CONFIG_PATH%\gobject-2.0.pc goto ERR_PKGCONFIG
39 if "%MINGWDIR%" == "" goto ERR_MINGWDIR
40 if not exist %MINGWDIR%\bin\gcc.exe goto ERR_MINGWDIR
42 set CC=cl
43 set BINDIR=%CD%\vs%VSVER%\%CONF%\%PLAT%\bin
44 set INCLUDE=%BASEDIR%\include\glib-2.0;%BASEDIR%\lib\glib-2.0\include;%INCLUDE%
45 set LIB=%BINDIR%;%BASEDIR%\lib;%LIB%
46 set PATH=%BINDIR%;%BASEDIR%\bin;%PATH%;%MINGWDIR%\bin
47 set PYTHONPATH=%BASEDIR%\lib\gobject-introspection;%BINDIR%
49 echo Setup .bat for generating ATK .gir's...
51 rem =================================================================================================
52 rem Begin setup of atk_gir.bat to create Atk-1.0.gir
53 rem (The ^^ is necessary to span the command to multiple lines on Windows cmd.exe!)
54 rem =================================================================================================
56 echo echo Generating Atk-1.0.gir...> atk_gir.bat
57 echo @echo on>> atk_gir.bat
58 echo.>> atk_gir.bat
59 rem ================================================================
60 rem Setup the command line flags to g-ir-scanner for Atk-1.0.gir...
61 rem ================================================================
62 echo python %BASEDIR%\bin\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> atk_gir.bat
63 echo --namespace=Atk --nsversion=1.0 --include=GObject-2.0 ^^>> atk_gir.bat
64 echo --no-libtool --pkg=glib-2.0 --library=atk-1-vs%VSVER% ^^>> atk_gir.bat
65 echo --reparse-validate --add-include-path=%BASEDIR%\share\gir-1.0 ^^>> atk_gir.bat
66 echo  --pkg-export atk --warn-all --c-include "atk/atk.h" ^^>> atk_gir.bat
67 echo -I..\.. -DATK_DISABLE_DEPRECATED -DATK_COMPILATION -DATK_LOCALEDIR=\"/dummy/share/locale\" ^^>> atk_gir.bat
68 echo --filelist=atk_list ^^>> atk_gir.bat
69 echo -o Atk-1.0.gir>> atk_gir.bat
70 echo.>> atk_gir.bat
72 echo Completed setup of .bat for generating Atk-1.0.gir.
73 echo.>> atk_gir.bat
75 rem ===================================================
76 rem Finish setup of atk_gir.bat to create Atk-1.0.gir
77 rem ===================================================
79 rem =======================
80 rem Now generate the .gir's
81 rem =======================
82 CALL atk_gir.bat
84 rem Clean up the .bat for generating the .gir files...
85 del atk_gir.bat
87 rem Now compile the generated .gir files
88 %BASEDIR%\bin\g-ir-compiler --includedir=. --debug --verbose Atk-1.0.gir -o Atk-1.0.typelib
90 rem Copy the generated .girs and .typelibs to their appropriate places
92 mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0
93 move /y *.gir %BASEDIR%\share\gir-1.0\
95 mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0
96 move /y *.typelib %BASEDIR%\lib\girepository-1.0\
98 goto DONE
100 :ERR_PLAT
101 echo You need to specify a valid Platform [set PLAT=Win32 or PLAT=x64]
102 goto DONE
103 :ERR_VSVER
104 echo You need to specify your Visual Studio version [set VSVER=9 or VSVER=10 or VSVER=11]
105 goto DONE
106 :ERR_CONF
107 echo You need to specify a valid Configuration [set CONF=Release or CONF=Debug]
108 goto DONE
109 :ERR_BASEDIR
110 echo You need to specify a valid BASEDIR.
111 goto DONE
112 :ERR_PKGCONFIG
113 echo You need to specify a valid PKG_CONFIG_PATH
114 goto DONE
115 :ERR_MINGWDIR
116 echo You need to specify a valid MINGWDIR, where a valid gcc installation can be found.
117 goto DONE
118 :DONE