Samples: Add FX3 firmware upload support for fxload
[libusbx.git] / msvc / ddk_build.cmd
bloba68b5e2059abf9b3e93802120a5a5c0dff649139
1 @echo off
2 ::# default builds static library.
3 ::# you can pass the following arguments (case insensitive):
4 ::# - "DLL" to build a DLL instead of a static library
5 ::# - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
7 if Test%BUILD_ALT_DIR%==Test goto usage
9 ::# process commandline parameters
10 set TARGET=LIBRARY
11 set STATIC_LIBC=
12 set version=1.0
13 set PWD=%~dp0
14 set BUILD_CMD=build -bcwgZ -M2
16 if "%1" == "" goto no_more_args
17 ::# /I for case insensitive
18 if /I Test%1==TestDLL set TARGET=DYNLINK
19 if /I Test%1==Test/MT set STATIC_LIBC=1
20 :no_more_args
22 cd ..\libusb\os
23 echo TARGETTYPE=%TARGET% > target
24 copy target+..\..\msvc\libusb_sources sources >NUL 2>&1
25 del target
26 @echo on
27 %BUILD_CMD%
28 @echo off
29 if errorlevel 1 goto builderror
30 cd ..\..
32 set cpudir=i386
33 set destType=Win32
34 if %_BUILDARCH%==x86 goto isI386
35 set cpudir=amd64
36 set destType=x64
37 :isI386
39 set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir%
41 set dstPath=%destType%\Debug
42 if %DDKBUILDENV%==chk goto isDebug
43 set dstPath=%destType%\Release
44 :isDebug
46 if exist %destType% goto md2
47 mkdir %destType%
48 :md2
49 if exist %dstPath% goto md3
50 mkdir %dstPath%
51 :md3
52 if exist %dstPath%\dll goto md4
53 mkdir %dstPath%\dll
54 :md4
55 if exist %dstPath%\lib goto md5
56 md %dstPath%\lib
57 :md5
58 if exist %dstPath%\examples goto md6
59 md %dstPath%\examples
60 :md6
61 @echo on
63 @if /I NOT Test%1==TestDLL goto copylib
64 copy %srcPath%\libusb-%version%.dll %dstPath%\dll
65 copy %srcPath%\libusb-%version%.pdb %dstPath%\dll
66 :copylib
67 copy %srcPath%\libusb-%version%.lib %dstPath%\lib
69 @echo off
71 if exist examples\listdevs_ddkbuild goto md7
72 md examples\listdevs_ddkbuild
73 :md7
75 cd examples\listdevs_ddkbuild
76 copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
77 @echo on
78 %BUILD_CMD%
79 @echo off
80 if errorlevel 1 goto builderror
81 cd ..\..
83 set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
84 @echo on
86 copy %srcPath%\listdevs.exe %dstPath%\examples
87 copy %srcPath%\listdevs.pdb %dstPath%\examples
89 @echo off
91 if exist examples\xusb_ddkbuild goto md8
92 md examples\xusb_ddkbuild
93 :md8
95 cd examples\xusb_ddkbuild
96 copy ..\..\msvc\xusb_sources sources >NUL 2>&1
97 @echo on
98 %BUILD_CMD%
99 @echo off
100 if errorlevel 1 goto builderror
101 cd ..\..
103 set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
104 @echo on
106 copy %srcPath%\xusb.exe %dstPath%\examples
107 copy %srcPath%\xusb.pdb %dstPath%\examples
109 @echo off
111 if exist examples\getopt\getopt_ddkbuild goto md9
112 md examples\getopt\getopt_ddkbuild
113 :md9
115 cd examples\getopt\getopt_ddkbuild
116 copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1
117 @echo on
118 %BUILD_CMD%
119 @echo off
120 if errorlevel 1 goto builderror
121 cd ..\..\..
123 if exist examples\fxload_ddkbuild goto md8
124 md examples\fxload_ddkbuild
125 :md8
127 cd examples\fxload_ddkbuild
128 copy ..\..\msvc\fxload_sources sources >NUL 2>&1
129 @echo on
130 %BUILD_CMD%
131 @echo off
132 if errorlevel 1 goto builderror
133 cd ..\..
135 set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
136 @echo on
138 copy %srcPath%\fxload.exe %dstPath%\examples
139 copy %srcPath%\fxload.pdb %dstPath%\examples
141 @echo off
143 cd msvc
144 goto done
146 :usage
147 echo ddk_build must be run in a WDK build environment
148 pause
149 goto done
151 :builderror
152 echo Build failed
154 :done
155 cd %PWD%