• Home
  • Raw
  • Download

Lines Matching +full:shared +full:- +full:llvm

1 //===-- llvm-config.cpp - LLVM project configuration utility --------------===//
3 // The LLVM Compiler Infrastructure
8 //===----------------------------------------------------------------------===//
10 // This tool encapsulates information about an LLVM project configuration for
14 // Note that although this tool *may* be used by some parts of LLVM's build
18 //===----------------------------------------------------------------------===//
20 #include "llvm/ADT/STLExtras.h"
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/ADT/Triple.h"
24 #include "llvm/ADT/Twine.h"
25 #include "llvm/Config/config.h"
26 #include "llvm/Config/llvm-config.h"
27 #include "llvm/Support/FileSystem.h"
28 #include "llvm/Support/Path.h"
29 #include "llvm/Support/raw_ostream.h"
35 using namespace llvm;
46 // create entries for pseudo groups like x86 or all-targets.
49 // LinkMode determines what libraries and flags are returned by llvm-config.
68 /// \param Name - The component to traverse.
69 /// \param ComponentMap - A prebuilt map of component names to descriptors.
70 /// \param VisitedComponents [in] [out] - The set of already visited components.
71 /// \param RequiredLibs [out] - The ordered list of required
73 /// \param GetComponentNames - Get the component names instead of the
102 // Only include non-installed components if requested. in VisitComponent()
103 if (!AC->IsInstalled && !IncludeNonInstalled) in VisitComponent()
107 for (unsigned i = 0; AC->RequiredLibraries[i]; ++i) { in VisitComponent()
108 VisitComponent(AC->RequiredLibraries[i], ComponentMap, VisitedComponents, in VisitComponent()
119 if (AC->Library) { in VisitComponent()
121 std::string path = (*GetComponentLibraryPath)(AC->Library); in VisitComponent()
126 Missing->push_back(path); in VisitComponent()
128 RequiredLibs.push_back(AC->Library); in VisitComponent()
136 /// \param Components - The names of the components to find libraries for.
137 /// \param IncludeNonInstalled - Whether non-installed components should be
139 /// \param GetComponentNames - True if one would prefer the component names.
152 ComponentMap[AC->Name] = AC; in ComputeLibsForComponents()
162 llvm::errs() << "llvm-config: unknown component name: " << Components[i] in ComputeLibsForComponents()
183 usage: llvm-config <OPTION>... [<COMPONENT>...]\n\ in usage()
186 LLVM. Typically called from 'configure' scripts. Examples:\n\ in usage()
187 llvm-config --cxxflags\n\ in usage()
188 llvm-config --ldflags\n\ in usage()
189 llvm-config --libs engine bcreader scalaropts\n\ in usage()
192 --version Print LLVM version.\n\ in usage()
193 --prefix Print the installation prefix.\n\ in usage()
194 --src-root Print the source root LLVM was built from.\n\ in usage()
195 --obj-root Print the object root used to build LLVM.\n\ in usage()
196 --bindir Directory containing LLVM executables.\n\ in usage()
197 --includedir Directory containing LLVM headers.\n\ in usage()
198 --libdir Directory containing LLVM libraries.\n\ in usage()
199 --cppflags C preprocessor flags for files that include LLVM headers.\n\ in usage()
200 --cflags C compiler flags for files that include LLVM headers.\n\ in usage()
201 --cxxflags C++ compiler flags for files that include LLVM headers.\n\ in usage()
202 --ldflags Print Linker flags.\n\ in usage()
203 --system-libs System Libraries needed to link against LLVM components.\n\ in usage()
204 --libs Libraries needed to link against LLVM components.\n\ in usage()
205 --libnames Bare library names for in-tree builds.\n\ in usage()
206 --libfiles Fully qualified library filenames for makefile depends.\n\ in usage()
207 --components List of all possible components.\n\ in usage()
208 --targets-built List of all targets currently built.\n\ in usage()
209 --host-target Target triple used to configure LLVM.\n\ in usage()
210 --build-mode Print build mode of LLVM tree (e.g. Debug or Release).\n\ in usage()
211 --assertion-mode Print assertion mode of LLVM tree (ON or OFF).\n\ in usage()
212 --build-system Print the build system used to build LLVM (always cmake).\n\ in usage()
213 --has-rtti Print whether or not LLVM was built with rtti (YES or NO).\n\ in usage()
214 --has-global-isel Print whether or not LLVM was built with global-isel support (YES or NO).\n\ in usage()
215--shared-mode Print how the provided components can be collectively linked (`shared` or `stati… in usage()
216 --link-shared Link the components as shared libraries.\n\ in usage()
217 --link-static Link the component libraries statically.\n\ in usage()
219 all All LLVM libraries (default).\n\ in usage()
229 return llvm::sys::fs::getMainExecutable(Argv0, P); in GetExecutablePath()
232 /// \brief Expand the semi-colon delimited LLVM_DYLIB_COMPONENTS into
263 // llvm-config is designed to support being run both from a development tree in main()
264 // and from an installed path. We try and auto-detect which case we are in so in main()
269 llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0])); in main()
327 ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include"); in main()
333 ActiveIncludeOption = "-I" + ActiveIncludeDir; in main()
336 /// We only use `shared library` mode in cases where the static library form in main()
381 /// CMake style shared libs, ie each component is in a shared library. in main()
386 (SharedPrefix + "LLVM-" + SharedVersionedExt).str(); in main()
388 // If LLVM_LINK_DYLIB is ON, the single shared library will be returned in main()
389 // for "--libs", etc, if they exist. This behaviour can be overridden with in main()
390 // --link-static or --link-shared. in main()
400 // The shared library does not exist: don't error unless the user in main()
401 // explicitly passes --link-shared. in main()
423 Out = Lib.slice(3, Lib.size() - FromEnd); in main()
432 const bool Shared) { in main() argument
434 if (Shared) { in main()
443 /// Get the full path for a possibly shared component library. in main()
444 auto GetComponentLibraryPath = [&](const StringRef &Name, const bool Shared) { in main() argument
445 auto LibFileName = GetComponentLibraryFileName(Name, Shared); in main()
446 if (Shared) { in main()
457 if (Arg.startswith("-")) { in main()
459 if (Arg == "--version") { in main()
461 } else if (Arg == "--prefix") { in main()
463 } else if (Arg == "--bindir") { in main()
465 } else if (Arg == "--includedir") { in main()
467 } else if (Arg == "--libdir") { in main()
469 } else if (Arg == "--cppflags") { in main()
471 } else if (Arg == "--cflags") { in main()
473 } else if (Arg == "--cxxflags") { in main()
475 } else if (Arg == "--ldflags") { in main()
476 OS << ((HostTriple.isWindowsMSVCEnvironment()) ? "-LIBPATH:" : "-L") in main()
478 } else if (Arg == "--system-libs") { in main()
480 } else if (Arg == "--libs") { in main()
482 } else if (Arg == "--libnames") { in main()
484 } else if (Arg == "--libfiles") { in main()
486 } else if (Arg == "--components") { in main()
492 // Only include non-installed components when in a development tree. in main()
520 } else if (Arg == "--targets-built") { in main()
522 } else if (Arg == "--host-target") { in main()
524 } else if (Arg == "--build-mode") { in main()
526 } else if (Arg == "--assertion-mode") { in main()
532 } else if (Arg == "--build-system") { in main()
534 } else if (Arg == "--has-rtti") { in main()
536 } else if (Arg == "--has-global-isel") { in main()
538 } else if (Arg == "--shared-mode") { in main()
540 } else if (Arg == "--obj-root") { in main()
542 } else if (Arg == "--src-root") { in main()
544 } else if (Arg == "--link-shared") { in main()
546 } else if (Arg == "--link-static") { in main()
560 errs() << "llvm-config: error: " << DyLibName << " is missing\n"; in main()
568 OS << "shared\n"; in main()
591 // Using component shared libraries. in main()
593 errs() << "llvm-config: error: missing: " << Lib << "\n"; in main()
601 << "llvm-config: error: component libraries and shared library\n\n"; in main()
605 errs() << "llvm-config: error: missing: " << Lib << "\n"; in main()
631 OS << "shared\n"; in main()
642 const bool Shared = LinkMode == LinkModeShared; in main() local
644 OS << GetComponentLibraryFileName(Lib, Shared); in main()
646 OS << GetComponentLibraryPath(Lib, Shared); in main()
649 // Elsewhere, if this is a typical library name, include it using -l. in main()
651 OS << GetComponentLibraryPath(Lib, Shared); in main()
656 OS << "-l" << LibName; in main()
659 OS << "-l" << Lib; in main()
679 // Print SYSTEM_LIBS after --libs. in main()
680 // FIXME: Each LLVM component may have its dependent system libs. in main()
684 errs() << "llvm-config: error: components given, but unused\n\n"; in main()