From 7fdd291c91eb89801bc6dd0ce998b9d3b0d92d10 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 3 Nov 2011 17:30:16 +0000 Subject: llvm-config: Start stubbing out a C++ version of llvm-config (as llvm-config-2, for now). - Mostly complete except for the data that needs to come from the build system or the dependencies. - Has some small improvements from current llvm-config: o Uses TargetRegistry directly to get some information. o Designed to work correctly when used from a CMake build tree (relatively untested currently) (although pcc fixed this recently for old llvm-config). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143616 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-config-2/llvm-config.cpp | 259 ++++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 tools/llvm-config-2/llvm-config.cpp (limited to 'tools/llvm-config-2/llvm-config.cpp') diff --git a/tools/llvm-config-2/llvm-config.cpp b/tools/llvm-config-2/llvm-config.cpp new file mode 100644 index 0000000000..35bda5026f --- /dev/null +++ b/tools/llvm-config-2/llvm-config.cpp @@ -0,0 +1,259 @@ +//===-- llvm-config.cpp - LLVM project configuration utility --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// 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/ADT/StringRef.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Config/config.h" +#include "llvm/Config/llvm-config.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/TargetRegistry.h" +#include "llvm/Support/raw_ostream.h" +#include +#include + +using namespace llvm; + +// FIXME: Need to get various bits of build time information. +const char LLVM_SRC_ROOT[] = "FIXME"; +const char LLVM_OBJ_ROOT[] = "FIXME"; +const char LLVM_CPPFLAGS[] = "FIXME"; +const char LLVM_CFLAGS[] = "FIXME"; +const char LLVM_LDFLAGS[] = "FIXME"; +const char LLVM_CXXFLAGS[] = "FIXME"; +const char LLVM_BUILDMODE[] = "FIXME"; +const char LLVM_SYSTEM_LIBS[] = "FIXME"; + +// FIXME: Include component table. +struct AvailableComponent { + const char *Name; +} AvailableComponents[1] = {}; +unsigned NumAvailableComponents = 0; + +void ComputeLibsForComponents(const std::vector &Components, + std::vector &RequiredLibs) { + // FIXME: Implement. + RequiredLibs = Components; +} + +/* *** */ + +void usage() { + errs() << "\ +usage: llvm-config