File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libnet / win32 / msvcbuild.bat
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Sep 27 11:11:37 2023 UTC (9 months ago) by misho
Branches: libnet, MAIN
CVS tags: v1_2p1, HEAD
Version 1.2p1

    1: @echo off
    2: 
    3: @rem Script to build libnet with MSVC.
    4: @rem Dependencies are:
    5: @rem winpcap, specifically, the winpcap developer pack
    6: @rem We assume WpdPack\ and libnet-master\ to have the same path,
    7: @rem and that this script is executed from either a VS2015 Developer Command Prompt
    8: @rem or an elevated Command Prompt.
    9: 
   10: :start
   11: @if "%1" == "" goto x86
   12: @setlocal
   13: @set userinput=%1
   14: @if not "%1"=="x86" @if not "%1"=="x64" @if not "%1"=="x86_x64" goto usage
   15: @if "%1"=="x86"  goto x86
   16: @if "%1"=="x64" goto x64
   17: @if "%1"=="x86_x64" goto x86_x64
   18: @endlocal
   19: 
   20: :x86
   21: if not exist "%VCINSTALLDIR%bin\vcvars32.bat" goto path
   22: call "%VCINSTALLDIR%bin\vcvars32.bat"
   23: goto msvcbuild32
   24: 
   25: :x64
   26: if not exist "%VCINSTALLDIR%bin\amd64\vcvars64.bat" goto path
   27: call "%VCINSTALLDIR%bin\amd64\vcvars64.bat"
   28: goto msvcbuild64
   29: 
   30: :x86_x64
   31: if not exist "%VCINSTALLDIR%vcvarsall.bat" goto path
   32: call "%VCINSTALLDIR%vcvarsall.bat" x86_amd64
   33: goto msvcbuild64
   34: 
   35: :msvcbuild32
   36: @echo on
   37: @setlocal
   38: @set MYCOMPILE=cl /nologo /MD /O2 /W4 /c /D_CRT_SECURE_NO_DEPRECATE /Fowin32\
   39: @set MYLINK=link /nologo
   40: @set MYMT=mt /nologo
   41: @set VERSION=1.2
   42: 
   43: @rem relative to C code in src/
   44: @set WINPCAP=..\..\..\WpdPack
   45: 
   46: if not exist "src\win32\" mkdir "src\win32\"
   47: 
   48: if not exist "lib\x86\" mkdir "lib\x86\"
   49: 
   50: copy win32\libnet.h include\
   51: copy win32\stdint.h include\libnet\
   52: copy win32\config.h include\
   53: copy win32\getopt.h include\
   54: 
   55: cd src
   56: %MYCOMPILE% /I..\include /I%WINPCAP%\Include libnet_a*.c libnet_build_*.c libnet_c*.c libnet_dll.c libnet_error.c libnet_i*.c libnet_link_win32.c libnet_p*.c libnet_raw.c libnet_resolve.c libnet_version.c libnet_write.c
   57: %MYLINK% /DLL /libpath:%WINPCAP%\Lib  /out:..\lib\x86\libnet%VERSION%.dll win32\*.obj Advapi32.lib
   58: if exist libnet.dll.manifest^
   59:   %MYMT% -manifest libnet.dll.manifest -outputresource:libnet.dll;2
   60: cd ..
   61: 
   62: exit /b %errorlevel%
   63: 
   64: :msvcbuild64
   65: @echo on
   66: @setlocal
   67: @set MYCOMPILE=cl /nologo /MD /O2 /W4 /c /D_CRT_SECURE_NO_DEPRECATE /Fowin64\
   68: @set MYLINK=link /nologo
   69: @set MYMT=mt /nologo
   70: @set VERSION=1.2
   71: 
   72: @rem relative to C code in src/
   73: @set WINPCAP=..\..\..\WpdPack
   74: 
   75: if not exist "src\win64\" mkdir "src\win64\"
   76: 
   77: if not exist "lib\x64\" mkdir "lib\x64\"
   78: 
   79: copy win32\libnet.h include\
   80: copy win32\stdint.h include\libnet\
   81: copy win32\config.h include\
   82: copy win32\getopt.h include\
   83: 
   84: cd src
   85: %MYCOMPILE% /I..\include /I%WINPCAP%\Include libnet_a*.c libnet_build_*.c libnet_c*.c libnet_dll.c libnet_error.c libnet_i*.c libnet_link_win32.c libnet_p*.c libnet_raw.c libnet_resolve.c libnet_version.c libnet_write.c
   86: %MYLINK% /DLL /libpath:%WINPCAP%\Lib\x64  /out:..\lib\x64\libnet%VERSION%.dll win64\*.obj Advapi32.lib
   87: if exist libnet.dll.manifest^
   88:   %MYMT% -manifest libnet.dll.manifest -outputresource:libnet.dll;2
   89: cd ..
   90: 
   91: exit /b %errorlevel%
   92: 
   93: :usage
   94: echo Invalid option "%*". The correct usage is:
   95: echo     %0 [option]
   96: echo :
   97: echo where [option] is: x86 ^| x64 ^| x86_x64
   98: echo :
   99: echo The script will verify and set the appropriate environment variables.
  100: echo If no options are provided, x86 is assumed.
  101: echo :
  102: echo Usage examples:
  103: echo     %0 x86
  104: echo     %0 x64
  105: echo     %0 x86_x64
  106: echo :
  107: echo If your build computer is 32-bit and you want to build for 64-bit 
  108: echo (aka Cross), choose "x86_x64"
  109: echo :
  110: echo Please make sure Visual Studio or the C++ Build SKU is installed,
  111: echo and that this script is executed from a Developer Command Prompt.
  112: echo :
  113: goto end
  114: 
  115: :path
  116: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"
  117: if not exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" goto fail
  118: goto start
  119: 
  120: :fail
  121: echo Visual Studio or the C++ Build SKU do not seem to be installed.
  122: echo Please Install either of them or try to executed this script
  123: echo from a Developer Command Prompt.
  124: goto end
  125: 
  126: :end

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>