mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 00:20:40 +03:00
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.
This commit is contained in:
parent
1c70b12e4c
commit
ab85d209ab
2 changed files with 17 additions and 10 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue