From 1195f9307c425ed28075a17671c13676b65f4a43 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 3 Feb 2020 14:51:43 +0200 Subject: Add header/library search paths from compiler mode to sys_*_dirs --- libbuild2/cc/guess.cxx | 63 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 21 deletions(-) (limited to 'libbuild2/cc/guess.cxx') diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx index 182a997..b63765f 100644 --- a/libbuild2/cc/guess.cxx +++ b/libbuild2/cc/guess.cxx @@ -1353,17 +1353,29 @@ namespace build2 << "' to runtime version" << endf; } + void + msvc_extract_header_search_dirs (const strings&, dir_paths&); // msvc.cxx + + void + msvc_extract_library_search_dirs (const strings&, dir_paths&); // msvc.cxx + // Return the MSVC system header search paths (i.e., what the Visual - // Studio command prompt puts into INCLUDE). + // Studio command prompt puts into INCLUDE) including any paths from the + // compiler mode and their count. // // Note that currently we don't add any ATL/MFC or WinRT paths (but could // do that probably first checking if they exist/empty). // - static dir_paths - msvc_inc (const msvc_info& mi) + static pair + msvc_inc (const msvc_info& mi, const strings& mo) { dir_paths r; + // Extract /I paths from the compiler mode. + // + msvc_extract_header_search_dirs (mo, r); + size_t rn (r.size ()); + r.push_back (dir_path (mi.msvc_dir) /= "include"); // This path structure only appeared in Platform SDK 10 (if anyone wants @@ -1379,30 +1391,39 @@ namespace build2 r.push_back (dir_path (d) /= "um" ); } - return r; + return make_pair (move (r), rn); } // Return the MSVC system module search paths (i.e., what the Visual - // Studio command prompt puts into IFCPATH). + // Studio command prompt puts into IFCPATH) including any paths from the + // compiler mode and their count. // - static dir_paths - msvc_mod (const msvc_info& mi, const char* cpu) + static pair + msvc_mod (const msvc_info& mi, const strings&, const char* cpu) { + //@@ TODO: mode. + dir_paths r; r.push_back ((dir_path (mi.msvc_dir) /= "ifc") /= cpu); - return r; + return make_pair (move (r), size_t (0)); } // Return the MSVC system library search paths (i.e., what the Visual - // Studio command prompt puts into LIB). + // Studio command prompt puts into LIB) including any paths from the + // compiler mode and their count. // - static dir_paths - msvc_lib (const msvc_info& mi, const char* cpu) + static pair + msvc_lib (const msvc_info& mi, const strings& mo, const char* cpu) { dir_paths r; + // Extract /LIBPATH paths from the compiler mode. + // + msvc_extract_library_search_dirs (mo, r); + size_t rn (r.size ()); + r.push_back ((dir_path (mi.msvc_dir) /= "lib") /= cpu); // This path structure only appeared in Platform SDK 10 (if anyone wants @@ -1417,7 +1438,7 @@ namespace build2 r.push_back ((dir_path (d) /= "um" ) /= cpu); } - return r; + return make_pair (move (r), rn); } // Return the MSVC binutils search paths (i.e., what the Visual Studio @@ -1452,7 +1473,7 @@ namespace build2 const path& xc, const string* xv, const string* xt, - const strings&, + const strings& x_mo, const strings*, const strings*, const strings*, const strings*, const strings*, const strings*, @@ -1616,18 +1637,18 @@ namespace build2 // running out of the Visual Studio command prompt and will have to // supply PATH/INCLUDE/LIB/IFCPATH equivalents ourselves. // - optional lib_dirs; - optional inc_dirs; - optional mod_dirs; + optional> lib_dirs; + optional> inc_dirs; + optional> mod_dirs; string bpat; if (const msvc_info* mi = static_cast (gr.info.get ())) { const char* cpu (msvc_cpu (target_triplet (t).cpu)); - lib_dirs = msvc_lib (*mi, cpu); - inc_dirs = msvc_inc (*mi); - mod_dirs = msvc_mod (*mi, cpu); + lib_dirs = msvc_lib (*mi, x_mo, cpu); + inc_dirs = msvc_inc (*mi, x_mo); + mod_dirs = msvc_mod (*mi, x_mo, cpu); bpat = msvc_bin (*mi, cpu); } @@ -2291,7 +2312,7 @@ namespace build2 // For Clang on Windows targeting MSVC we remap the target to match // MSVC's. // - optional lib_dirs; + optional> lib_dirs; string bpat; if (tt.system == "windows-msvc") @@ -2333,7 +2354,7 @@ namespace build2 // to extract this from Clang and -print-search-paths would have been // the natural way for Clang to report it. But no luck. // - lib_dirs = msvc_lib (mi, cpu); + lib_dirs = msvc_lib (mi, x_mo, cpu); // Binutils search paths. // -- cgit v1.1