diff --git a/vcom/main.cpp b/vcom/main.cpp index c7d337c..9a841a6 100644 --- a/vcom/main.cpp +++ b/vcom/main.cpp @@ -3,6 +3,7 @@ #include #include #include +#include //#include //#define DEBUG_EN DEBUG_EN @@ -149,6 +150,13 @@ int main(int argc, char **argv) return 2; } + // Write temp path to /tmp + ofstream myfile; + myfile.open ("/tmp/workdir-ghdl"); + myfile << tempdir; + myfile.flush(); + myfile.close(); + string cargs = "ghdl -i --ieee=synopsys --warn-no-vital-generic --workdir=" + string(tempdir) + " --work=" + work + " " + vhdl + " 2>&1"; string sargs = "ghdl -s --ieee=synopsys --warn-no-vital-generic --workdir=" + string(tempdir) + " --work=" + work + " " + vhdl + " 2>&1"; diff --git a/vsim/main.cpp b/vsim/main.cpp index 92cb39c..8d0f48a 100644 --- a/vsim/main.cpp +++ b/vsim/main.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #define DEBUG_EN DEBUG_EN @@ -43,10 +44,10 @@ int main(int argc, char **argv) { int i; char tempdir[256] = ""; // Compile dir - if (!getcwd(tempdir, sizeof(tempdir))) { - cerr << "Error getting current working dir!" << endl; - return 1; - } + ifstream myfile; + myfile.open ("/tmp/workdir-ghdl"); + myfile.getline(tempdir, sizeof(tempdir)); + myfile.close(); for (i=1; i < argc; ++i) { if (ISOPT("-gui")) { @@ -99,6 +100,7 @@ int main(int argc, char **argv) { } string cargs = "ghdl -m --ieee=synopsys --warn-no-vital-generic --workdir=" + string(tempdir) + " --work=" + work + " " + top; + if (!run(cargs)) { cerr << "Error: Compilation failed." << endl; }