Last active
August 29, 2015 14:08
-
-
Save UplinkCoder/7481cd40aae352e2cb0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
import std.string; | |
void main() { | |
getLibString().writeLibs(); | |
} | |
string getLibString(string p_llvmConfig="llvm-config") { | |
import std.process; | |
string llvmConfig = escapeShellFileName(p_llvmConfig); | |
return std.process.executeShell(llvmConfig ~ " --libs")[1]; | |
} | |
void writeLibs(string libString, File outs=stdout) { | |
outs.write(`"libs" : `); | |
foreach (libs;libString.split("-l").split(" ")) { | |
outs.write ("["); | |
foreach(lib;libs) { | |
if (lib.chop != "") outs.write('"',lib.chop,'"',','); | |
} | |
outs.write(`"z","pthread","ncurses","stdc++","dl"`); | |
outs.writeln("],"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment