From 22ef1e52c07f9dae2e3ee9acc4208603e07efd8e Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 5 Dec 2018 10:28:59 -0600 Subject: [PATCH] Allow ML.NET native binaries to work on Windows machines that don't have the VC runtime installed. This allows ML.NET to run on Windows Nano containers. I also ported 2 Unix compile options we are using in core-setup and corefx that were missed when originally creating the ML.NET native build infrastructure. Fix #1823 --- src/Native/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt index 9334b1c45c..0100cc353c 100644 --- a/src/Native/CMakeLists.txt +++ b/src/Native/CMakeLists.txt @@ -18,6 +18,9 @@ if(WIN32) add_compile_options($<$:-DNDEBUG>) add_compile_options($<$:-DNDEBUG>) add_compile_options($<$:/Od>) + add_compile_options($<$:/MTd>) # /MT will static link the VC runtime library, so it doesn't need to be installed on the target machine + add_compile_options($<$:/MT>) + add_compile_options($<$:/MT>) add_compile_options(/guard:cf) add_compile_options(/d2Zi+) # make optimized builds debugging easier add_compile_options(/nologo) # Suppress Startup Banner @@ -62,6 +65,8 @@ if(WIN32) list(APPEND RESOURCES ${CMAKE_SOURCE_DIR}/../../Tools/NativeVersion.rc) else() add_compile_options(-Wno-unused-local-typedef) + add_compile_options(-fPIC) + add_compile_options(-fvisibility=hidden) add_definitions(-Werror) # treat warnings as errors endif()