Mesa (master): clover/meson: Define OpenCL header macros

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 23 11:32:01 UTC 2020


Module: Mesa
Branch: master
Commit: dda542e912475d0d91d36d6c9f58d8cac2350a7e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dda542e912475d0d91d36d6c9f58d8cac2350a7e

Author: Pierre Moreau <pierre.morrow at free.fr>
Date:   Tue Dec 17 18:11:10 2019 +0100

clover/meson: Define OpenCL header macros

Rather than defining the macros any time right before including an
OpenCL header, set Meson to define them for the whole clover project.

Reviewed-by: Karol Herbst <kherbst at redhat.com>
Acked-by: Francisco Jerez <currojerez at riseup.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3137>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3137>

---

 src/gallium/state_trackers/clover/api/dispatch.hpp   |  9 ---------
 src/gallium/state_trackers/clover/core/error.hpp     |  1 -
 src/gallium/state_trackers/clover/core/object.hpp    |  1 -
 .../state_trackers/clover/llvm/codegen/common.cpp    |  1 -
 src/gallium/state_trackers/clover/meson.build        | 20 +++++++++++++++++---
 5 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/dispatch.hpp b/src/gallium/state_trackers/clover/api/dispatch.hpp
index 808b760a36c..ae93273f563 100644
--- a/src/gallium/state_trackers/clover/api/dispatch.hpp
+++ b/src/gallium/state_trackers/clover/api/dispatch.hpp
@@ -23,15 +23,6 @@
 #ifndef API_DISPATCH_HPP
 #define API_DISPATCH_HPP
 
-#define CL_TARGET_OPENCL_VERSION 220
-
-#define CL_USE_DEPRECATED_OPENCL_1_0_APIS
-#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
-#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
-#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
-#define CL_USE_DEPRECATED_OPENCL_2_1_APIS
-
-
 #include "CL/cl.h"
 #include "CL/cl_ext.h"
 #include "CL/cl_egl.h"
diff --git a/src/gallium/state_trackers/clover/core/error.hpp b/src/gallium/state_trackers/clover/core/error.hpp
index a38bbfa53c1..0490c19a276 100644
--- a/src/gallium/state_trackers/clover/core/error.hpp
+++ b/src/gallium/state_trackers/clover/core/error.hpp
@@ -23,7 +23,6 @@
 #ifndef CLOVER_CORE_ERROR_HPP
 #define CLOVER_CORE_ERROR_HPP
 
-#define CL_TARGET_OPENCL_VERSION 220
 #include "CL/cl.h"
 
 #include <stdexcept>
diff --git a/src/gallium/state_trackers/clover/core/object.hpp b/src/gallium/state_trackers/clover/core/object.hpp
index 8ed8e35630f..8fc2175d236 100644
--- a/src/gallium/state_trackers/clover/core/object.hpp
+++ b/src/gallium/state_trackers/clover/core/object.hpp
@@ -27,7 +27,6 @@
 #include <functional>
 #include <vector>
 
-#define CL_TARGET_OPENCL_VERSION 220
 #include "CL/cl.h"
 
 #include "core/error.hpp"
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
index 3879fb61a02..36e2adad0ab 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
@@ -33,7 +33,6 @@
 #include "llvm/codegen.hpp"
 #include "llvm/metadata.hpp"
 
-#define CL_TARGET_OPENCL_VERSION 220
 #include "CL/cl.h"
 
 #include "pipe/p_state.h"
diff --git a/src/gallium/state_trackers/clover/meson.build b/src/gallium/state_trackers/clover/meson.build
index 8bc29cf6970..7606a6beaf6 100644
--- a/src/gallium/state_trackers/clover/meson.build
+++ b/src/gallium/state_trackers/clover/meson.build
@@ -19,6 +19,14 @@
 # SOFTWARE.
 
 clover_cpp_args = []
+clover_opencl_cpp_args = [
+  '-DCL_TARGET_OPENCL_VERSION=220',
+  '-DCL_USE_DEPRECATED_OPENCL_1_0_APIS',
+  '-DCL_USE_DEPRECATED_OPENCL_1_1_APIS',
+  '-DCL_USE_DEPRECATED_OPENCL_1_2_APIS',
+  '-DCL_USE_DEPRECATED_OPENCL_2_0_APIS',
+  '-DCL_USE_DEPRECATED_OPENCL_2_1_APIS'
+]
 clover_spirv_cpp_args = []
 clover_incs = [inc_include, inc_src, inc_gallium, inc_gallium_aux]
 
@@ -53,6 +61,7 @@ libclllvm = static_library(
   include_directories : clover_incs,
   cpp_args : [
     clover_cpp_args,
+    clover_opencl_cpp_args,
     clover_spirv_cpp_args,
     cpp_vis_args,
     '-DLIBCLC_INCLUDEDIR="@0@/"'.format(dep_clc.get_pkgconfig_variable('includedir')),
@@ -70,7 +79,7 @@ libclspirv = static_library(
   'clspirv',
   files('spirv/invocation.cpp', 'spirv/invocation.hpp'),
   include_directories : clover_incs,
-  cpp_args : [clover_spirv_cpp_args, cpp_vis_args],
+  cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args, cpp_vis_args],
   dependencies : [dep_spirv_tools],
   override_options : clover_cpp_std,
 )
@@ -80,7 +89,7 @@ libclnir = static_library(
   files('nir/invocation.cpp', 'nir/invocation.hpp'),
   include_directories : [clover_incs, inc_mesa],
   dependencies : idep_nir,
-  cpp_args : [clover_spirv_cpp_args, cpp_vis_args],
+  cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args, cpp_vis_args],
   override_options : clover_cpp_std,
 )
 
@@ -144,7 +153,12 @@ libclover = static_library(
   'clover',
   [clover_files, sha1_h],
   include_directories : clover_incs,
-  cpp_args : [clover_spirv_cpp_args, clover_cpp_args, cpp_vis_args],
+  cpp_args : [
+    clover_opencl_cpp_args,
+    clover_spirv_cpp_args,
+    clover_cpp_args,
+    cpp_vis_args
+  ],
   link_with : [libclllvm, libclspirv, libclnir],
   override_options : clover_cpp_std,
 )



More information about the mesa-commit mailing list