memgraph/src/query_engine/code_compiler.hpp

30 lines
937 B
C++
Raw Normal View History

#pragma once
#include <string>
#include "utils/string/join.hpp"
// TODO: all libraries have to be compiled in the server compile time
// TODO: generate copile command
class CodeCompiler
{
public:
void compile(const std::string &in_file, const std::string &out_file)
{
auto compile_command =
utils::prints("clang++",
// "-std=c++1y -O2 -DNDEBUG", // compile flags
"-std=c++1y -DDEBUG", // compile flags
in_file, // input file
"-o", out_file, // ouput file
2016-06-27 06:43:28 +08:00
"-I./include", // include paths (TODO: parameter)
"-I./src",
"-I../../libs/fmt",
"-shared -fPIC" // shared library flags
);
2016-02-11 06:34:49 +08:00
// synchronous call
system(compile_command.c_str());
}
};