aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-12-20 20:46:02 +0100
committerTristan Gingold <tgingold@free.fr>2016-12-20 21:23:39 +0100
commit630e927a1333a1e7450ef067168580aac5192840 (patch)
tree710293b425200a82f745f311ded63e764e65d7d3 /src/ghdldrv
parenta3e5fafb1ee18c56e37b30cce14552d0e143507b (diff)
downloadghdl-630e927a1333a1e7450ef067168580aac5192840.tar.gz
ghdl-630e927a1333a1e7450ef067168580aac5192840.tar.bz2
ghdl-630e927a1333a1e7450ef067168580aac5192840.zip
ghdlvpi: add --vpi-library-dir-unix
Diffstat (limited to 'src/ghdldrv')
-rw-r--r--src/ghdldrv/ghdlvpi.adb38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/ghdldrv/ghdlvpi.adb b/src/ghdldrv/ghdlvpi.adb
index ec6222258..6cdc3a619 100644
--- a/src/ghdldrv/ghdlvpi.adb
+++ b/src/ghdldrv/ghdlvpi.adb
@@ -31,7 +31,6 @@ package body Ghdlvpi is
Is_Unix : constant Boolean := Shared_Library_Extension = ".so";
Is_Darwin : constant Boolean := Shared_Library_Extension = ".dylib";
Is_Windows : constant Boolean := Shared_Library_Extension = ".dll";
- pragma Unreferenced (Is_Windows);
-- Return the include directory.
function Get_Vpi_Include_Dir return String is
@@ -42,7 +41,7 @@ package body Ghdlvpi is
return Ghdllocal.Exec_Prefix.all & Directory_Separator & "include";
end Get_Vpi_Include_Dir;
- -- Return the include directory.
+ -- Return the lib directory.
function Get_Vpi_Lib_Dir return String is
begin
if Ghdllocal.Exec_Prefix = null then
@@ -53,6 +52,32 @@ package body Ghdlvpi is
return Ghdllocal.Exec_Prefix.all & Directory_Separator & "lib";
end Get_Vpi_Lib_Dir;
+ -- Return the lib directory, but unixify the path (for a unix shell in
+ -- windows).
+ function Get_Vpi_Lib_Dir_Unix return String
+ is
+ Res : String := Get_Vpi_Lib_Dir;
+ begin
+ if Is_Windows then
+ -- Convert path separators.
+ for I in Res'Range loop
+ if Res (I) = '\' then
+ Res (I) := '/';
+ end if;
+ end loop;
+ if Res'Length > 2
+ and then (Res (Res'First) in 'a' .. 'z'
+ or else Res (Res'First) in 'A' .. 'Z')
+ and then Res (Res'First + 1) = ':'
+ then
+ Res (Res'First + 1) := '/';
+ return '/' & Res;
+ end if;
+ end if;
+
+ return Res;
+ end Get_Vpi_Lib_Dir_Unix;
+
function Get_Vpi_Cflags return Argument_List
is
Extra_Args : Argument_List (1 .. 2);
@@ -295,6 +320,15 @@ package body Ghdlvpi is
Help_Str => new String'
("--vpi-library-dir Display VPI library directory"),
Disp => Get_Vpi_Lib_Dir'Access));
+ Register_Command
+ (new Command_Vpi_Disp'
+ (Command_Type with
+ Cmd_Str => new String'
+ ("--vpi-library-dir-unix"),
+ Help_Str => new String'
+ ("--vpi-library-dir-unix "
+ & "Display VPI library directory (unix form)"),
+ Disp => Get_Vpi_Lib_Dir_Unix'Access));
end Register_Commands;
end Ghdlvpi;