[Mesa-dev] [PATCH mesa] clover: Adapt libclc's INCLUDEDIR and LIBEXECDIR to make use of the new introduced libclc.pc.

Johannes Obermayr johannesobermayr at gmx.de
Thu Nov 29 16:44:56 PST 2012


---
 configs/current.in                                    |    3 ++-
 configure.ac                                          |   15 ++++++++-------
 src/gallium/state_trackers/clover/Makefile.am         |    3 ++-
 src/gallium/state_trackers/clover/llvm/invocation.cpp |    4 ++--
 4 Dateien geändert, 14 Zeilen hinzugefügt(+), 11 Zeilen entfernt(-)

diff --git a/configs/current.in b/configs/current.in
index 62edfa5..597d003 100644
--- a/configs/current.in
+++ b/configs/current.in
@@ -182,7 +182,8 @@ VA_LIB_INSTALL_DIR=@VA_LIB_INSTALL_DIR@
 XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@
 
 # Path to OpenCL C library libclc
-LIBCLC_PATH = @LIBCLC_PATH@
+LIBCLC_INCLUDEDIR = @LIBCLC_INCLUDEDIR@
+LIBCLC_LIBEXECDIR = @LIBCLC_LIBEXECDIR@
 
 # pkg-config substitutions
 GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
diff --git a/configure.ac b/configure.ac
index 4fb4544..872729a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1449,19 +1449,16 @@ dnl
 dnl OpenCL configuration
 dnl
 
-AC_ARG_WITH([libclc-path],
-   [AS_HELP_STRING([--with-libclc-path],
-         [Path to libclc builtins library.  Example: --with-libclc-path=\$HOME/libclc/])],
-   [LIBCLC_PATH="$withval"],
-   [LIBCLC_PATH=""])
-
 AC_ARG_WITH([clang-libdir],
    [AS_HELP_STRING([--with-clang-libdir],
          [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
    [CLANG_LIBDIR="$withval"],
    [CLANG_LIBDIR=""])
 
-AC_SUBST([LIBCLC_PATH])
+LIBCLC_INCLUDEDIR=`pkg-config --variable=includedir libclc`
+LIBCLC_LIBEXECDIR=`pkg-config --variable=libexecdir libclc`
+AC_SUBST([LIBCLC_INCLUDEDIR])
+AC_SUBST([LIBCLC_LIBEXECDIR])
 
 if test "x$enable_opencl" = xyes; then
     if test "x$with_gallium_drivers" = x; then
@@ -1472,6 +1469,10 @@ if test "x$enable_opencl" = xyes; then
         AC_MSG_ERROR([gcc >= 4.6 is required to build clover])
     fi
 
+    if test "x$LIBCLC_INCLUDEDIR" == x || test "x$LIBCLC_LIBEXECDIR" == x; then
+        AC_MSG_ERROR([pkg-config cannot use libclc.pc which is required to build clover])
+    fi
+
     GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS clover"
     GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS opencl"
     enable_gallium_loader=yes
diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am
index 5241a6d..f511639 100644
--- a/src/gallium/state_trackers/clover/Makefile.am
+++ b/src/gallium/state_trackers/clover/Makefile.am
@@ -23,7 +23,8 @@ libclllvm_la_CXXFLAGS = \
 	-std=c++98 \
 	$(LLVM_CPPFLAGS) \
 	$(DEFINES) \
-	-DLIBCLC_PATH=\"$(LIBCLC_PATH)/\" \
+	-DLIBCLC_INCLUDEDIR=\"$(LIBCLC_INCLUDEDIR)/\" \
+	-DLIBCLC_LIBEXECDIR=\"$(LIBCLC_LIBEXECDIR)/\" \
 	-DCLANG_RESOURCE_DIR=\"$(CLANG_RESOURCE_DIR)\"
 
 libclllvm_la_SOURCES = \
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index 2b07053..1fe5a73 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -113,7 +113,7 @@ namespace {
       c.getHeaderSearchOpts().ResourceDir = CLANG_RESOURCE_DIR;
 
       // Add libclc generic search path
-      c.getHeaderSearchOpts().AddPath(LIBCLC_PATH "/generic/include/",
+      c.getHeaderSearchOpts().AddPath(LIBCLC_INCLUDEDIR,
                                       clang::frontend::Angled,
                                       false, false, false);
 
@@ -169,7 +169,7 @@ namespace {
       llvm::Linker linker("clover", mod);
 
       // Link the kernel with libclc
-      linker.LinkInFile(llvm::sys::Path(LIBCLC_PATH + triple + "/lib/builtins.bc"), isNative);
+      linker.LinkInFile(llvm::sys::Path(LIBCLC_LIBEXECDIR + triple + ".bc"), isNative);
       mod = linker.releaseModule();
 
       // Add a function internalizer pass.
-- 
1.7.10.4



More information about the mesa-dev mailing list