Output object file in current directory.

This commit is contained in:
Stefano Sanfilippo 2015-03-07 19:56:47 +01:00
parent 35d3dbce75
commit 3f19125574
2 changed files with 6 additions and 5 deletions

View File

@ -65,7 +65,7 @@ elseif(BISON_VERSION VERSION_LESS 3.0)
endif()
## 3. External components
find_package(Boost 1.48 REQUIRED regex)
find_package(Boost 1.48 REQUIRED regex system filesystem)
find_package(LLVM REQUIRED CONFIG)
add_definitions(

View File

@ -27,6 +27,7 @@
#include <llvm/Support/raw_os_ostream.h>
#include <boost/regex.hpp>
#include <boost/filesystem.hpp>
#include <iostream>
#include <fstream>
@ -53,12 +54,12 @@ int main(int argc, char **argv) {
parser.parse();
boost::regex namere("^(.+)\\.mc$");
std::string outputname;
std::string outputname = boost::filesystem::path(inputname).filename().native();
if (boost::regex_match(inputname, namere)) {
outputname = boost::regex_replace(inputname, namere, "$1.bc");
if (boost::regex_match(outputname, namere)) {
outputname = boost::regex_replace(outputname, namere, "$1.bc");
} else {
outputname = inputname + ".bc";
outputname = outputname + ".bc";
}
if (!program.emit(&emitter)) return 1;