Fix library path calculation on non Windows systems

to include the install directories. (Brendan Simon)
This commit is contained in:
steve 2001-06-15 05:14:21 +00:00
parent 1e9a54d134
commit b75221e9bf
1 changed files with 29 additions and 21 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: main.c,v 1.14 2001/06/12 03:53:10 steve Exp $" #ident "$Id: main.c,v 1.15 2001/06/15 05:14:21 steve Exp $"
#endif #endif
const char HELP[] = const char HELP[] =
@ -74,9 +74,9 @@ extern const char*optarg;
# include "globals.h" # include "globals.h"
#ifdef __MINGW32__ #ifdef __MINGW32__
const char *sep = "\\"; const char sep = '\\';
#else #else
const char *sep = "/"; const char sep = '/';
#endif #endif
const char*base = IVL_ROOT; const char*base = IVL_ROOT;
@ -206,10 +206,9 @@ static int t_vvm(char*cmd, unsigned ncmd)
} }
} }
sprintf(tmp, "%s " RDYNAMIC " -s -fno-exceptions -o %s -I%s%s%s " sprintf(tmp, "%s " RDYNAMIC " -s -fno-exceptions -o %s -I%s%c%s "
"-L%s%s%s %s.cc -lvvm -lvpip %s", CXX, opath, ivl_install_dir, "-L%s%c%s %s.cc -lvvm -lvpip %s", CXX, opath, ivl_install_dir,
sep, "include", ivl_install_dir, sep, "lib", opath, DLLIB); sep, "include", ivl_install_dir, sep, "lib", opath, DLLIB);
if (verbose_flag) if (verbose_flag)
printf("compile: %s\n", tmp); printf("compile: %s\n", tmp);
@ -234,7 +233,7 @@ static int t_xnf(char*cmd, unsigned ncmd)
{ {
int rc; int rc;
sprintf(tmp, " | %s%sepivl %s -o %s -txnf -Fcprop -Fsynth -Fsyn-rules " sprintf(tmp, " | %s%civl %s -o %s -txnf -Fcprop -Fsynth -Fsyn-rules "
"-Fnodangle -Fxnfio", base, sep,warning_flags, opath); "-Fnodangle -Fxnfio", base, sep,warning_flags, opath);
rc = strlen(tmp); rc = strlen(tmp);
@ -451,20 +450,25 @@ int main(int argc, char **argv)
return 1; return 1;
} }
#ifdef __MINGW32__ /* Calculate the install directory.
** This could be passed directly from the Makefile.
** Is it just the $prefix option to configure?
**/
{ {
static char basepath[1024],*s; char * s;
GetModuleFileName(NULL,basepath,1024); #ifdef __MINGW32__
/* Get to the end. Search back twice for backslashes */ static char basepath[1024];
s = basepath + strlen(basepath); GetModuleFileName(NULL,basepath,1024);
while (*s != '\\') s--; s--; base = basepath;
while (*s != '\\') s--; #endif
*s = '\0'; /* truncate last 2 directories */
strcpy(ivl_install_dir, basepath); strncpy(ivl_install_dir,base,MAXSIZE);
strcpy(s,"\\lib\\ivl"); s = ivl_install_dir + strlen(ivl_install_dir);
base = basepath; while (*s != sep) s--;
s--;
while (*s != sep) s--;
*s = NULL;
} }
#endif
/* Load the iverilog.conf file to get our substitution /* Load the iverilog.conf file to get our substitution
strings. */ strings. */
@ -474,7 +478,7 @@ int main(int argc, char **argv)
if (config_path) { if (config_path) {
strcpy(path, config_path); strcpy(path, config_path);
} else { } else {
sprintf(path, "%s%siverilog.conf", base,sep); sprintf(path, "%s%civerilog.conf", base,sep);
} }
fd = fopen(path, "r"); fd = fopen(path, "r");
if (fd == 0) { if (fd == 0) {
@ -487,7 +491,7 @@ int main(int argc, char **argv)
/* Start building the preprocess command line. */ /* Start building the preprocess command line. */
sprintf(tmp, "%s%sivlpp %s%s", base,sep, sprintf(tmp, "%s%civlpp %s%s", base,sep,
verbose_flag?" -v":"", verbose_flag?" -v":"",
e_flag?"":" -L"); e_flag?"":" -L");
@ -600,6 +604,10 @@ int main(int argc, char **argv)
/* /*
* $Log: main.c,v $ * $Log: main.c,v $
* Revision 1.15 2001/06/15 05:14:21 steve
* Fix library path calculation on non Windows systems
* to include the install directories. (Brendan Simon)
*
* Revision 1.14 2001/06/12 03:53:10 steve * Revision 1.14 2001/06/12 03:53:10 steve
* Change the VPI call process so that loaded .vpi modules * Change the VPI call process so that loaded .vpi modules
* use a function table instead of implicit binding. * use a function table instead of implicit binding.