diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-27 22:58:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-27 22:58:59 +0000 |
commit | 5247f17e23ea41814f194d29d0e896842277472e (patch) | |
tree | d41fd818fe0d1415ec6cc36636b853dac7a88a78 /tools | |
parent | 007b9f83f151ac7ac08ef0309febb8d5348c30cf (diff) | |
download | external_llvm-5247f17e23ea41814f194d29d0e896842277472e.zip external_llvm-5247f17e23ea41814f194d29d0e896842277472e.tar.gz external_llvm-5247f17e23ea41814f194d29d0e896842277472e.tar.bz2 |
Add support for frameworks. Patch by Shantonu Sen!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-ld/llvm-ld.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 4f888aa..9d0d93f 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -55,10 +55,18 @@ static cl::list<std::string> LibPaths("L", cl::Prefix, cl::desc("Specify a library search path"), cl::value_desc("directory")); +static cl::list<std::string> FrameworkPaths("F", cl::Prefix, + cl::desc("Specify a framework search path"), + cl::value_desc("directory")); + static cl::list<std::string> Libraries("l", cl::Prefix, cl::desc("Specify libraries to link to"), cl::value_desc("library prefix")); +static cl::list<std::string> Frameworks("framework", + cl::desc("Specify frameworks to link to"), + cl::value_desc("framework")); + // Options to control the linking, optimization, and code gen processes static cl::opt<bool> LinkAsLibrary("link-as-library", cl::desc("Link the .bc files together as a library, not an executable")); @@ -287,6 +295,8 @@ static int GenerateCFile(const std::string &OutputFile, /// OutputFilename - The name of the file to generate. /// NativeLinkItems - The native libraries, files, code with which to link /// LibPaths - The list of directories in which to find libraries. +/// FrameworksPaths - The list of directories in which to find frameworks. +/// Frameworks - The list of frameworks (dynamic libraries) /// gcc - The pathname to use for GGC. /// envp - A copy of the process's current environment. /// @@ -331,10 +341,12 @@ static int GenerateNative(const std::string &OutputFilename, args.push_back(OutputFilename); args.push_back(InputFilename); - // Add in the library paths + // Add in the library and framework paths for (unsigned index = 0; index < LibPaths.size(); index++) { - args.push_back("-L"); - args.push_back(LibPaths[index]); + args.push_back("-L" + LibPaths[index]); + } + for (unsigned index = 0; index < FrameworkPaths.size(); index++) { + args.push_back("-F" + FrameworkPaths[index]); } // Add the requested options @@ -350,6 +362,11 @@ static int GenerateNative(const std::string &OutputFilename, args.push_back(LinkItems[index].first); } + // Add in frameworks to link. + for (unsigned index = 0; index < Frameworks.size(); index++) { + args.push_back("-framework"); + args.push_back(Frameworks[index]); + } // Now that "args" owns all the std::strings for the arguments, call the c_str // method to get the underlying string array. We do this game so that the |