diff --git a/libfreerdp/primitives/CMakeLists.txt b/libfreerdp/primitives/CMakeLists.txt index 99222c19c..f85974858 100644 --- a/libfreerdp/primitives/CMakeLists.txt +++ b/libfreerdp/primitives/CMakeLists.txt @@ -64,9 +64,20 @@ set(PRIMITIVES_OPENCL_SRCS ) if (WITH_OPENCL) - freerdp_include_directory_add(${OpenCL_INCLUDE_DIRS}) - freerdp_library_add(OpenCL::OpenCL) + set(FILENAME "opencl/primitives.cl") + set_source_files_properties(${FILENAME} PROPERTIES HEADER_FILE_ONLY ON) + list(APPEND PRIMITIVES_OPENCL_SRCS ${FILENAME}) + include(ConvertFileToHexArray) + file_to_hex_array(${FILENAME} FILEDATA) + + set(HDR_FILE "${CMAKE_CURRENT_BINARY_DIR}/opencl/primitives-opencl-program.h") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencl/primitives.h.in" ${HDR_FILE} @ONLY) + list(APPEND PRIMITIVES_OPENCL_SRCS ${HDR_FILE}) + + include_directories(${CMAKE_CURRENT_BINARY_DIR}/opencl) + freerdp_include_directory_add(${OpenCL_INCLUDE_DIRS}) + freerdp_library_add(OpenCL::OpenCL) endif() set(PRIMITIVES_OPT_SRCS diff --git a/libfreerdp/primitives/opencl/prim_YUV_opencl.c b/libfreerdp/primitives/opencl/prim_YUV_opencl.c index e7c9e4efd..b4b53d7c8 100644 --- a/libfreerdp/primitives/opencl/prim_YUV_opencl.c +++ b/libfreerdp/primitives/opencl/prim_YUV_opencl.c @@ -30,6 +30,7 @@ #else #include #endif +#include "primitives-opencl-program.h" #include #define TAG FREERDP_TAG("primitives") @@ -260,10 +261,6 @@ static pstatus_t primitives_uninit_opencl(void) return PRIMITIVES_SUCCESS; } -static const char openclProgram[] = -#include "primitives.cl" - ; - static BOOL primitives_init_opencl_context(primitives_opencl_context* WINPR_RESTRICT prims) { cl_uint ndevices = 0; diff --git a/libfreerdp/primitives/opencl/primitives.cl b/libfreerdp/primitives/opencl/primitives.cl index 5e094df28..796d59ae4 100644 --- a/libfreerdp/primitives/opencl/primitives.cl +++ b/libfreerdp/primitives/opencl/primitives.cl @@ -16,9 +16,6 @@ * permissions and limitations under the License. */ -#define STRINGIFY(x) #x - -STRINGIFY( uchar clamp_uc(int v, short l, short h) { if (v > h) @@ -460,4 +457,3 @@ __kernel void yuv444_to_xrgb_1b( destPtr[1] = clamp_uc((y256 + (403 * V)) >> 8, 0, 255); /* R */ destPtr[0] = 0xff; /* A */ } -) diff --git a/libfreerdp/primitives/opencl/primitives.h.in b/libfreerdp/primitives/opencl/primitives.h.in new file mode 100644 index 000000000..69a4ed4c2 --- /dev/null +++ b/libfreerdp/primitives/opencl/primitives.h.in @@ -0,0 +1,11 @@ +/* AUTOGENERATED file, do not edit + * + * part of @PROJECT_NAME@ + * generated from libfreerdp/primitives/opencl/primitives.h.in + * + * with file contents of @FILENAME@ + */ +#pragma once + +static const char openclProgram[] = { @FILEDATA@ }; +