llvm/llvm/tools/llvm-config/llvm-config.cpp

//===-- llvm-config.cpp - LLVM project configuration utility --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This tool encapsulates information about an LLVM project configuration for
// use by other project's build environments (to determine installed path,
// available features, required libraries, etc.).
//
// Note that although this tool *may* be used by some parts of LLVM's build
// itself (i.e., the Makefiles use it to compute required libraries when linking
// tools), this tool is primarily designed to support external projects.
//
//===----------------------------------------------------------------------===//

#include "llvm/Config/llvm-config.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/config.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <cstdlib>
#include <set>
#include <unordered_set>
#include <vector>

usingnamespacellvm;

// Include the build time variables we can report to the user. This is generated
// at build time from the BuildVariables.inc.in file by the build system.
#include "BuildVariables.inc"

// Include the component table. This creates an array of struct
// AvailableComponent entries, which record the component name, library name,
// and required components for all of the available libraries.
//
// Not all components define a library, we also use "library groups" as a way to
// create entries for pseudo groups like x86 or all-targets.
#include "LibraryDependencies.inc"

// Built-in extensions also register their dependencies, but in a separate file,
// later in the process.
#include "ExtensionDependencies.inc"

// LinkMode determines what libraries and flags are returned by llvm-config.
enum LinkMode {};

/// Traverse a single component adding to the topological ordering in
/// \arg RequiredLibs.
///
/// \param Name - The component to traverse.
/// \param ComponentMap - A prebuilt map of component names to descriptors.
/// \param VisitedComponents [in] [out] - The set of already visited components.
/// \param RequiredLibs [out] - The ordered list of required
/// libraries.
/// \param GetComponentNames - Get the component names instead of the
/// library name.
static void VisitComponent(const std::string &Name,
                           const StringMap<AvailableComponent *> &ComponentMap,
                           std::set<AvailableComponent *> &VisitedComponents,
                           std::vector<std::string> &RequiredLibs,
                           bool IncludeNonInstalled, bool GetComponentNames,
                           const std::function<std::string(const StringRef &)>
                               *GetComponentLibraryPath,
                           std::vector<std::string> *Missing,
                           const std::string &DirSep) {}

/// Compute the list of required libraries for a given list of
/// components, in an order suitable for passing to a linker (that is, libraries
/// appear prior to their dependencies).
///
/// \param Components - The names of the components to find libraries for.
/// \param IncludeNonInstalled - Whether non-installed components should be
/// reported.
/// \param GetComponentNames - True if one would prefer the component names.
static std::vector<std::string> ComputeLibsForComponents(
    const std::vector<StringRef> &Components, bool IncludeNonInstalled,
    bool GetComponentNames, const std::function<std::string(const StringRef &)>
                                *GetComponentLibraryPath,
    std::vector<std::string> *Missing, const std::string &DirSep) {}

/* *** */

static void usage(bool ExitWithFailure = true) {}

/// Compute the path to the main executable.
std::string GetExecutablePath(const char *Argv0) {}

/// Expand the semi-colon delimited LLVM_DYLIB_COMPONENTS into
/// the full list of components.
std::vector<std::string> GetAllDyLibComponents(const bool IsInDevelopmentTree,
                                               const bool GetComponentNames,
                                               const std::string &DirSep) {}

int main(int argc, char **argv) {}