From dda542e912475d0d91d36d6c9f58d8cac2350a7e Mon Sep 17 00:00:00 2001 From: Pierre Moreau Date: Tue, 17 Dec 2019 18:11:10 +0100 Subject: [PATCH] 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 Acked-by: Francisco Jerez Tested-by: Marge Bot Part-of: --- .../state_trackers/clover/api/dispatch.hpp | 9 --------- .../state_trackers/clover/core/error.hpp | 1 - .../state_trackers/clover/core/object.hpp | 1 - .../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 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 #include -#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, ) -- 2.30.2