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 145ac16
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions mk/opencl.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# FIXME: perform sanity checks before compilation
OPENCL_LIB ?= /usr/local/cuda/lib64
OPENCL_LIB_PATH ?= /usr/local/cuda/lib64

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

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

OPENCL_LIB := $(shell ls $(OPENCL_LIB_PATH) | grep -oi libOpenCL.so && echo 1 || echo 0)

ifneq ($(OPENCL_LIB),0)
$(error "Please check the availability of your OpenCL shared library")
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 145ac16

Please sign in to comment.