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
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
24 echo TARGETTYPE=%TARGET% > target
25 copy target+..\..\msvc\libusb_sources sources >NUL 2>&1
30 if errorlevel 1 goto builderror
35 if %_BUILDARCH%==x86 goto isI386
40 set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir%
42 set dstPath=%destType%\Debug
43 if %DDKBUILDENV%==chk goto isDebug
44 set dstPath=%destType%\Release
47 if exist %destType% goto md2
50 if exist %dstPath% goto md3
53 if exist %dstPath%\dll goto md4
56 if exist %dstPath%\lib goto md5
59 if exist %dstPath%\examples goto md6
62 if exist %dstPath%\tests goto md7
67 if %TARGET%==LIBRARY goto copylib
68 copy %srcPath%\libusb-%version%.dll %dstPath%\dll
69 copy %srcPath%\libusb-%version%.pdb %dstPath%\dll
71 copy %srcPath%\libusb-%version%.lib %dstPath%\lib
75 if exist examples\getopt\getopt_ddkbuild goto md8
76 md examples\getopt\getopt_ddkbuild
79 cd examples\getopt\getopt_ddkbuild
80 copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1
84 if errorlevel 1 goto builderror
87 if exist examples\fxload_ddkbuild goto md9
88 md examples\fxload_ddkbuild
91 cd examples\fxload_ddkbuild
92 copy ..\..\msvc\fxload_sources sources >NUL 2>&1
96 if errorlevel 1 goto builderror
99 set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
102 copy %srcPath%\fxload.exe %dstPath%\examples
103 copy %srcPath%\fxload.pdb %dstPath%\examples
107 if exist examples\hotplugtest_ddkbuild goto md10
108 md examples\hotplugtest_ddkbuild
111 cd examples\hotplugtest_ddkbuild
112 copy ..\..\msvc\hotplugtest_sources sources >NUL 2>&1
116 if errorlevel 1 goto builderror
119 set srcPath=examples\hotplugtest_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
122 copy %srcPath%\hotplugtest.exe %dstPath%\examples
123 copy %srcPath%\hotplugtest.pdb %dstPath%\examples
127 if exist examples\listdevs_ddkbuild goto md11
128 md examples\listdevs_ddkbuild
131 cd examples\listdevs_ddkbuild
132 copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
136 if errorlevel 1 goto builderror
139 set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
142 copy %srcPath%\listdevs.exe %dstPath%\examples
143 copy %srcPath%\listdevs.pdb %dstPath%\examples
147 if exist examples\testlibusb_ddkbuild goto md12
148 md examples\testlibusb_ddkbuild
151 cd examples\testlibusb_ddkbuild
152 copy ..\..\msvc\testlibusb_sources sources >NUL 2>&1
156 if errorlevel 1 goto builderror
159 set srcPath=examples\testlibusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
162 copy %srcPath%\testlibusb.exe %dstPath%\examples
163 copy %srcPath%\testlibusb.pdb %dstPath%\examples
167 if exist examples\xusb_ddkbuild goto md13
168 md examples\xusb_ddkbuild
171 cd examples\xusb_ddkbuild
172 copy ..\..\msvc\xusb_sources sources >NUL 2>&1
176 if errorlevel 1 goto builderror
179 set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
182 copy %srcPath%\xusb.exe %dstPath%\examples
183 copy %srcPath%\xusb.pdb %dstPath%\examples
187 if exist tests\stress_ddkbuild goto md14
188 md tests\stress_ddkbuild
191 cd tests\stress_ddkbuild
192 copy ..\..\msvc\stress_sources sources >NUL 2>&1
196 if errorlevel 1 goto builderror
199 set srcPath=tests\stress_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
202 copy %srcPath%\stress.exe %dstPath%\tests
203 copy %srcPath%\stress.pdb %dstPath%\tests
211 echo ddk_build must be run in a WDK build environment