Enable the building of introspection files for Visual C++ builds
[platform/upstream/atk.git] / build / win32 / gengir.bat
1 @echo off
2
3 setlocal EnableDelayedExpansion
4
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
9
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
16 )
17 if /i "%PLAT%" == "x86-64" (
18    set PLAT=x64
19    goto PLAT_OK
20 )
21 goto ERR_PLAT
22
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
35
36 if "%PKG_CONFIG_PATH%" == "" goto ERR_PKGCONFIG
37 if not exist %PKG_CONFIG_PATH%\gobject-2.0.pc goto ERR_PKGCONFIG
38
39 if "%MINGWDIR%" == "" goto ERR_MINGWDIR
40 if not exist %MINGWDIR%\bin\gcc.exe goto ERR_MINGWDIR
41
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%
48
49 echo Create filelist for generating ATK .gir's...
50 call python gen-file-list-atk.py
51
52 echo Setup .bat for generating ATK .gir's...
53
54 rem =================================================================================================
55 rem Begin setup of atk_gir.bat to create Atk-1.0.gir
56 rem (The ^^ is necessary to span the command to multiple lines on Windows cmd.exe!)
57 rem =================================================================================================
58
59 echo echo Generating Atk-1.0.gir...> atk_gir.bat
60 echo @echo on>> atk_gir.bat
61 echo.>> atk_gir.bat
62 rem ================================================================
63 rem Setup the command line flags to g-ir-scanner for Atk-1.0.gir...
64 rem ================================================================
65 echo python %BASEDIR%\bin\g-ir-scanner --verbose -I..\.. --add-include-path=..\.. ^^>> atk_gir.bat
66 echo --namespace=Atk --nsversion=1.0 --include=GObject-2.0 ^^>> atk_gir.bat
67 echo --no-libtool --pkg=glib-2.0 --library=atk-1-vs%VSVER% ^^>> atk_gir.bat
68 echo --reparse-validate --add-include-path=%BASEDIR%\share\gir-1.0 ^^>> atk_gir.bat
69 echo  --pkg-export atk --warn-all --c-include "atk/atk.h" ^^>> atk_gir.bat
70 echo -I..\.. -DATK_DISABLE_DEPRECATED -DATK_COMPILATION -DATK_LOCALEDIR=\"/dummy/share/locale\" ^^>> atk_gir.bat
71 echo --filelist=atk_list ^^>> atk_gir.bat
72 echo -o Atk-1.0.gir>> atk_gir.bat
73 echo.>> atk_gir.bat
74
75 echo Completed setup of .bat for generating Atk-1.0.gir.
76 echo.>> atk_gir.bat
77
78 rem ===================================================
79 rem Finish setup of atk_gir.bat to create Atk-1.0.gir
80 rem ===================================================
81
82 rem =======================
83 rem Now generate the .gir's
84 rem =======================
85 CALL atk_gir.bat
86
87 rem Clean up the .bat/filelist for generating the .gir files...
88 del atk_gir.bat
89 del atk_list
90
91 rem Now compile the generated .gir files
92 %BASEDIR%\bin\g-ir-compiler --includedir=. --debug --verbose Atk-1.0.gir -o Atk-1.0.typelib
93
94 rem Copy the generated .girs and .typelibs to their appropriate places
95
96 mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0
97 move /y *.gir %BASEDIR%\share\gir-1.0\
98
99 mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0
100 move /y *.typelib %BASEDIR%\lib\girepository-1.0\
101
102 goto DONE
103
104 :ERR_PLAT
105 echo You need to specify a valid Platform [set PLAT=Win32 or PLAT=x64]
106 goto DONE
107 :ERR_VSVER
108 echo You need to specify your Visual Studio version [set VSVER=9 or VSVER=10 or VSVER=11]
109 goto DONE
110 :ERR_CONF
111 echo You need to specify a valid Configuration [set CONF=Release or CONF=Debug]
112 goto DONE
113 :ERR_BASEDIR
114 echo You need to specify a valid BASEDIR.
115 goto DONE
116 :ERR_PKGCONFIG
117 echo You need to specify a valid PKG_CONFIG_PATH
118 goto DONE
119 :ERR_MINGWDIR
120 echo You need to specify a valid MINGWDIR, where a valid gcc installation can be found.
121 goto DONE
122 :DONE
123