viennacl / viennacl-dev

Developer repository for ViennaCL. Visit http://viennacl.sourceforge.net/ for the latest releases.
Other
281 stars 89 forks source link

CMake problem finding OpenCL.lib with AMD APP SDK #261

Closed IncinX closed 6 years ago

IncinX commented 6 years ago

Hello,

I discovered a problem with the cmake/FindOpenCL.cmake with AMD APP SDK. To put it simply, with the AMD APP SDK installed, ViennaCL cannot find OPENCL_LIBRARY and it doesn't build with OpenCL.

I debugged it down to this code: if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(OPENCL_LIB_SEARCH_PATH "${OPENCL_LIB_SEARCH_PATH}" "${ENV_OPENCLROOT}/lib/x86") else(CMAKE_SIZEOF_VOID_P EQUAL 4) set(OPENCL_LIB_SEARCH_PATH "${OPENCL_LIB_SEARCH_PATH}" "${ENV_OPENCLROOT}/lib/x86_64") endif(CMAKE_SIZEOF_VOID_P EQUAL 4)

The problem is that OPENCL_LIB_SEARCH_PATH has never been assigned to previously and evaluates to an empty string. find_library doesn't take too kindly to this and cannot find the library.

I made a fork with the proposed fix below. I am new to the repository so I don't want to step on too many toes. https://github.com/IncinX/viennacl-dev/commit/b5ae86543a94beb1e2eb47266195107989ecf044

My test environment was Windows, AMD APP SDK and this CMake generation: cmake -G "Visual Studio 15 2017 Win64" -DBUILD_TESTING:BOOL=0 -DENABLE_OPENMP:BOOL=1 -DENABLE_OPENCL:BOOL=1 ..

karlrupp commented 6 years ago

Thanks, @IncinX , this makes perfect sense. Can you please create a pull request for your commit? Thanks!

IncinX commented 6 years ago

I've created a pull request here. I don't have permissions to add reviewers or merge. I'm assuming you'll take it from here.

karlrupp commented 6 years ago

Thanks for the PR, which I just merged -> closing this issue now.