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)
6 ::# - "USBDK" to build with UsbDk backend
8 if Test%BUILD_ALT_DIR%==Test goto usage
10 ::# process commandline parameters
16 set BUILD_CMD=build -bcwgZ -M2
20 if "%1" == "" goto no_more_args
21 ::# /I for case insensitive
22 if /I Test%1==TestDLL set TARGET=DYNLINK
23 if /I Test%1==Test/MT set STATIC_LIBC=1
24 if /I Test%1==TestUSBDK set WITH_USBDK=1
32 echo TARGETTYPE=%TARGET% > target
33 copy target+..\..\msvc\libusb_sources sources >NUL 2>&1
38 if errorlevel 1 goto builderror
43 if %_BUILDARCH%==x86 goto isI386
48 set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir%
50 set dstPath=%destType%\Debug
51 if %DDKBUILDENV%==chk goto isDebug
52 set dstPath=%destType%\Release
55 if exist %destType% goto md2
58 if exist %dstPath% goto md3
61 if exist %dstPath%\dll goto md4
64 if exist %dstPath%\lib goto md5
67 if exist %dstPath%\examples goto md6
72 @if /I NOT Test%1==TestDLL goto copylib
73 copy %srcPath%\libusb-%version%.dll %dstPath%\dll
74 copy %srcPath%\libusb-%version%.pdb %dstPath%\dll
76 copy %srcPath%\libusb-%version%.lib %dstPath%\lib
80 if exist examples\listdevs_ddkbuild goto md7
81 md examples\listdevs_ddkbuild
84 cd examples\listdevs_ddkbuild
85 copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
89 if errorlevel 1 goto builderror
92 set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
95 copy %srcPath%\listdevs.exe %dstPath%\examples
96 copy %srcPath%\listdevs.pdb %dstPath%\examples
100 if exist examples\xusb_ddkbuild goto md8
101 md examples\xusb_ddkbuild
104 cd examples\xusb_ddkbuild
105 copy ..\..\msvc\xusb_sources sources >NUL 2>&1
109 if errorlevel 1 goto builderror
112 set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
115 copy %srcPath%\xusb.exe %dstPath%\examples
116 copy %srcPath%\xusb.pdb %dstPath%\examples
120 if exist examples\getopt\getopt_ddkbuild goto md9
121 md examples\getopt\getopt_ddkbuild
124 cd examples\getopt\getopt_ddkbuild
125 copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1
129 if errorlevel 1 goto builderror
132 if exist examples\fxload_ddkbuild goto md10
133 md examples\fxload_ddkbuild
136 cd examples\fxload_ddkbuild
137 copy ..\..\msvc\fxload_sources sources >NUL 2>&1
141 if errorlevel 1 goto builderror
144 set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
147 copy %srcPath%\fxload.exe %dstPath%\examples
148 copy %srcPath%\fxload.pdb %dstPath%\examples
152 if exist examples\hotplugtest_ddkbuild goto md11
153 md examples\hotplugtest_ddkbuild
156 cd examples\hotplugtest_ddkbuild
157 copy ..\..\msvc\hotplugtest_sources sources >NUL 2>&1
161 if errorlevel 1 goto builderror
164 set srcPath=examples\hotplugtest_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
167 copy %srcPath%\hotplugtest.exe %dstPath%\examples
168 copy %srcPath%\hotplugtest.pdb %dstPath%\examples
176 echo ddk_build must be run in a WDK build environment