aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2022-03-13 15:30:54 +0100
committertgingold <tgingold@users.noreply.github.com>2022-03-14 07:59:51 +0100
commit55e33158573e38a4c385ca705e26784176d9b508 (patch)
treeb5b1108554f45337cee893353d6b740414607572 /testsuite/gna
parent5015316150af384bd6d26136c43647f0e799cfc8 (diff)
downloadghdl-55e33158573e38a4c385ca705e26784176d9b508.tar.gz
ghdl-55e33158573e38a4c385ca705e26784176d9b508.tar.bz2
ghdl-55e33158573e38a4c385ca705e26784176d9b508.zip
Fix include-dir paths returned by cmdline _again_
--libghdl-include-dir should point at a directory containing a ghdl/ subdirectory while --vpi-include-dir should point right at the ghdl/ subdir.
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/issue2005/test.c9
-rwxr-xr-xtestsuite/gna/issue2005/testsuite.sh21
2 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/gna/issue2005/test.c b/testsuite/gna/issue2005/test.c
new file mode 100644
index 000000000..d958faff7
--- /dev/null
+++ b/testsuite/gna/issue2005/test.c
@@ -0,0 +1,9 @@
+#include <string.h>
+#include <ghdl/synth_gates.h>
+
+void libghdl_init(); // dummy, just to see if finding the library/linking works
+
+int main()
+{
+ libghdl_init();
+}
diff --git a/testsuite/gna/issue2005/testsuite.sh b/testsuite/gna/issue2005/testsuite.sh
new file mode 100755
index 000000000..5cd784bc6
--- /dev/null
+++ b/testsuite/gna/issue2005/testsuite.sh
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+set -x
+
+if c_compiler_is_available; then
+ lib=$("$GHDL" --libghdl-name)
+ lib=${lib#lib} # strip "lib" prefix
+ lib=${lib%.*} # strip .so/.dll suffix
+ lib_path="$("$GHDL" --libghdl-library-path)"
+
+ libdir="$(dirname "$lib_path")"
+ incdir="$("$GHDL" --libghdl-include-dir)"
+
+ $CC -I"$incdir" test.c "$("$GHDL" --libghdl-library-path)"
+ $CC -I"$incdir" -L"$libdir" test.c -l"$lib"
+ rm -f a.out
+fi
+
+echo "Test successful"