Skip to content
40 changes: 40 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
cc_defaults {
name: "OpenCL-ICD-Loader-defaults",

vendor: true,

cflags: [
"-Wno-error",
"-Wno-error=implicit-function-declaration",
"-DAMD64",
],

cppflags: [
"-D__ANDROID__",
],

clang_cflags: [
"-Wno-error=non-virtual-dtor",
],

include_dirs: [
"hardware/intel/external/opencl/compute-runtime/third_party/opencl_headers",
],

shared_libs: [

],

static_libs: [

],

}


build = [
"libOpenCL.bp",
"libIcdLog.bp",
"libOpenCLDriverStub.bp",
"icd_loader_test.bp",
]
55 changes: 55 additions & 0 deletions bp/defaults.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright(c) 2019 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files(the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and / or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
cc_defaults {
name: "@name",

vendor: true,

cflags: [
@cflags
],

cppflags: [
@cppflags
],

clang_cflags: [
@clang_cflags
],

include_dirs: [
@include_dirs
],

shared_libs: [
@shared_libs
],

static_libs: [
@static_libs
],

}


build = [
@build
]
55 changes: 55 additions & 0 deletions bp/icd-loader.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright(c) 2019 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files(the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and / or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# library_static, library_shared, binary
cc_@module {
name: "@name",

vendor: true,

defaults: [
@defaults
],

srcs: [
@srcs
],

cflags: [
@cflags
],

cppflags: [
@cppflags
],

local_include_dirs: [
@local_include_dirs
],

shared_libs: [
@shared_libs
],

static_libs: [
@static_libs
],

}
49 changes: 49 additions & 0 deletions icd_loader_test.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
cc_binary {
name: "icd_loader_test",

vendor: true,

defaults: [
"OpenCL-ICD-Loader-defaults",
],

srcs: [
"test/loader_test/test_kernel.c",
"test/loader_test/main.c",
"test/loader_test/test_platforms.c",
"test/loader_test/icd_test_match.c",
"test/loader_test/test_program_objects.c",
"test/loader_test/test_sampler_objects.c",
"test/loader_test/test_buffer_object.c",
"test/loader_test/test_cl_runtime.c",
"test/loader_test/callbacks.c",
"test/loader_test/test_create_calls.c",
"test/loader_test/test_clgl.c",
"test/loader_test/test_image_objects.c",
],

cflags: [
"-O3",
"-DNDEBUG",
"-DCL_TARGET_OPENCL_VERSION=220",
],

cppflags: [

],

local_include_dirs: [
"inc",
"test/inc",
],

shared_libs: [
"libOpenCL",
"libIcdLog",
],

static_libs: [

],

}
39 changes: 39 additions & 0 deletions libIcdLog.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cc_library_shared {
name: "libIcdLog",

vendor: true,

defaults: [
"OpenCL-ICD-Loader-defaults",
],

srcs: [
"test/log/icd_test_log.c",
],

cflags: [
"-O3",
"-DNDEBUG",
"-fPIC",
"-DCL_TARGET_OPENCL_VERSION=220",
"-DIcdLog_EXPORTS",
],

cppflags: [

],

local_include_dirs: [
"inc",
"test/inc",
],

shared_libs: [

],

static_libs: [

],

}
42 changes: 42 additions & 0 deletions libOpenCL.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cc_library_shared {
name: "libOpenCL",

vendor: true,

defaults: [
"OpenCL-ICD-Loader-defaults",
],

srcs: [
"loader/icd.c",
"loader/icd_dispatch.c",
"loader/linux/icd_linux.c",
"loader/linux/icd_linux_envvars.c",
],

cflags: [
"-O3",
"-DNDEBUG",
"-fPIC",
"-DCL_TARGET_OPENCL_VERSION=220",
"-DOpenCL_EXPORTS",
],

cppflags: [

],

local_include_dirs: [
"inc",
"loader",
],

shared_libs: [

],

static_libs: [

],

}
42 changes: 42 additions & 0 deletions libOpenCLDriverStub.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cc_library_shared {
name: "libOpenCLDriverStub",

vendor: true,

defaults: [
"OpenCL-ICD-Loader-defaults",
],

srcs: [
"test/driver_stub/cl.c",
"test/driver_stub/cl_ext.c",
"test/driver_stub/cl_gl.c",
"test/driver_stub/icd.c",
],

cflags: [
"-O3",
"-DNDEBUG",
"-fPIC",
"-DCL_TARGET_OPENCL_VERSION=220",
"-DOpenCLDriverStub_EXPORTS",
],

cppflags: [

],

local_include_dirs: [
"inc",
"test/inc",
],

shared_libs: [
"libIcdLog",
],

static_libs: [

],

}
3 changes: 3 additions & 0 deletions loader/linux/icd_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static pthread_once_t initialized = PTHREAD_ONCE_INIT;
// go through the list of vendors in the two configuration files
void khrIcdOsVendorsEnumerate(void)
{
#ifndef __ANDROID__
DIR *dir = NULL;
struct dirent *dirEntry = NULL;
char* vendorPath = ICD_VENDOR_PATH;
Expand Down Expand Up @@ -141,6 +142,8 @@ void khrIcdOsVendorsEnumerate(void)
{
khrIcd_free_getenv(envPath);
}
#endif
khrIcdVendorAdd("/vendor/lib64/libigdrcl.so");
}

// go through the list of vendors only once
Expand Down
2 changes: 2 additions & 0 deletions loader/linux/icd_linux_envvars.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#define _GNU_SOURCE
#endif

#ifndef __ANDROID__
#include "icd_cmake_config.h"
#endif

#include <stdlib.h>

Expand Down
Loading