Skip to content

Commit

Permalink
Ensure lib files are built and copied from correct location for SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed May 16, 2019
1 parent f813f69 commit 2518d20
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
16 changes: 14 additions & 2 deletions build_sdk.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
@echo off
set SDKFILENAME=npcap-sdk-1.01.zip
set SDKFILENAME=npcap-sdk-1.02.zip

if "%2"== "" ( rd /s/q ./npcap-sdk 2>nul >nul) else ( rd /s /q "%2" 2>nul >nul)

SET TOPSRCDIR=%cd%

rem Must build Npcap in order to have the lib files available (and to ensure it builds correctly!)
cd installer
call Build.bat
cd %TOPSRCDIR%

rem Requires Cygwin to provide make.exe
call create_include.bat %1 %2

call create_lib.bat %1 %2
call create_lib.bat %1 %2 || goto :fail

call create_examples.bat %1 %2

Expand All @@ -18,3 +25,8 @@ cd .\npcap-sdk
"C:\Program Files\7-Zip\7z.exe" a ..\%SDKFILENAME% .
PAUSE

exit /b
:fail
echo Failed!
pause
exit /b 1
25 changes: 21 additions & 4 deletions create_lib.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,35 @@ IF "%2"=="" (set WPDPACKDESTDIR=.\npcap-sdk\) ELSE (set WPDPACKDESTDIR=%2)

IF ""=="%1" (set WINPCAPSOURCEDIR=.\) ELSE (set WINPCAPSOURCEDIR=%1)

echo Checking for wpcap build dirs
set WPCAPBUILDDIR32=%WINPCAPSOURCEDIR%\wpcap\build-win32
if not exist "%WPCAPBUILDDIR32%" goto :fail
set WPCAPBUILDDIR64=%WINPCAPSOURCEDIR%\wpcap\build-x64
if not exist "%WPCAPBUILDDIR64%" goto :fail

echo Checking for Packet build dir
set PACKETBUILDDIR=%WINPCAPSOURCEDIR%\packetWin7\vs14
if not exist "%PACKETBUILDDIR%" goto :fail

echo Creating \Lib folder
mkdir %WPDPACKDESTDIR% >nul 2>nul
mkdir %WPDPACKDESTDIR%\Lib >nul 2>nul
mkdir %WPDPACKDESTDIR%\Lib\x64 >nul 2>nul

xcopy /v /Y "%WINPCAPSOURCEDIR%\wpcap\libpcap\Win32\Prj\Release\wpcap.lib" %WPDPACKDESTDIR%\Lib\ >nul
xcopy /v /Y "%WINPCAPSOURCEDIR%\wpcap\libpcap\Win32\Prj\x64\Release\wpcap.lib" %WPDPACKDESTDIR%\Lib\x64 >nul
xcopy /v /Y "%WINPCAPSOURCEDIR%\packetWin7\Dll\Project\Release No NetMon and AirPcap\packet.lib" %WPDPACKDESTDIR%\Lib\ >nul
xcopy /v /Y "%WINPCAPSOURCEDIR%\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap\packet.lib" %WPDPACKDESTDIR%\Lib\x64 >nul
xcopy /v /Y "%WPCAPBUILDDIR32%\Release\wpcap.lib" %WPDPACKDESTDIR%\Lib\ || goto :fail
xcopy /v /Y "%WPCAPBUILDDIR64%\Release\wpcap.lib" %WPDPACKDESTDIR%\Lib\x64 || goto :fail
xcopy /v /Y "%PACKETBUILDDIR%\Release No NetMon and AirPcap\packet.lib" %WPDPACKDESTDIR%\Lib\ || goto :fail
xcopy /v /Y "%PACKETBUILDDIR%\x64\Release No NetMon and AirPcap\packet.lib" %WPDPACKDESTDIR%\Lib\x64 || goto :fail

echo Folder \Lib created successfully

set WPDPACKDESTDIR=
set WINPCAPSOURCEDIR=

exit /b

:fail
echo Failed.
pause
exit /b 1

2 changes: 1 addition & 1 deletion wpcap/libpcap

0 comments on commit 2518d20

Please sign in to comment.