diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index a68764ff46..8dbaed09d6 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -44,10 +44,12 @@ OPTION(BUILD_CONVERT "Build IfcConvert executable." ON)
OPTION(USE_VLD "Use Visual Leak Detector for debugging memory leaks, MSVC-only." OFF)
OPTION(USE_MMAP "Adds a command line options to parse IFC files from memory mapped files using Boost.Iostreams" OFF)
OPTION(USE_VOXELS "Use voxelized geometries as a fallback mechanism to calculate quantities in IfcGeomServer" OFF)
+OPTION(USE_CGAL "Use CGAL as an alternative geometry kernel implementation" OFF)
if (${HAS_MAX})
OPTION(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." ON)
endif()
OPTION(BUILD_SHARED_LIBS "Build IfcParse and IfcGeom as shared libs (SO/DLL)." OFF)
+OPTION(USE_STATIC_MSVC_RUNTIME "Link to the static runtime on MSVC." ON)
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
# OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF)
@@ -147,8 +149,10 @@ ENDMACRO()
# runtime, when doing running conda-build we pick what conda prepared for us.
IF(WIN32 AND ("$ENV{CONDA_BUILD}" STREQUAL ""))
SET(Boost_USE_STATIC_LIBS ON)
- SET(Boost_USE_STATIC_RUNTIME ON)
SET(Boost_USE_MULTITHREADED ON)
+ if (USE_STATIC_MSVC_RUNTIME)
+ SET(Boost_USE_STATIC_RUNTIME ON)
+ endif()
ELSE()
# Disable Boost's autolinking as the libraries to be linked to are supplied
# already by CMake, and it's going to conflict if there are multiple, as is
@@ -268,6 +272,11 @@ foreach(lib ${OPENCASCADE_LIBRARY_NAMES})
list(APPEND OPENCASCADE_LIBRARIES "${lib_path}")
endforeach()
+list(APPEND GEOMETRY_KERNELS opencascade)
+
+if (USE_CGAL)
+add_definitions(-DIFOPSH_USE_CGAL)
+list(APPEND GEOMETRY_KERNELS cgal)
SET(CGAL_LIBRARY_NAMES libCGAL_Core libCGAL_ImageIO libCGAL)
# Find CGAL
IF("${CGAL_INCLUDE_DIR}" STREQUAL "")
@@ -316,6 +325,7 @@ IF(NOT libMPFR)
ENDIF()
list(APPEND CGAL_LIBRARIES "${libMPFR}")
list(APPEND CGAL_LIBRARIES "${libGMP}")
+endif()
if(MSVC)
add_definitions(-DHAVE_NO_DLL)
@@ -473,20 +483,22 @@ IF(MSVC)
# @todo currently fails
# add_definitions(-permissive-)
endif()
- # Link against the static VC runtime
- # TODO Make this configurable
- IF("$ENV{CONDA_BUILD}" STREQUAL "")
- FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
- CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
- IF(${flag} MATCHES "/MD")
- STRING(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
- ENDIF()
- IF(${flag} MATCHES "/MDd")
- STRING(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
- ENDIF()
- ENDFOREACH()
- ENDIF()
+
+ if(USE_STATIC_MSVC_RUNTIME)
+ # Link against the static VC runtime
+ IF("$ENV{CONDA_BUILD}" STREQUAL "")
+ FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
+ CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
+ IF(${flag} MATCHES "/MD")
+ STRING(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
+ ENDIF()
+ IF(${flag} MATCHES "/MDd")
+ STRING(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
+ ENDIF()
+ ENDFOREACH()
+ ENDIF()
+ endif()
ElSE()
add_definitions(-Wall -Wextra)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -595,7 +607,7 @@ TARGET_LINK_LIBRARIES(IfcParse ${Boost_LIBRARIES} ${BCRYPT_LIBRARIES} ${LIBXML2_
if (BUILD_IFCGEOM)
-foreach(kernel opencascade cgal)
+foreach(kernel ${GEOMETRY_KERNELS})
string(TOUPPER ${kernel} KERNEL_UPPER)
file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/schema_agnostic/${kernel}/*.h)
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/schema_agnostic/${kernel}/*.cpp)
@@ -618,7 +630,7 @@ set_target_properties(IfcGeom_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_
target_link_libraries(IfcGeom_ifc${schema} IfcParse)
list(APPEND IfcGeom_libraries IfcGeom_ifc${schema})
-foreach(kernel opencascade cgal)
+foreach(kernel ${GEOMETRY_KERNELS})
file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/kernels/${kernel}/*.h)
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/kernels/${kernel}/*.cpp)
set(IFCGEOM_FILES ${IFCGEOM_CPP_FILES} ${IFCGEOM_H_FILES})
diff --git a/src/ifcgeom/schema_agnostic/Kernel.cpp b/src/ifcgeom/schema_agnostic/Kernel.cpp
index 2ae967b35b..b006963b58 100644
--- a/src/ifcgeom/schema_agnostic/Kernel.cpp
+++ b/src/ifcgeom/schema_agnostic/Kernel.cpp
@@ -64,14 +64,18 @@ IfcGeom::impl::KernelFactoryImplementation& IfcGeom::impl::kernel_implementation
extern void init_KernelImplementation_opencascade_Ifc2x3(IfcGeom::impl::KernelFactoryImplementation*);
extern void init_KernelImplementation_opencascade_Ifc4(IfcGeom::impl::KernelFactoryImplementation*);
+#ifdef IFOPSH_USE_CGAL
extern void init_KernelImplementation_cgal_Ifc2x3(IfcGeom::impl::KernelFactoryImplementation*);
extern void init_KernelImplementation_cgal_Ifc4(IfcGeom::impl::KernelFactoryImplementation*);
+#endif
IfcGeom::impl::KernelFactoryImplementation::KernelFactoryImplementation() {
init_KernelImplementation_opencascade_Ifc2x3(this);
init_KernelImplementation_opencascade_Ifc4(this);
+#ifdef IFOPSH_USE_CGAL
init_KernelImplementation_cgal_Ifc2x3(this);
init_KernelImplementation_cgal_Ifc4(this);
+#endif
}
void IfcGeom::impl::KernelFactoryImplementation::bind(const std::string& schema_name, const std::string& geometry_library, IfcGeom::impl::kernel_fn fn) {
diff --git a/win/build-deps.cmd b/win/build-deps.cmd
index 56ea0b66fd..045bec841f 100644
--- a/win/build-deps.cmd
+++ b/win/build-deps.cmd
@@ -149,11 +149,18 @@ echo.
cd "%DEPS_DIR%"
+:: Define the version strings at the top in case individual dependencies are skipped
+set BOOST_VERSION=1.67.0
+set BOOST_VER=%BOOST_VERSION:.=_%
+set OCCT_VERSION=7.3.0
+set OCE_VERSION=OCE-0.18
+set PYTHON_VERSION=3.4.3
+set SWIG_VERSION=3.0.12
+
:: Note all of the dependencies have appropriate label so that user can easily skip something if wanted
:: by modifying this file and using goto.
:Boost
:: NOTE Boost < 1.64 doesn't work without tricks if the user has only VS 2017 installed and no earlier versions.
-set BOOST_VERSION=1.67.0
:: Version string with underscores instead of dots.
set BOOST_VER=%BOOST_VERSION:.=_%
:: DEPENDENCY_NAME is used for logging and DEPENDENCY_DIR for saving from some redundant typing
@@ -191,7 +198,8 @@ if %VS_VER% LSS 2017 (
set BOOST_VC_VER=-%VC_VER%.0
)
-call .\b2 toolset=msvc%BOOST_VC_VER% runtime-link=static address-model=%ARCH_BITS% -j%IFCOS_NUM_BUILD_PROCS% ^
+if NOT "%USE_STATIC_RUNTIME%"=="FALSE" set RUNTIME_LINK_STATIC=runtime-link=static
+call .\b2 toolset=msvc%BOOST_VC_VER% %RUNTIME_LINK_STATIC% address-model=%ARCH_BITS% -j%IFCOS_NUM_BUILD_PROCS% ^
variant=%DEBUG_OR_RELEASE_LOWERCASE% %BOOST_LIBS% stage --stagedir=stage/vs%VS_VER%-%VS_PLATFORM%
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -216,7 +224,8 @@ IF NOT %ERRORLEVEL%==0 git apply --reject --whitespace=fix "%~dp0patches\OpenCOL
:: uncomment to following line in order to delete the CMakeCache.txt always if experiencing problems.
REM IF EXIST "%DEPENDENCY_DIR%\%BUILD_DIR%\CMakeCache.txt". del "%DEPENDENCY_DIR%\%BUILD_DIR%\CMakeCache.txt"
:: NOTE Enforce that the embedded LibXml2 and PCRE are used as there might be problems with arbitrary versions of the libraries.
-call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\OpenCOLLADA" -DUSE_STATIC_MSVC_RUNTIME=1 -DCMAKE_DEBUG_POSTFIX=d ^
+if NOT "%USE_STATIC_RUNTIME%"=="FALSE" set STATIC_RUNTIME_1=-DUSE_STATIC_MSVC_RUNTIME=1
+call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\OpenCOLLADA" %STATIC_RUNTIME_1% -DCMAKE_DEBUG_POSTFIX=d ^
-DLIBXML2_LIBRARIES="" -DLIBXML2_INCLUDE_DIR="" -DPCRE_INCLUDE_DIR="" -DPCRE_LIBRARIES=""
IF NOT %ERRORLEVEL%==0 GOTO :Error
REM IF NOT EXIST "%DEPS_DIR%\OpenCOLLADA\%BUILD_DIR%\lib\%DEBUG_OR_RELEASE%\OpenCOLLADASaxFrameworkLoader.lib".
@@ -227,7 +236,6 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
if %IFCOS_USE_OCCT%==FALSE goto :OCE
:OCCT
-set OCCT_VERSION=7.3.0
SET OCCT_VER=V%OCCT_VERSION:.=_%
set OCC_INCLUDE_DIR=%INSTALL_DIR%\opencascade-%OCCT_VERSION%\inc>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
@@ -268,10 +276,11 @@ if not %ERRORLEVEL%==0 (
)
findstr IfcOpenShell "%DEPENDENCY_DIR%\CMakeLists.txt">NUL
if not %ERRORLEVEL%==0 goto :Error
-
+OCCT_USE_STATIC_RUNTIME
cd "%DEPENDENCY_DIR%"
+if NOT "%USE_STATIC_RUNTIME%"=="FALSE" set STATIC_RUNTIME_1=-DOCCT_USE_STATIC_RUNTIME=1
call :RunCMake -DINSTALL_DIR="%INSTALL_DIR%\opencascade-%OCCT_VERSION%" -DBUILD_LIBRARY_TYPE="Static" -DCMAKE_DEBUG_POSTFIX=d ^
- -DBUILD_MODULE_Draw=0 -D3RDPARTY_FREETYPE_DIR="%INSTALL_DIR%\freetype"
+ -DBUILD_MODULE_Draw=0 -D3RDPARTY_FREETYPE_DIR="%INSTALL_DIR%\freetype" %STATIC_RUNTIME_1%
if not %ERRORLEVEL%==0 goto :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OCCT.sln" %BUILD_CFG%
if not %ERRORLEVEL%==0 goto :Error
@@ -303,7 +312,6 @@ echo OCC_LIBRARY_DIR=%OCC_LIBRARY_DIR%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
set DEPENDENCY_NAME=Open CASCADE Community Edition
set DEPENDENCY_DIR=%DEPS_DIR%\oce
-set OCE_VERSION=OCE-0.18
call :GitCloneAndCheckoutRevision https://github.com/tpaviot/oce.git "%DEPENDENCY_DIR%" %OCE_VERSION%
IF NOT %ERRORLEVEL%==0 GOTO :Error
:: Use the oce-win-bundle for OCE's dependencies
@@ -313,8 +321,9 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
cd "%DEPENDENCY_DIR%"
:: NOTE Specify OCE_NO_LIBRARY_VERSION as rc.exe can fail due to long filenames and huge command-line parameter
:: input (more than 32,000 characters). Could maybe try using subst for the build dir to overcome this.
+if NOT "%USE_STATIC_RUNTIME%"=="FALSE" set STATIC_RUNTIME_1=-DOCE_USE_STATIC_MSVC_RUNTIME=1
call :RunCMake -DOCE_BUILD_SHARED_LIB=0 -DOCE_INSTALL_PREFIX="%INSTALL_DIR%\oce" -DOCE_TESTING=0 ^
- -DOCE_NO_LIBRARY_VERSION=1 -DOCE_USE_STATIC_MSVC_RUNTIME=1
+ -DOCE_NO_LIBRARY_VERSION=1 %STATIC_RUNTIME_1%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OCE.sln" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -324,7 +333,6 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
:Python
:: TODO Update to 3.5 when it's released as it will have an option to install debug libraries.
:: NOTE If updating the default Python version, change PY_VER_MAJOR_MINOR accordingly in run-cmake.bat
-set PYTHON_VERSION=3.4.3
IF "%IFCOS_USE_PYTHON2%"=="TRUE" set PYTHON_VERSION=2.7.10
set PY_VER_MAJOR_MINOR=%PYTHON_VERSION:~0,3%
set PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR:.=%
@@ -362,7 +370,6 @@ IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
)
:SWIG
-set SWIG_VERSION=3.0.12
set DEPENDENCY_NAME=SWIG %SWIG_VERSION%
set DEPENDENCY_DIR=N/A
set SWIG_ZIP=swigwin-%SWIG_VERSION%.zip
@@ -406,6 +413,7 @@ git reset --hard
REM There probably need to be quotes here around the filename
powershell -c "get-content %~dp0patches\mpir.patch | %%{$_ -replace \"sdk\",\"%UCRTVersion%\"} | %%{$_ -replace \"fn\",\"lib_mpir_cxx\"}" | git apply --unidiff-zero
powershell -c "get-content %~dp0patches\mpir.patch | %%{$_ -replace \"sdk\",\"%UCRTVersion%\"} | %%{$_ -replace \"fn\",\"lib_mpir_gc\"}" | git apply --unidiff-zero
+if NOT "%USE_STATIC_RUNTIME%"=="FALSE" git apply "%~dp0patches\mpir_runtime.patch"
cd msvc
cd vs%VS_VER:~2,2%
call .\msbuild.bat gc LIB %VS_PLATFORM% Release
@@ -421,16 +429,8 @@ call :GitCloneAndCheckoutRevision https://github.com/BrianGladman/mpfr.git "%DEP
IF NOT %ERRORLEVEL%==0 GOTO :Error
cd "%DEPENDENCY_DIR%"
git reset --hard
-for /f "delims=|" %%f in ('dir /s/b build.vc15\*.vcxproj') do (
- set "full=%%f"
- set rel=!full:*%DEPENDENCY_DIR%=!
- set relnix=!rel:\=/!
- powershell -c "get-content %~dp0patches\mpfr.patch | %%{$_ -replace \"sdk\",\"%UCRTVersion%\"} | %%{$_ -replace \"fn\",\"!relnix!\"}" | git apply --unidiff-zero
- git diff --exit-code -- %%f
- IF !ERRORLEVEL!==0 (
- powershell -c "get-content %~dp0patches\mpfr2.patch | %%{$_ -replace \"sdk\",\"%UCRTVersion%\"} | %%{$_ -replace \"fn\",\"!relnix!\"}" | git apply --unidiff-zero
- )
-)
+powershell -c "get-content %~dp0patches\mpfr.patch | %%{$_ -replace \"sdk\",\"%UCRTVersion%\"}" | git apply --unidiff-zero
+if NOT "%USE_STATIC_RUNTIME%"=="FALSE" git apply "%~dp0patches\mpfr_runtime.patch"
call :BuildSolution "%DEPENDENCY_DIR%\build.vc15\lib_mpfr.sln" %DEBUG_OR_RELEASE% lib_mpfr
IF NOT %ERRORLEVEL%==0 GOTO :Error
IF NOT EXIST "%INSTALL_DIR%\mpfr". mkdir "%INSTALL_DIR%\mpfr"
@@ -438,19 +438,20 @@ copy lib\%VS_PLATFORM%\Release\* "%INSTALL_DIR%\mpfr"
IF NOT %ERRORLEVEL%==0 GOTO :Error
:cgal
-set DEPENDENCY_NAME=mpfr
+set DEPENDENCY_NAME=cgal
set DEPENDENCY_DIR=%DEPS_DIR%\cgal
call :GitCloneAndCheckoutRevision https://github.com/CGAL/cgal.git "%DEPENDENCY_DIR%" releases/CGAL-4.13.1
IF NOT %ERRORLEVEL%==0 GOTO :Error
cd "%DEPENDENCY_DIR%"
+git reset --hard
+git apply "%~dp0patches\cgal_no_zlib.patch"
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\cgal" ^
-DBOOST_ROOT="%DEPS_DIR%\boost_%BOOST_VER%" ^
-DGMP_INCLUDE_DIR="%INSTALL_DIR%\mpir" ^
-DGMP_LIBRARIES="%INSTALL_DIR%\mpir\mpir.lib" ^
-DMPFR_INCLUDE_DIR="%INSTALL_DIR%\mpfr" ^
-DMPFR_LIBRARIES="%INSTALL_DIR%\mpfr\mpfr.lib" ^
- -DCGAL_BUILD_SHARED_LIBS=Off ^
- -DBUILD_SHARED_LIBS=Off ^
+ -DBUILD_SHARED_LIBS=On ^
-DBOOST_LIBRARYDIR="%DEPS_DIR%\boost_%BOOST_VER%\stage\vs%VS_VER%-%VS_PLATFORM%\lib"
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\CGAL.sln" %BUILD_CFG%
diff --git a/win/patches/V7_3_0.patch b/win/patches/V7_3_0.patch
index efc9154b75..637c8c5de7 100644
--- a/win/patches/V7_3_0.patch
+++ b/win/patches/V7_3_0.patch
@@ -27,7 +27,7 @@ index 09da18d38..a07b9cf74 100644
+# set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
+# set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
+
-+if (MSVC)
++if (OCCT_USE_STATIC_RUNTIME AND MSVC)
+ foreach(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
+ CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
diff --git a/win/patches/cgal_no_zlib.patch b/win/patches/cgal_no_zlib.patch
new file mode 100644
index 0000000000..1b24a17e19
--- /dev/null
+++ b/win/patches/cgal_no_zlib.patch
@@ -0,0 +1,13 @@
+diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake
+index 8ac856d037..742fa8df69 100644
+--- a/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake
++++ b/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake
+@@ -23,7 +23,7 @@ set(CGAL_SetupCGAL_ImageIODependencies_included TRUE)
+ # Used Modules
+ # ^^^^^^^^^^^^
+ # - :module:`FindZLIB`
+-find_package( ZLIB )
++# find_package( ZLIB )
+
+ define_property(TARGET PROPERTY CGAL_TARGET_USES_ZLIB
+ BRIEF_DOCS "Tells if the target uses ZLIB as a dependency"
diff --git a/win/patches/mpfr.patch b/win/patches/mpfr.patch
index 0ca9f4f15b..32a5520021 100644
--- a/win/patches/mpfr.patch
+++ b/win/patches/mpfr.patch
@@ -1,5 +1,5 @@
---- afn
-+++ bfn
-@@ -26 +26 @@
+--- a/build.vc15/lib_mpfr/lib_mpfr.vcxproj
++++ a/build.vc15/lib_mpfr/lib_mpfr.vcxproj
+@@ -25 +25 @@
- 10.0.17134.0
+ sdk
diff --git a/win/patches/mpfr_runtime.patch b/win/patches/mpfr_runtime.patch
new file mode 100644
index 0000000000..1f3df90d82
--- /dev/null
+++ b/win/patches/mpfr_runtime.patch
@@ -0,0 +1,8 @@
+--- a/build.vc15/lib_mpfr/lib_mpfr.vcxproj
++++ a/build.vc15/lib_mpfr/lib_mpfr.vcxproj
+@@ -148 +148 @@
+- MultiThreaded
++ MultiThreadedDLL
+@@ -179 +179 @@
+- MultiThreaded
++ MultiThreadedDLL
diff --git a/win/patches/mpir.patch b/win/patches/mpir.patch
new file mode 100644
index 0000000000..0bbb105617
--- /dev/null
+++ b/win/patches/mpir.patch
@@ -0,0 +1,7 @@
+diff --git a/msvc/vs17/fn/fn.vcxproj b/msvc/vs17/fn/fn.vcxproj
+index d8d87f8f..e543adc8 100644
+--- a/msvc/vs17/fn/fn.vcxproj
++++ b/msvc/vs17/fn/fn.vcxproj
+@@ -25 +25 @@
+- 10.0.17134.0
++ sdk
diff --git a/win/patches/mpir_runtime.patch b/win/patches/mpir_runtime.patch
new file mode 100644
index 0000000000..abb5f0bc86
--- /dev/null
+++ b/win/patches/mpir_runtime.patch
@@ -0,0 +1,13 @@
+diff --git a/msvc/mpir_release_lib.props b/msvc/mpir_release_lib.props
+index d46f9649..832c6937 100644
+--- a/msvc/mpir_release_lib.props
++++ b/msvc/mpir_release_lib.props
+@@ -9,7 +9,7 @@
+
+
+ $(IntDir)du\m\my\%(RelativeDir)
+- MultiThreaded
++ MultiThreadedDLL
+ $(TargetDir)$(TargetName).pdb
+
+