2016-01-27 06:40:11 +08:00
|
|
|
#pragma once
|
|
|
|
|
2016-02-08 05:56:52 +08:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "utils/string/join.hpp"
|
|
|
|
|
2016-01-27 06:40:11 +08:00
|
|
|
class CodeCompiler
|
|
|
|
{
|
2016-02-08 05:56:52 +08:00
|
|
|
public:
|
|
|
|
void compile(const std::string& in_file, const std::string& out_file)
|
|
|
|
{
|
|
|
|
auto compile_command = utils::prints(
|
|
|
|
"clang++",
|
|
|
|
"-std=c++1y",
|
|
|
|
in_file,
|
|
|
|
"-o", out_file,
|
|
|
|
"-I../",
|
|
|
|
"-shared -fPIC"
|
|
|
|
);
|
|
|
|
system(compile_command.c_str());
|
|
|
|
}
|
2016-01-27 06:40:11 +08:00
|
|
|
};
|