Le 2015-05-07 18:55, Aaron Watry a écrit :
I'm not sure what the final consensus will be on how to do this, but
FWIW:
Tested-By: Aaron Watry <awa...@gmail.com>

I've tested this with 4 combinations:
no --with-opencl-icd option specified : libOpenCL.so gets installed in
${prefix}/lib
--with-opencl-icd=no : libOpenCL.so gets installed in ${prefix}/lib
--with-opencl-icd=standard : libMesaOpenCL.so installed in
${prefix}/lib, icd in /etc/OpenCL/vendors/mesa.icd
--with-opencl-icd=sysconfdir : libMesaOpenCL.so installed in
${prefix}/lib, icd in ${prefix}/etc//mesa.icd.  I only specified
--prefix, no other directories overridden in configure command.


thanks

  EdB

--Aaron

 

On Wed, May 6, 2015 at 4:34 PM, EdB <edb+m...@sigluy.net> wrote:

The standard ICD file path is /etc/OpenCL/vendor/.
However it doesn't fit well with custom build.
This option allow ICD vendor file installation path override
---
 configure.ac [1]                           | 46
+++++++++++++++++++++++-----------
 src/gallium/targets/opencl/Makefile.am |  2 +-
 2 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/configure.ac [1] b/configure.ac [1]
index 095e23e..90dba4e 100644
--- a/configure.ac [1]
+++ b/configure.ac [1]
@@ -804,12 +804,6 @@ AC_ARG_ENABLE([opencl],
          [enable OpenCL library @<:@default=disabled@:>@])],
    [enable_opencl="$enableval"],
    [enable_opencl=no])
-AC_ARG_ENABLE([opencl_icd],
-   [AS_HELP_STRING([--enable-opencl-icd],
-          [Build an OpenCL ICD library to be loaded by an ICD
implementation
-           @<:@default=disabled@:>@])],
-    [enable_opencl_icd="$enableval"],
-    [enable_opencl_icd=no])
 AC_ARG_ENABLE([xlib-glx],
     [AS_HELP_STRING([--enable-xlib-glx],
         [make GLX library Xlib-based instead of DRI-based
@<:@default=disabled@:>@])],
@@ -1689,19 +1683,11 @@ if test "x$enable_opencl" = xyes; then
     # XXX: Use $enable_shared_pipe_drivers once converted to
use static/shared pipe-drivers
     enable_gallium_loader=yes

-    if test "x$enable_opencl_icd" = xyes; then
-        OPENCL_LIBNAME="MesaOpenCL"
-    else
-        OPENCL_LIBNAME="OpenCL"
-    fi
-
     if test "x$have_libelf" != xyes; then
        AC_MSG_ERROR([Clover requires libelf])
     fi
 fi
 AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
-AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
-AC_SUBST([OPENCL_LIBNAME])

 dnl
 dnl Gallium configuration
@@ -2006,6 +1992,38 @@ AC_ARG_WITH([d3d-libdir],
     [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
 AC_SUBST([D3D_DRIVER_INSTALL_DIR])

+dnl OpenCL ICD
+
+AC_ARG_WITH([opencl-icd],
+   
[AS_HELP_STRING([--with-opencl-icd=@<:@no,standard,sysconfdir@:>@],
+        [Build an OpenCL ICD library to be loaded by an ICD
implementation.
+         If @<:@standard@:>@ the OpenCL ICD vendor file
installs in /etc/OpenCL/vendors.
+         @<:@sysconfdir@:>@ installs the file in
$sysconfdir/OpenCL/vendors
+         @<:@default=no@:>@])],
+    [OPENCL_ICD="$withval"],
+    [OPENCL_ICD="no"])
+
+case "x$OPENCL_ICD" in
+xno)
+    OPENCL_LIBNAME="OpenCL"
+    ;;
+xstandard)
+    OPENCL_LIBNAME="MesaOpenCL"
+    ICD_FILE_DIR="/etc/OpenCL/vendors"
+    ;;
+xsysconfdir)
+    OPENCL_LIBNAME="MesaOpenCL"
+    ICD_FILE_DIR="$sysconfdir/OpenCL/vendors"
+    ;;
+*)
+    AC_MSG_ERROR(['$OPENCL_ICD' is not a valid option for
--with-opencl-icd])
+    ;;
+esac
+
+AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$OPENCL_ICD" != xno)
+AC_SUBST([OPENCL_LIBNAME])
+AC_SUBST([ICD_FILE_DIR])
+
 dnl
 dnl Gallium helper functions
 dnl
diff --git a/src/gallium/targets/opencl/Makefile.am
b/src/gallium/targets/opencl/Makefile.am
index 5daf327..781daa0 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -47,7 +47,7 @@ EXTRA_lib@OPENCL_LIBNAME@_la_DEPENDENCIES =
opencl.sym
 EXTRA_DIST = mesa.icd opencl.sym

 if HAVE_CLOVER_ICD
-icddir = /etc/OpenCL/vendors/
+icddir = $(ICD_FILE_DIR)
 icd_DATA = mesa.icd
 endif

--
2.1.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev [2]



Links:
------
[1] http://configure.ac
[2] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to