Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.6 KiB

  1. :: //========== Copyright (c) Valve Corporation, All rights reserved. ========
  2. :: //
  3. :: // Script to run swig
  4. :: //
  5. :: // SYNTAX: swig_python.cmd <PYVER> <OUTBINDIR> <SWIGFILE> [AUTOSWIG]
  6. :: //
  7. :: //=========================================================================
  8. @echo off
  9. setlocal
  10. :: // Make sure we have enough arguments
  11. if .%1. == .. goto Usage
  12. if .%2. == .. goto Usage
  13. if .%3. == .. goto Usage
  14. set AUTOSWIG=
  15. if not .%4. == .. set AUTOSWIG=1
  16. set PREFIX=[%~n0]
  17. set SRCDIR=%~d0%~p0..
  18. set PYVER=%1
  19. set OUTBINDIR=%2
  20. set SWIGFILE=%3
  21. set SWIGOUTDIR=swig_python%PYVER%
  22. set SWIGC=%SWIGFILE%_wrap_python%PYVER%.cpp
  23. set SWIG=%SRCDIR%\devtools\swigwin-1.3.40\swig.exe
  24. set AUTOSWIGSCRIPT=%~d0%~p0swig_auto_dme.pl
  25. set PERL=%~d0
  26. if NOT EXIST %SWIG% GOTO ErrorNoSwig
  27. if EXIST %SWIGOUTDIR% GOTO SwigOutDirOk
  28. MKDIR %SWIGOUTDIR%
  29. if ERRORLEVEL 1 GOTO ErrorSwigOutDir
  30. :SwigOutDirOk
  31. if NOT DEFINED AUTOSWIG GOTO AutoSwigOk
  32. set FOUNDPERL=
  33. for %%P in ( wperl.exe ) do ( set FOUNDPERL=%%~$PATH:P)
  34. if NOT DEFINED FOUNDPERL goto ErrorNoPerl
  35. echo %PREFIX% Perl produces swigfile, swig_auto_dme.pl produces %SWIGOUTDIR%\auto_%SWIGFILE%.i
  36. echo %PREFIX% "%FOUNDPERL%" "%AUTOSWIGSCRIPT%" "%SWIGOUTDIR%" "%SWIGFILE%"
  37. "%FOUNDPERL%" "%AUTOSWIGSCRIPT%" "%SWIGOUTDIR%" "%SWIGFILE%"
  38. :AutoSwigOk
  39. if EXIST %OUTBINDIR% GOTO OutBinDirOk
  40. MKDIR %OUTBINDIR%
  41. if ERRORLEVEL 1 GOTO ErrorOutBinDir
  42. :OutBinDirOk
  43. if EXIST %SWIGOUTDIR%\%SWIGC% DEL %SWIGOUTDIR%\%SWIGC%
  44. echo %PREFIX% %SWIG% -Fmicrosoft -small -ignoremissing -w312 -w325 -w383 -w503 -w509 -c++ -Iswig_python%PYVER% -I%SRCDIR%/public -outdir %SWIGOUTDIR% -o %SWIGOUTDIR%/%SWIGC% -python %SWIGFILE%.i"
  45. %SWIG% -small -Fmicrosoft -ignoremissing -w312 -w325 -w383 -w503 -w509 -w401 -c++ -Iswig_python%PYVER% -I%SRCDIR%/public -outdir %SWIGOUTDIR% -o %SWIGOUTDIR%/%SWIGC% -python %SWIGFILE%.i"
  46. if ERRORLEVEL 1 goto ErrorSwig
  47. :EndOk
  48. endlocal
  49. exit /b 0
  50. :Usage
  51. echo.
  52. echo NAME
  53. echo %~n0
  54. echo.
  55. echo SYNOPSIS
  56. echo %0 ^<SRCDIR^> ^<PYVER^> ^<SWIGFILE^> ^<SWIGBINDIR^>
  57. echo.
  58. echo DESCRIPTION
  59. echo Runs swig on the specified swig file for the specified python version
  60. echo.
  61. goto EndError
  62. :ErrorNoSwig
  63. echo %PREFIX% Error! No swig executable found here: %SWIG%
  64. goto EndError
  65. :ErrorSwigOutDir
  66. echo %PREFIX% Error! Swig Output Dir doesn't exist and could not be created: %SWIGOUTDIR%
  67. goto EndError
  68. :ErrorOutBinDir
  69. echo %PREFIX% Error! Swig Output Bin Dir doesn't exist and could not be created: %OUTBINDIR%
  70. goto EndError
  71. :ErrorSwig
  72. echo %PREFIX% Error! Swig filed"
  73. goto EndError
  74. :ErrorNoPerl
  75. echo %PREFIX% Error! No perl.exe executable found in PATH"
  76. :EndError
  77. endlocal
  78. exit 1