forked from solstice/solstice
Output ground files as executable
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
#include <groundvm.h>
|
#include <groundvm.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -56,8 +57,9 @@ int main(int argc, char** argv) {
|
|||||||
if (!outputFile) {
|
if (!outputFile) {
|
||||||
std::cout << "Failed to write to " << args.output.value().value << "\n";
|
std::cout << "Failed to write to " << args.output.value().value << "\n";
|
||||||
}
|
}
|
||||||
outputFile << result;
|
outputFile << "#!/usr/bin/env ground\n" << result;
|
||||||
outputFile.close();
|
outputFile.close();
|
||||||
|
system(std::string("chmod +x " + args.output.value().value).c_str());
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (args.outputtype.value().value == "native") {
|
} else if (args.outputtype.value().value == "native") {
|
||||||
std::string assembly(groundCompileProgram(&program));
|
std::string assembly(groundCompileProgram(&program));
|
||||||
|
|||||||
Reference in New Issue
Block a user