Skip to content

Commit

Permalink
Perform sanity check for OpenCL Library
Browse files Browse the repository at this point in the history
  • Loading branch information
furuame committed Sep 16, 2018
1 parent 53edcf6 commit 94ec2c9
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions mk/opencl.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# FIXME: perform sanity checks before compilation
OPENCL_LIB ?= /usr/local/cuda/lib64
# Default the path to the NVIDIA Run time Library
OPENCL_LIB_PATH ?= /usr/local/cuda/lib64

OPENCL_LIB_DIR := $(shell test -d $(OPENCL_LIB_PATH); echo $$?)

ifneq ($(OPENCL_LIB_DIR),0)
$(error "Please specify the path to your OpenCL library on your platform")
endif

OPENCL_LIB_AVAIL := $(shell ls $(OPENCL_LIB_PATH) | grep -oi libOpenCL.so > /dev/null; echo $$?)

ifneq ($(OPENCL_LIB_AVAIL),0)
$(error "Please check the availability of your OpenCL shared library in $(OPENCL_LIB_PATH)")
endif

CFLAGS += \
-DENABLE_OPENCL \
-I$(OPENCL_PATH)/include
LDFLAGS += -L$(OPENCL_LIB) -lOpenCL
-I$(OPENCL_LIB_PATH)/../include

LDFLAGS += -L$(OPENCL_LIB_PATH) -lOpenCL

0 comments on commit 94ec2c9

Please sign in to comment.