diff --git a/paddle/fluid/lite/opencl/CMakeLists.txt b/paddle/fluid/lite/opencl/CMakeLists.txt index 309f2a305888f594cd6b95bd3eaafda6e1bc1a78..c2452ee2afff1ec2d7bea27afcca6f981d4c7ec8 100644 --- a/paddle/fluid/lite/opencl/CMakeLists.txt +++ b/paddle/fluid/lite/opencl/CMakeLists.txt @@ -2,19 +2,23 @@ if (NOT LITE_WITH_OPENCL) return() endif() -find_library(opencl-lib - NAMES OpenCL) -message(STATUS "The OpenCL library path : ${opencl-lib}") +if (WITH_LITE AND LITE_WITH_LIGHT_WEIGHT_FRAMEWORK) + add_library(opencl-lib SHARED IMPORTED) + set_target_properties(opencl-lib + PROPERTIES + IMPORTED_LOCATION + ${CMAKE_SOURCE_DIR}/opencl-lib/armeabi-v7a/libOpenCL.so) -cc_library(cl_tool SRCS cl_tool.cc) -target_compile_options(cl_tool BEFORE PUBLIC -Wno-ignored-qualifiers) -cc_library(cl_half SRCS cl_half.cc) -target_compile_options(cl_half BEFORE PUBLIC -fno-strict-aliasing) -cc_library(cl_engine SRCS cl_engine.cc DEPS cl_tool) -cc_library(cl_context SRCS cl_context.cc DEPS cl_engine) -cc_library(cl_helper SRCS cl_helper.cc DEPS cl_context proto_desc) -cc_library(cl_image_converter SRCS cl_image_converter.cc DEPS cl_half lite_tensor) -cc_library(cl_image SRCS cl_image.cc DEPS cl_half lite_tensor cl_image_converter cl_engine) -cc_test(test_cl_runtime SRCS cl_test.cc DEPS cl_engine cl_context) -target_link_libraries(test_cl_runtime ${opencl-lib}) -add_dependencies(cl_tool opencl_clhpp) + cc_library(cl_tool SRCS cl_tool.cc) + target_compile_options(cl_tool BEFORE PUBLIC -Wno-ignored-qualifiers) + cc_library(cl_half SRCS cl_half.cc) + target_compile_options(cl_half BEFORE PUBLIC -fno-strict-aliasing) + cc_library(cl_engine SRCS cl_engine.cc DEPS cl_tool) + cc_library(cl_context SRCS cl_context.cc DEPS cl_engine) + cc_library(cl_helper SRCS cl_helper.cc DEPS cl_context) + cc_library(cl_image_converter SRCS cl_image_converter.cc DEPS cl_half lite_tensor) + cc_library(cl_image SRCS cl_image.cc DEPS cl_half lite_tensor cl_image_converter cl_engine) + cc_test(test_cl_runtime SRCS cl_test.cc DEPS cl_engine cl_context) + target_link_libraries(test_cl_runtime opencl-lib) + add_dependencies(cl_tool opencl_clhpp) +endif() diff --git a/paddle/fluid/lite/tools/build.sh b/paddle/fluid/lite/tools/build.sh index 1c43cc661b2d1390becf5cae13044a185b2a7311..927668be25ff1b7ca24f3bed77fe3522326a5e81 100755 --- a/paddle/fluid/lite/tools/build.sh +++ b/paddle/fluid/lite/tools/build.sh @@ -26,6 +26,8 @@ function cmake_x86 { } function cmake_opencl { + # $1: ARM_TARGET_OS in "android" , "armlinux" + # $2: ARM_TARGET_ARCH_ABI in "arm64-v8a", "armeabi-v7a" ,"armeabi-v7a-hf" cmake .. \ -DLITE_WITH_OPENCL=ON \ -DWITH_GPU=OFF \ @@ -438,7 +440,7 @@ function main { shift ;; cmake_opencl) - cmake_opencl + cmake_opencl $ARM_OS $ARM_ABI shift ;; cmake_cuda)