[pkg-d-commits] [ldc] 52/95: Don't set up MSVC environment *after* locating tools

Matthias Klumpp mak at moszumanska.debian.org
Thu Jul 13 20:54:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.3.0-beta1
in repository ldc.

commit ab85d209ab0b85c0082b653a522b01242bf6e7e2
Author: Martin <noone at nowhere.com>
Date:   Tue Mar 14 00:31:35 2017 +0100

    Don't set up MSVC environment *after* locating tools
    
    And warn if no Visual C++ installation is detected, similar to the now
    suppressed warning issued by the batch file.
---
 driver/linker.cpp | 18 +++++++++---------
 driver/tool.cpp   |  9 ++++++++-
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/driver/linker.cpp b/driver/linker.cpp
index 114023a..39297aa 100644
--- a/driver/linker.cpp
+++ b/driver/linker.cpp
@@ -492,6 +492,10 @@ static int linkObjToBinaryGcc(bool sharedLib, bool fullyStatic) {
 static int linkObjToBinaryMSVC(bool sharedLib) {
   Logger::println("*** Linking executable ***");
 
+#ifdef _WIN32
+  windows::setupMsvcEnvironment();
+#endif
+
   const std::string tool = "link.exe";
 
   // build arguments
@@ -592,10 +596,6 @@ static int linkObjToBinaryMSVC(bool sharedLib) {
   }
   logstr << "\n"; // FIXME where's flush ?
 
-#ifdef _WIN32
-  windows::setupMsvcEnvironment();
-#endif
-
   // try to call linker
   return executeToolAndWait(tool, args, global.params.verbose);
 }
@@ -630,6 +630,11 @@ int createStaticLibrary() {
   if (useInternalArchiver) {
     tool = isTargetMSVC ? "llvm-lib.exe" : "llvm-ar";
   } else {
+#ifdef _WIN32
+    if (isTargetMSVC)
+      windows::setupMsvcEnvironment();
+#endif
+
     tool = getProgram(isTargetMSVC ? "lib.exe" : "ar", &ar);
   }
 
@@ -708,11 +713,6 @@ int createStaticLibrary() {
   }
 #endif
 
-#ifdef _WIN32
-  if (isTargetMSVC)
-    windows::setupMsvcEnvironment();
-#endif
-
   // try to call archiver
   return executeToolAndWait(tool, args, global.params.verbose);
 }
diff --git a/driver/tool.cpp b/driver/tool.cpp
index f9075dd..8d54b21 100644
--- a/driver/tool.cpp
+++ b/driver/tool.cpp
@@ -209,7 +209,7 @@ int executeAndWait(const char *commandLine) {
   return exitCode;
 }
 
-bool setupMsvcEnvironment() {
+bool setupMsvcEnvironmentImpl() {
   if (getenv("VSINSTALLDIR"))
     return true;
 
@@ -311,6 +311,13 @@ bool setupMsvcEnvironment() {
   return haveVsInstallDir;
 }
 
+bool setupMsvcEnvironment() {
+  const bool success = setupMsvcEnvironmentImpl();
+  if (!success)
+    warning(Loc(), "no Visual C++ installation detected");
+  return success;
+}
+
 } // namespace windows
 
 #endif // _WIN32

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list