build_swig.bat 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. @echo off
  2. REM Copyright (C) 1994-2017 Altair Engineering, Inc.
  3. REM For more information, contact Altair at www.altair.com.
  4. REM
  5. REM This file is part of the PBS Professional ("PBS Pro") software.
  6. REM
  7. REM Open Source License Information:
  8. REM
  9. REM PBS Pro is free software. You can redistribute it and/or modify it under the
  10. REM terms of the GNU Affero General Public License as published by the Free
  11. REM Software Foundation, either version 3 of the License, or (at your option) any
  12. REM later version.
  13. REM
  14. REM PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  15. REM WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  16. REM PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
  17. REM
  18. REM You should have received a copy of the GNU Affero General Public License along
  19. REM with this program. If not, see <http://www.gnu.org/licenses/>.
  20. REM
  21. REM Commercial License Information:
  22. REM
  23. REM The PBS Pro software is licensed under the terms of the GNU Affero General
  24. REM Public License agreement ("AGPL"), except where a separate commercial license
  25. REM agreement for PBS Pro version 14 or later has been executed in writing with Altair.
  26. REM
  27. REM Altair’s dual-license business model allows companies, individuals, and
  28. REM organizations to create proprietary derivative works of PBS Pro and distribute
  29. REM them - whether embedded or bundled with other software - under a commercial
  30. REM license agreement.
  31. REM
  32. REM Use of Altair’s trademarks, including but not limited to "PBS™",
  33. REM "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  34. REM trademark licensing policies.
  35. @echo on
  36. setlocal
  37. call "%~dp0set_paths.bat" %~1
  38. cd "%BINARIESDIR%"
  39. if not defined SWIG_VERSION (
  40. echo "Please set SWIG_VERSION to Swig version!"
  41. exit /b 1
  42. )
  43. if exist "%BINARIESDIR%\swig" (
  44. echo "%BINARIESDIR%\swig exist already!"
  45. exit /b 0
  46. )
  47. if exist "%BINARIESDIR%\python\python.exe" (
  48. echo "Found Python installation at %BINARIESDIR%\python, using it to add Python support in swig"
  49. set PYTHON_INSTALL_DIR="%BINARIESDIR_M%/python/python.exe"
  50. ) else if exist "C:\Python27\python.exe" (
  51. echo "Found Python installation at C:\Python27, using it to add Python support in swig"
  52. set PYTHON_INSTALL_DIR=/c/Python27/python.exe
  53. ) else (
  54. echo "Could not find Python installation, required to add Python support in swig"
  55. exit /b 1
  56. )
  57. if not exist "%BINARIESDIR%\swig-rel-%SWIG_VERSION%.zip" (
  58. "%CURL_BIN%" -qkL -o "%BINARIESDIR%\swig-rel-%SWIG_VERSION%.zip" https://github.com/swig/swig/archive/rel-%SWIG_VERSION%.zip
  59. if not exist "%BINARIESDIR%\swig-rel-%SWIG_VERSION%.zip" (
  60. echo "Failed to download swig"
  61. exit /b 1
  62. )
  63. )
  64. REM CCCL is Unix cc compiler to Microsoft's cl compiler wrapper
  65. REM and it is require to generate native swig windows binary which doesn't depend on any of MinGW DLLs
  66. if not exist "%BINARIESDIR%\cccl-1.0.zip" (
  67. "%CURL_BIN%" -qkL -o "%BINARIESDIR%\cccl-1.0.zip" https://github.com/swig/cccl/archive/cccl-1.0.zip
  68. if not exist "%BINARIESDIR%\cccl-1.0.zip" (
  69. echo "Failed to download cccl"
  70. exit /b 1
  71. )
  72. )
  73. 2>nul rd /S /Q "%BINARIESDIR%\cccl-cccl-1.0"
  74. "%UNZIP_BIN%" -q "%BINARIESDIR%\cccl-1.0.zip"
  75. if not %ERRORLEVEL% == 0 (
  76. echo "Failed to extract %BINARIESDIR%\cccl-1.0.zip"
  77. exit /b 1
  78. )
  79. if not exist "%BINARIESDIR%\cccl-cccl-1.0" (
  80. echo "Could not find %BINARIESDIR%\cccl-cccl-1.0"
  81. exit /b 1
  82. )
  83. if not exist "%BINARIESDIR%\cccl-cccl-1.0\cccl" (
  84. echo "Could not find %BINARIESDIR%\cccl-cccl-1.0\cccl"
  85. exit /b 1
  86. )
  87. 2>nul rd /S /Q "%BINARIESDIR%\swig-rel-%SWIG_VERSION%"
  88. "%UNZIP_BIN%" -q "%BINARIESDIR%\swig-rel-%SWIG_VERSION%.zip"
  89. if not %ERRORLEVEL% == 0 (
  90. echo "Failed to extract %BINARIESDIR%\swig-rel-%SWIG_VERSION%.zip"
  91. exit /b 1
  92. )
  93. if not exist "%BINARIESDIR%\swig-rel-%SWIG_VERSION%" (
  94. echo "Could not find %BINARIESDIR%\swig-rel-%SWIG_VERSION%"
  95. exit /b 1
  96. )
  97. call "%VS90COMNTOOLS%\vsvars32.bat
  98. "%MSYSDIR%\bin\bash" --login -i -c "cp -f \"$BINARIESDIR_M/cccl-cccl-1.0/cccl\" /usr/bin/cccl && chmod +x /usr/bin/cccl"
  99. if not %ERRORLEVEL% == 0 (
  100. echo "Failed to copy cccl from %BINARIESDIR%\cccl-cccl-1.0\cccl to /usr/bin/cccl in MSYS bash"
  101. exit /b 1
  102. )
  103. "%MSYSDIR%\bin\bash" --login -i -c "cd \"$BINARIESDIR_M/swig-rel-$SWIG_VERSION\" && ./autogen.sh"
  104. if not %ERRORLEVEL% == 0 (
  105. echo "Failed to generate configure for swig"
  106. exit /b 1
  107. )
  108. "%MSYSDIR%\bin\bash" --login -i -c "cd \"$BINARIESDIR_M/swig-rel-$SWIG_VERSION\" && ./configure CC=cccl CXX=cccl CFLAGS='-O2' CXXFLAGS='-O2' LDFLAGS='--cccl-link /LTCG' --prefix=\"$BINARIESDIR_M/swig\" --without-alllang --with-python=\"$PYTHON_INSTALL_DIR\" --disable-dependency-tracking --disable-ccache --without-pcre"
  109. if not %ERRORLEVEL% == 0 (
  110. echo "Failed to generate makefiles for swig"
  111. exit /b 1
  112. )
  113. "%MSYSDIR%\bin\bash" --login -i -c "cd \"$BINARIESDIR_M/swig-rel-$SWIG_VERSION\" && make"
  114. if not %ERRORLEVEL% == 0 (
  115. echo "Failed to compile swig"
  116. exit /b 1
  117. )
  118. "%MSYSDIR%\bin\bash" --login -i -c "cd \"$BINARIESDIR_M/swig-rel-$SWIG_VERSION\" && make install"
  119. if not %ERRORLEVEL% == 0 (
  120. echo "Failed to install swig"
  121. exit /b 1
  122. )
  123. cd "%BINARIESDIR%"
  124. 2>nul rd /S /Q "%BINARIESDIR%\cccl-cccl-1.0"
  125. 2>nul rd /S /Q "%BINARIESDIR%\swig-rel-%SWIG_VERSION%"
  126. exit /b 0