aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv/ghdlsynth.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-08-14 10:51:37 +0200
committerTristan Gingold <tgingold@free.fr>2019-08-14 10:51:37 +0200
commit8010f3f7d6f2488a7bcc8f2c2c7a0ca3fcceb3d4 (patch)
tree7b45b8ef2587d1b764ad2303628f22d00d8a228a /src/ghdldrv/ghdlsynth.adb
parenta7556a720e6ad04b7cb16a75727ad61c83cd5d3d (diff)
downloadghdl-8010f3f7d6f2488a7bcc8f2c2c7a0ca3fcceb3d4.tar.gz
ghdl-8010f3f7d6f2488a7bcc8f2c2c7a0ca3fcceb3d4.tar.bz2
ghdl-8010f3f7d6f2488a7bcc8f2c2c7a0ca3fcceb3d4.zip
ghdlsynth: add command to get libghdl paths.
Diffstat (limited to 'src/ghdldrv/ghdlsynth.adb')
-rw-r--r--src/ghdldrv/ghdlsynth.adb58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/ghdldrv/ghdlsynth.adb b/src/ghdldrv/ghdlsynth.adb
index 87fde5b43..3fd19c2b8 100644
--- a/src/ghdldrv/ghdlsynth.adb
+++ b/src/ghdldrv/ghdlsynth.adb
@@ -25,6 +25,8 @@ with Ghdlmain; use Ghdlmain;
with Options; use Options;
with Errorout;
with Errorout.Console;
+with Version;
+with Default_Paths;
with Libraries;
with Flags;
@@ -261,9 +263,65 @@ package body Ghdlsynth is
end case;
end Perform_Action;
+ function Get_Libghdl_Name return String
+ is
+ Libghdl_Version : String := Version.Ghdl_Ver;
+ begin
+ for I in Libghdl_Version'Range loop
+ if Libghdl_Version (I) = '.' or Libghdl_Version (I) = '-' then
+ Libghdl_Version (I) := '_';
+ end if;
+ end loop;
+ return "libghdl-" & Libghdl_Version
+ & Default_Paths.Shared_Library_Extension;
+ end Get_Libghdl_Name;
+
+ function Get_Libghdl_Path return String is
+ begin
+ if Ghdllocal.Exec_Prefix = null then
+ -- Compute install path (only once).
+ Ghdllocal.Set_Exec_Prefix_From_Program_Name;
+ end if;
+
+ return Ghdllocal.Exec_Prefix.all & Directory_Separator & "lib"
+ & Directory_Separator & Get_Libghdl_Name;
+ end Get_Libghdl_Path;
+
+ function Get_Libghdl_Include_Dir return String is
+ begin
+ -- Compute install path
+ Ghdllocal.Set_Exec_Prefix_From_Program_Name;
+
+ return Ghdllocal.Exec_Prefix.all & Directory_Separator & "include";
+ end Get_Libghdl_Include_Dir;
+
procedure Register_Commands is
begin
Ghdlmain.Register_Command (new Command_Synth);
+ Register_Command
+ (new Command_Str_Disp'
+ (Command_Type with
+ Cmd_Str => new String'
+ ("--libghdl-name"),
+ Help_Str => new String'
+ ("--libghdl-name Display libghdl name"),
+ Disp => Get_Libghdl_Name'Access));
+ Register_Command
+ (new Command_Str_Disp'
+ (Command_Type with
+ Cmd_Str => new String'
+ ("--libghdl-library-path"),
+ Help_Str => new String'
+ ("--libghdl-library-path Display libghdl library path"),
+ Disp => Get_Libghdl_Path'Access));
+ Register_Command
+ (new Command_Str_Disp'
+ (Command_Type with
+ Cmd_Str => new String'
+ ("--libghdl-include-dir"),
+ Help_Str => new String'
+ ("--libghdl-include-dir Display libghdl include directory"),
+ Disp => Get_Libghdl_Include_Dir'Access));
end Register_Commands;
procedure Init_For_Ghdl_Synth is