From 0f28408e8dcfc204737ae46cecf05451bcb81602 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 13 May 2020 12:37:16 -0400 Subject: [PATCH] msbuilds now writes a custom props file to disable 4566 --- src/pch.cpp | 2 -- src/pch.h | 1 - src/tasks/python.cpp | 2 +- src/tools/msbuild.cpp | 25 +++++++++++++++++++++++++ src/tools/tools.h | 2 ++ vs/props.props | 1 + 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/pch.cpp b/src/pch.cpp index 66e32a9..c290acb 100644 --- a/src/pch.cpp +++ b/src/pch.cpp @@ -1,4 +1,2 @@ #include "pch.h" - -#pragma warning(disable: 4566) // character cannot be represented in CP #include diff --git a/src/pch.h b/src/pch.h index 3c9877a..b5ff7c3 100644 --- a/src/pch.h +++ b/src/pch.h @@ -43,7 +43,6 @@ #pragma warning(disable: 4242) // possible loss of data #pragma warning(disable: 4244) // possible loss of data #pragma warning(disable: 4275) // non dll-interface base -#pragma warning(disable: 4566) // character cannot be represented in CP #include diff --git a/src/tasks/python.cpp b/src/tasks/python.cpp index 71a7892..78aabac 100644 --- a/src/tasks/python.cpp +++ b/src/tasks/python.cpp @@ -126,7 +126,7 @@ void python::build_and_install_from_source() .projects({ "python", "pythonw", "python3dll", "select", "pyexpat", "unicodedata", "_queue", "_bz2", "_ssl"}) - .parameters({ + .parameters({ "bz2Dir=" + path_to_utf8(bzip2::source_path()), "zlibDir=" + path_to_utf8(zlib::source_path()), "opensslIncludeDir=" + path_to_utf8(openssl::include_path()), diff --git a/src/tools/msbuild.cpp b/src/tools/msbuild.cpp index 285ba46..7742262 100644 --- a/src/tools/msbuild.cpp +++ b/src/tools/msbuild.cpp @@ -60,6 +60,8 @@ int msbuild::result() const void msbuild::do_run() { + write_custom_props_file(); + // 14.2 to v142 const auto toolset = "v" + replace_all(tools::vs::toolset(), ".", ""); @@ -132,4 +134,27 @@ void msbuild::do_run() execute_and_join(); } +void msbuild::write_custom_props_file() +{ + const fs::path file = sln_.parent_path() / "Directory.Build.props"; + if (fs::exists(file)) + { + cx_->trace(context::generic, "props file {} already exists", file); + return; + } + + const std::string content = R"( + + + + 4566 + + + +)"; + + op::write_text_file(*cx_, file, content); + +} + } // namespace diff --git a/src/tools/tools.h b/src/tools/tools.h index 876ccb0..3d1cc58 100644 --- a/src/tools/tools.h +++ b/src/tools/tools.h @@ -284,6 +284,8 @@ private: std::string platform_; arch arch_; flags_t flags_; + + void write_custom_props_file(); }; diff --git a/vs/props.props b/vs/props.props index 880343c..25421c6 100644 --- a/vs/props.props +++ b/vs/props.props @@ -21,6 +21,7 @@ $(IntDir)fake\%(RelativeDir) _CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING;CURL_STATICLIB;NOMINMAX;%(PreprocessorDefinitions) ..\third-party\include;%(AdditionalIncludeDirectories) + 4566 ..\third-party\lib;%(AdditionalLibraryDirectories)