Guest User

BuildBoost-VS2015edit.bat

a guest
Jun 29th, 2017
256
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @ECHO OFF
  2. :: Perform the pre-steps to build boost and set the boost path for the build file
  3. SETLOCAL
  4. SET BOOSTPATH=
  5. SET MSVCTOOLSET=
  6. SET TOOLSETCOMMAND=
  7. SET BOOSTVERSION=
  8. SET WORKPATH=%~dp0%
  9.  
  10. SET BUILDTARGETPARAM=
  11. SET BUILDTARGETPATH=
  12.  
  13. rem :PARAMLOOP
  14. IF [%1]==[] (
  15.   GOTO PARAMCONTINUE
  16. )
  17.  
  18. IF NOT [%1]==[--toolset] (
  19.      SET BOOSTPATH=%1
  20. )
  21.  
  22. rem VS2015support: Param loop is REMed out for some reason so hack here to allow -toolset to work properly.
  23. rem VS2015support: This means that parameter or is important. New usage is...
  24. rem VS2015support: BuildBoost-VS2015edit.bat PathToBoost [--toolset ToolsetVersion] [-x64]
  25. IF [%2]==[--toolset] (
  26.   SET MSVCTOOLSET=%3
  27.   SHIFT
  28.   SHIFT
  29. )
  30.  
  31. IF [%2]==[-x64] (
  32.     SET BUILDTARGETPARAM=architecture=ia64
  33.     SET BUILDTARGETPATH=architecture-ia64\
  34. )
  35.  
  36. rem SHIFT
  37. rem GOTO PARAMLOOP
  38. :PARAMCONTINUE
  39.  
  40. IF [%BOOSTPATH%]==[] (
  41.    GOTO USAGE
  42. )
  43.  
  44. SET TOOLSETCOMMAND=
  45.  
  46. IF NOT [%MSVCTOOLSET%]==[] (
  47.     SET TOOLSETCOMMAND=toolset=%MSVCTOOLSET%
  48. )
  49.  
  50.    
  51.  
  52. IF NOT EXIST "%BOOSTPATH%\boost\regex.hpp" (
  53.    ECHO Not found: %BOOSTPATH%\boost\regex.hpp
  54.    GOTO BOOSTNOTFOUND
  55. )
  56.  
  57. IF NOT EXIST "%BOOSTPATH%\bjam\bin\bjam.exe" (
  58.     ECHO Building BJAM, the boost build tool
  59.     rem VS2015support: Boost 1_63_0 has bootstrap.bat & b2.exe in '...tools\build\' instead of '...tools\build\v2\'
  60.     PUSHD %BOOSTPATH%\tools\build
  61.     CALL bootstrap.bat
  62.  
  63.     rem VS2015support: Add echo
  64.     ECHO Starting boost install
  65.     %BOOSTPATH%\tools\build\b2 --prefix=%BOOSTPATH%\bjam install
  66.     POPD
  67. )
  68.  
  69. IF NOT ERRORLEVEL 0 (
  70.     GOTO BUILDERROR
  71. )
  72. ECHO.
  73. ECHO ***************************************************************
  74. ECHO Building tool to check boost version
  75. ECHO ***************************************************************
  76. ECHO # Temporary version of auto-generated file > %WORKPATH%\boostpath.mak
  77. ECHO # If you're seeing this version of the file, and you're not currently building boost, >> %WORKPATH%\boostpath.mak
  78. ECHO # then your buildboost.bat is failing somewhere.  >> %WORKPATH%\boostpath.mak
  79. ECHO # Run BuildBoost.bat [absolute_path_to_boost] to generate this file again >> %WORKPATH%\boostpath.mak
  80. ECHO # And lookout for error messages >> %WORKPATH%\boostpath.mak
  81. ECHO BOOSTPATH=%BOOSTPATH% >> %WORKPATH%\boostpath.mak
  82.  
  83. IF NOT EXIST bin md bin
  84. nmake -f getboostver.mak
  85.  
  86. IF ERRORLEVEL 1 (
  87.    ECHO ******************************
  88.    ECHO ** ERROR building getboostver.exe
  89.    ECHO ** Please see the error messages above, and post as much as you can to the
  90.    ECHO ** Notepad++ Open Discussion forum
  91.    ECHO ** http://sourceforge.net/projects/notepad-plus/forums/forum/331753
  92.    ECHO.
  93.    GOTO EOF
  94. )
  95.  
  96. for /f "delims=" %%i in ('bin\getboostver.exe') do set BOOSTVERSION=%%i
  97.  
  98. IF [%BOOSTVERSION%]==[] (
  99.    ECHO There was an error detecting the boost version.
  100.    ECHO Please see the error messages above, and post as much as you can to the
  101.    ECHO Notepad++ Open Discussion forum
  102.    ECHO http://sourceforge.net/projects/notepad-plus/forums/forum/331753
  103.    ECHO.
  104.    GOTO EOF
  105. )
  106. ECHO.
  107. ECHO ***************************************************************
  108. ECHO Boost version in use: %BOOSTVERSION%
  109. ECHO ***************************************************************
  110. ECHO.
  111.  
  112. ECHO.
  113. ECHO ***************************************************************
  114. ECHO Building Boost::regex
  115. ECHO ***************************************************************
  116. ECHO.
  117.  
  118. PUSHD %BOOSTPATH%\libs\regex\build
  119.  
  120. %BOOSTPATH%\bjam\bin\bjam %TOOLSETCOMMAND% variant=release threading=multi link=static runtime-link=static %BUILDTARGETPARAM%
  121. IF NOT ERRORLEVEL 0 (
  122.     GOTO BUILDERROR
  123. )
  124.  
  125. %BOOSTPATH%\bjam\bin\bjam %TOOLSETCOMMAND% variant=debug threading=multi link=static runtime-link=static %BUILDTARGETPARAM%
  126. IF NOT ERRORLEVEL 0 (
  127.     GOTO BUILDERROR
  128. )
  129.  
  130. IF NOT [%MSVCTOOLSET%]==[] (
  131.     GOTO TOOLSETKNOWN
  132. )
  133.  
  134. rem VS2015support: ToDo = add detect here. For now must specify Toolset on BuildBoost command line.
  135.  
  136. :: VS2013
  137. IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-12.0\release\%BUILDTARGETPATH%link-static\runtime-link-static\threading-multi\libboost_regex-vc120-mt-s-%BOOSTVERSION%.lib (
  138.     SET MSVCTOOLSET=msvc-12.0
  139. )
  140.  
  141. :: VS2012
  142. IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-11.0\release\link-static\runtime-link-static\threading-multi\libboost_regex-vc110-mt-s-%BOOSTVERSION%.lib (
  143.     SET MSVCTOOLSET=msvc-11.0
  144. )
  145.  
  146. :: VS2010
  147. IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-10.0\release\link-static\runtime-link-static\threading-multi\libboost_regex-vc100-mt-s-%BOOSTVERSION%.lib (
  148.     SET MSVCTOOLSET=msvc-10.0
  149. )
  150.  
  151. :: VS2008
  152. IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-9.0\release\link-static\runtime-link-static\threading-multi\libboost_regex-vc90-mt-s-%BOOSTVERSION%.lib (
  153.     SET MSVCTOOLSET=msvc-9.0
  154. )
  155.  
  156. :: VS2005
  157. IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-8.0\release\link-static\runtime-link-static\threading-multi\libboost_regex-vc80-mt-s-%BOOSTVERSION%.lib (
  158.     SET MSVCTOOLSET=msvc-8.0
  159. )
  160.  
  161. IF [%MSVCTOOLSET%]==[] (
  162.     ECHO No correctly built boost regex libraries could be found.  
  163.     ECHO Try specifying the MSVC version on the command line.
  164.     GOTO USAGE
  165. )
  166. ECHO ***********************************************
  167. ECHO Assuming toolset in use is %MSVCTOOLSET%
  168. ECHO ***********************************************
  169. ECHO If this is not correct, specify the version on the command line with --toolset
  170. ECHO Run buildboost.bat without parameters to see the usage.
  171.  
  172.  
  173. :TOOLSETKNOWN
  174.  
  175. rem VS2015support: Add BOOSTLIBPATH case
  176. :: VS2015
  177. IF [%MSVCTOOLSET%]==[msvc-14.0] (
  178.     SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-14.0
  179. )
  180.  
  181. :: VS2013
  182. IF [%MSVCTOOLSET%]==[msvc-12.0] (
  183.     SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-12.0
  184. )
  185.  
  186. :: VS2012
  187. IF [%MSVCTOOLSET%]==[msvc-11.0] (
  188.     SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-11.0
  189. )
  190.  
  191. :: VS2010
  192. IF [%MSVCTOOLSET%]==[msvc-10.0] (
  193.     SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-10.0
  194. )
  195.  
  196. :: VS2008
  197. IF [%MSVCTOOLSET%]==[msvc-9.0] (
  198.     SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-9.0
  199. )
  200.  
  201. :: VS2005
  202. IF [%MSVCTOOLSET%]==[msvc-8.0] (
  203.     SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-8.0
  204. )
  205.  
  206. :: Error case, so we try to give the user a helpful error message
  207. IF [%BOOSTLIBPATH%] == [] (
  208.     ECHO ****************************************
  209.     ECHO ** ERROR
  210.     ECHO ** Boost library could not be found.  
  211.     ECHO ** Make sure you've specified the correct boost path on the command line,
  212.     ECHO ** and try adding the toolset version
  213.     ECHO ****************************************
  214.     GOTO USAGE
  215. )
  216.  
  217. ECHO # Autogenerated file, run BuildBoost.bat [path_to_boost] to generate > %WORKPATH%\boostpath.mak
  218. ECHO BOOSTPATH=%BOOSTPATH% >> %WORKPATH%\boostpath.mak
  219. ECHO BOOSTLIBPATH=%BOOSTLIBPATH% >> %WORKPATH%\boostpath.mak
  220. ECHO BUILDTARGETPATH=%BUILDTARGETPATH% >> %WORKPATH%\boostpath.mak
  221. POPD
  222. ECHO.
  223. ECHO.
  224. ECHO Boost::regex built.
  225. ECHO.
  226. ECHO Now you need to build scintilla.
  227. ECHO.
  228. ECHO From the scintilla\win32 directory
  229. ECHO.
  230. ECHO   nmake -f scintilla.mak
  231. ECHO.
  232. ECHO.
  233.  
  234. GOTO EOF
  235.  
  236. :BOOSTNOTFOUND
  237. ECHO Boost Path not valid.  Run BuildBoost.bat with the absolute path to the directory
  238. ECHO where you unpacked your boost zip.
  239. ECHO.
  240. :USAGE
  241. ECHO.
  242. ECHO Boost is available free from www.boost.org
  243. ECHO.
  244. ECHO Unzip the file downloaded from www.boost.org, and give the absolute path
  245. ECHO as the first parameter to buildboost.bat
  246. ECHO.
  247. ECHO e.g.
  248. ECHO buildboost.bat d:\libs\boost_1_55_0          
  249.  
  250. ECHO.
  251. ECHO To build 64 bit version, add "-x64" flag after the full file path.
  252. ECHO e.g.
  253. ECHO buildboost.bat d:\libs\boost_1_55_0 -x64
  254.  
  255. ECHO.
  256. ECHO.
  257. ECHO You can specify which version of the Visual Studio compiler to use
  258. ECHO with --toolset.
  259. ECHO Use:  
  260. ECHO   --toolset msvc-8.0     for Visual studio 2005
  261. ECHO   --toolset msvc-9.0     for Visual Studio 2008
  262. ECHO   --toolset msvc-10.0    for Visual Studio 2010
  263. ECHO   --toolset msvc-11.0    for Visual Studio 2012
  264. ECHO   --toolset msvc-12.0    for Visual Studio 2013
  265. ECHO.
  266. ECHO.
  267. ECHO e.g.  To build with boost in d:\libs\boost_1_55_0 with Visual Studio 2008
  268. ECHO.
  269. ECHO         buildboost.bat --toolset msvc-9.0 d:\libs\boost_1_55_0
  270. ECHO.
  271. GOTO EOF
  272.  
  273.  
  274. :BUILDERROR
  275. ECHO There was an error building boost.  Please see the messages above for details.
  276. ECHO  - Have you got a clean extract from a recent boost version, such as 1.55?
  277. ECHO  - Download a fresh copy from www.boost.org and extract it to a directory,
  278. ECHO    and run the batch again with the name of that directory
  279.  
  280. :EOF
  281.  
  282. ENDLOCAL
RAW Paste Data