OSDN Git Service

clover/meson: Define OpenCL header macros
authorPierre Moreau <pierre.morrow@free.fr>
Tue, 17 Dec 2019 17:11:10 +0000 (18:11 +0100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jan 2020 11:12:33 +0000 (11:12 +0000)
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@redhat.com>
Acked-by: Francisco Jerez <currojerez@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
src/gallium/state_trackers/clover/core/error.hpp
src/gallium/state_trackers/clover/core/object.hpp
src/gallium/state_trackers/clover/llvm/codegen/common.cpp
src/gallium/state_trackers/clover/meson.build

index 808b760..ae93273 100644 (file)
 #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"
index a38bbfa..0490c19 100644 (file)
@@ -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>
index 8ed8e35..8fc2175 100644 (file)
@@ -27,7 +27,6 @@
 #include <functional>
 #include <vector>
 
-#define CL_TARGET_OPENCL_VERSION 220
 #include "CL/cl.h"
 
 #include "core/error.hpp"
index 3879fb6..36e2ada 100644 (file)
@@ -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"
index 8bc29cf..7606a6b 100644 (file)
 # 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,
 )