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@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>
This commit is contained in:
Pierre Moreau 2019-12-17 18:11:10 +01:00 committed by Marge Bot
parent dd756b704f
commit dda542e912
5 changed files with 17 additions and 15 deletions

View file

@ -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"

View 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>

View file

@ -27,7 +27,6 @@
#include <functional>
#include <vector>
#define CL_TARGET_OPENCL_VERSION 220
#include "CL/cl.h"
#include "core/error.hpp"

View 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"

View file

@ -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,
)