Do not push empty string as a command argument, it breaks on Linux. (#174)
This commit is contained in:
parent
82d2caa542
commit
b28fcbc745
|
@ -56,6 +56,13 @@ struct Command {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Append a single optional string argument.
|
||||||
|
Command &appendStrOpt(const llvm::Optional<std::string> &arg) {
|
||||||
|
if (arg.hasValue())
|
||||||
|
_args.emplace_back(arg.getValue());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// Append a list of string arguments.
|
// Append a list of string arguments.
|
||||||
Command &appendList(const std::vector<std::string> &args) {
|
Command &appendList(const std::vector<std::string> &args) {
|
||||||
_args.insert(_args.end(), args.begin(), args.end());
|
_args.insert(_args.end(), args.begin(), args.end());
|
||||||
|
@ -218,7 +225,7 @@ void compileModuleToSharedLibrary(
|
||||||
std::string modelObjPath = outputBaseName + ".o";
|
std::string modelObjPath = outputBaseName + ".o";
|
||||||
llvm::FileRemover modelObjRemover(modelObjPath);
|
llvm::FileRemover modelObjRemover(modelObjPath);
|
||||||
|
|
||||||
std::string runtimeDirInclFlag;
|
llvm::Optional<std::string> runtimeDirInclFlag;
|
||||||
if (getEnvVar("RUNTIME_DIR").hasValue())
|
if (getEnvVar("RUNTIME_DIR").hasValue())
|
||||||
runtimeDirInclFlag = "-L" + getEnvVar("RUNTIME_DIR").getValue();
|
runtimeDirInclFlag = "-L" + getEnvVar("RUNTIME_DIR").getValue();
|
||||||
|
|
||||||
|
@ -228,7 +235,7 @@ void compileModuleToSharedLibrary(
|
||||||
.appendStr(modelObjPath)
|
.appendStr(modelObjPath)
|
||||||
.appendStr(constPackObjPath.getValueOr(""))
|
.appendStr(constPackObjPath.getValueOr(""))
|
||||||
.appendList({"-o", outputBaseName + ".so"})
|
.appendList({"-o", outputBaseName + ".so"})
|
||||||
.appendStr(runtimeDirInclFlag)
|
.appendStrOpt(runtimeDirInclFlag)
|
||||||
.appendList({"-lEmbeddedDataLoader", "-lcruntime"})
|
.appendList({"-lEmbeddedDataLoader", "-lcruntime"})
|
||||||
.exec();
|
.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue