@@ -116,6 +116,11 @@ if "%CMAKE_VERSION%" LSS "cmake version 3.11.4" (
116116 goto :ErrorAndPrintUsage
117117)
118118
119+ :: NOTE Boost < 1.64 doesn't work without tricks if the user has only VS 2017 installed and no earlier versions.
120+ set BOOST_VERSION = 1.74.0
121+ :: Version string with underscores instead of dots.
122+ set BOOST_VER = %BOOST_VERSION:. =_ %
123+
119124:: Print build configuration information
120125
121126call cecho.cmd 0 10 " Script configuration:"
@@ -191,10 +196,6 @@ popd
191196:: Note all of the dependencies have appropriate label so that user can easily skip something if wanted
192197:: by modifying this file and using goto.
193198:Boost
194- :: NOTE Boost < 1.64 doesn't work without tricks if the user has only VS 2017 installed and no earlier versions.
195- set BOOST_VERSION = 1.74.0
196- :: Version string with underscores instead of dots.
197- set BOOST_VER = %BOOST_VERSION:. =_ %
198199:: DEPENDENCY_NAME is used for logging and DEPENDENCY_DIR for saving from some redundant typing
199200set DEPENDENCY_NAME = Boost %BOOST_VERSION%
200201set DEPENDENCY_DIR = %DEPS_DIR% \boost_%BOOST_VER%
@@ -428,6 +429,68 @@ IF EXIST "%DEPS_DIR%\swigwin-%SWIG_VERSION%". (
428429)
429430IF EXIST " %DEPS_DIR% \swigwin\" . robocopy " %DEPS_DIR% \swigwin" " %INSTALL_DIR% \swigwin" /E /IS /MOVE /njh /njs
430431
432+ :mpir
433+ set DEPENDENCY_NAME = mpir
434+ set DEPENDENCY_DIR = %DEPS_DIR% \mpir
435+ call :GitCloneAndCheckoutRevision https://github.com/BrianGladman/mpir.git " %DEPENDENCY_DIR% "
436+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
437+ cd " %DEPENDENCY_DIR% "
438+ git reset --hard
439+ REM There probably need to be quotes here around the filename
440+ powershell -c " get-content %~dp0 patches\mpir.patch | %% {$_ -replace \" sdk\" ,\" %UCRTVersion% \" } | %% {$_ -replace \" fn\" ,\" lib_mpir_cxx\" }" | git apply --unidiff-zero
441+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
442+ powershell -c " get-content %~dp0 patches\mpir.patch | %% {$_ -replace \" sdk\" ,\" %UCRTVersion% \" } | %% {$_ -replace \" fn\" ,\" lib_mpir_gc\" }" | git apply --unidiff-zero
443+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
444+ if NOT " %USE_STATIC_RUNTIME% " == " FALSE" git apply " %~dp0 patches\mpir_runtime.patch" --unidiff-zero
445+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
446+ cd msvc
447+ cd vs%VS_VER:~2 ,2 %
448+ call .\msbuild.bat gc LIB %VS_PLATFORM% Release
449+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
450+ IF NOT EXIST " %INSTALL_DIR% \mpir" . mkdir " %INSTALL_DIR% \mpir"
451+ copy ..\..\lib\%VS_PLATFORM% \Release\* " %INSTALL_DIR% \mpir"
452+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
453+
454+ :mpfr
455+ set DEPENDENCY_NAME = mpfr
456+ set DEPENDENCY_DIR = %DEPS_DIR% \mpfr
457+ call :GitCloneAndCheckoutRevision https://github.com/BrianGladman/mpfr.git " %DEPENDENCY_DIR% " 2ebbe10fd029a480cf6e8a64c493afa9f3654251
458+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
459+ cd " %DEPENDENCY_DIR% "
460+ git reset --hard
461+ powershell -c " get-content %~dp0 patches\mpfr.patch | %% {$_ -replace \" sdk\" ,\" %UCRTVersion% \" } | %% {$_ -replace \" fn\" ,\" lib_mpfr\" }" | git apply --unidiff-zero
462+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
463+ if NOT " %USE_STATIC_RUNTIME% " == " FALSE" git apply " %~dp0 patches\mpfr_runtime.patch" --unidiff-zero
464+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
465+ call :BuildSolution " %DEPENDENCY_DIR% \build.vc15\lib_mpfr.sln" %DEBUG_OR_RELEASE% lib_mpfr
466+ REM This command fails because not all msvc projects are patched with the right sdk version
467+ IF NOT EXIST lib\%VS_PLATFORM% \Release\mpfr.lib GOTO :Error
468+ IF NOT EXIST " %INSTALL_DIR% \mpfr" . mkdir " %INSTALL_DIR% \mpfr"
469+ copy lib\%VS_PLATFORM% \Release\* " %INSTALL_DIR% \mpfr"
470+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
471+
472+ :cgal
473+ set DEPENDENCY_NAME = cgal
474+ set DEPENDENCY_DIR = %DEPS_DIR% \cgal
475+ call :GitCloneAndCheckoutRevision https://github.com/CGAL/cgal.git " %DEPENDENCY_DIR% " v5.2.3
476+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
477+ cd " %DEPENDENCY_DIR% "
478+ git reset --hard
479+ git apply " %~dp0 patches\cgal_no_zlib.patch"
480+ call :RunCMake -DCMAKE_INSTALL_PREFIX=" %INSTALL_DIR% \cgal" ^
481+ -DBOOST_ROOT=" %DEPS_DIR% \boost_%BOOST_VER% " ^
482+ -DGMP_INCLUDE_DIR=" %INSTALL_DIR% \mpir" ^
483+ -DGMP_LIBRARIES=" %INSTALL_DIR% \mpir\mpir.lib" ^
484+ -DMPFR_INCLUDE_DIR=" %INSTALL_DIR% \mpfr" ^
485+ -DMPFR_LIBRARIES=" %INSTALL_DIR% \mpfr\mpfr.lib" ^
486+ -DBUILD_SHARED_LIBS=On ^
487+ -DBOOST_LIBRARYDIR=" %DEPS_DIR% \boost_%BOOST_VER% \stage\vs%VS_VER% -%VS_PLATFORM% \lib"
488+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
489+ call :BuildSolution " %DEPENDENCY_DIR% \%BUILD_DIR% \CGAL.sln" %BUILD_CFG%
490+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
491+ call :InstallCMakeProject " %DEPENDENCY_DIR% \%BUILD_DIR% " %BUILD_CFG%
492+ IF NOT %ERRORLEVEL% == 0 GOTO :Error
493+
431494:Successful
432495echo .
433496call " %~dp0 \utils\cecho.cmd" 0 10 " %PROJECT_NAME% dependencies built."
@@ -504,6 +567,7 @@ if not exist "%~2". (
504567 set RET = %ERRORLEVEL%
505568) else (
506569 call cecho.cmd 0 13 " %DEPENDENCY_NAME% already cloned. Pulling latest changes."
570+ git reset --hard
507571 pushd %2
508572 call git pull
509573 set RET = 0
@@ -520,7 +584,7 @@ if not exist "%~2". (
520584 pushd " %DEPS_DIR% "
521585 call git clone %1 %2
522586 set RET = %ERRORLEVEL%
523- if not %RET% == 0 exit /b %RET%
587+ if not " %RET% " == " 0 " exit /b %RET%
524588 popd
525589) else (
526590 call cecho.cmd 0 13 " %DEPENDENCY_NAME% already cloned."
0 commit comments