-
Notifications
You must be signed in to change notification settings - Fork 549
download and build the opencl dependencies with cmake #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| set(VER 0.4) | ||
| set(URL https://github.com/kylelutz/compute/archive/v${VER}.tar.gz) | ||
| set(MD5 0d881bd8e8c1729559bc9b98d6b25a3c) | ||
|
|
||
| set(thirdPartyDir "${CMAKE_BINARY_DIR}/third_party") | ||
| set(srcDir "${thirdPartyDir}/compute-${VER}") | ||
| set(archive ${srcDir}.tar.gz) | ||
| set(inflated ${srcDir}-inflated) | ||
|
|
||
| # the config to be used in the code | ||
| set(BoostCompute_INCLUDE_DIRS "${srcDir}/include") | ||
|
|
||
| # do we have to do it again? | ||
| set(doExtraction ON) | ||
| if(EXISTS "${inflated}") | ||
| file(READ "${inflated}" extractedMD5) | ||
| if("${extractedMD5}" STREQUAL "${MD5}") | ||
| # nope, everything looks fine | ||
| return() | ||
| endif() | ||
| endif() | ||
|
|
||
| # lets get and extract boost compute | ||
|
|
||
| message(STATUS "BoostCompute...") | ||
| if(EXISTS "${archive}") | ||
| file(MD5 "${archive}" md5) | ||
| if(NOT "${md5}" STREQUAL "${MD5}") | ||
| message(" wrong check sum ${md5}, redownloading") | ||
| file(REMOVE "${archive}") | ||
| endif() | ||
| endif() | ||
|
|
||
| if(NOT EXISTS "${archive}") | ||
| message(STATUS " getting ${URL}") | ||
| file(DOWNLOAD "${URL}" ${archive} | ||
| STATUS rv | ||
| SHOW_PROGRESS) | ||
| endif() | ||
|
|
||
| message(STATUS " validating ${archive}") | ||
| file(MD5 "${archive}" md5) | ||
| if(NOT "${md5}" STREQUAL "${MD5}") | ||
| message(FATAL_ERROR "${archive}: invalid check sum ${md5}. Expected was ${MD5}") | ||
| endif() | ||
|
|
||
| if(IS_DIRECTORY ${srcDir}) | ||
| message(STATUS " cleaning ${cleaning}") | ||
| file(REMOVE_RECURSE ${srcDir}) | ||
| endif() | ||
|
|
||
| message(STATUS " extracting ${archive}") | ||
| file(MAKE_DIRECTORY ${srcDir}) | ||
| execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz ${archive} | ||
| WORKING_DIRECTORY ${thirdPartyDir} | ||
| RESULT_VARIABLE rv) | ||
| if(NOT rv EQUAL 0) | ||
| message(FATAL_ERROR "'${archive}' extraction failed") | ||
| endif() | ||
|
|
||
| file(WRITE ${inflated} "${MD5}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| include(ExternalProject) | ||
|
|
||
| set(prefix ${CMAKE_BINARY_DIR}/third_party/clBLAS) | ||
| set(clBLAS_location ${prefix}/lib/import/${CMAKE_STATIC_LIBRARY_PREFIX}clBLAS${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
| if(CMAKE_VERSION VERSION_LESS 3.2 AND CMAKE_GENERATOR MATCHES "Ninja") | ||
| message(WARNING "Building clBLAS with Ninja has known issues with CMake older than 3.2") | ||
| set(byproducts) | ||
| else() | ||
| set(byproducts BYPRODUCTS ${clBLAS_location}) | ||
| endif() | ||
|
|
||
| ExternalProject_Add( | ||
| clBLAS-external | ||
| GIT_REPOSITORY https://github.com/arrayfire/clBLAS.git | ||
| GIT_TAG 47662a6ac1186c756508109d7fef8827efab4504 | ||
| PREFIX "${prefix}" | ||
| INSTALL_DIR "${prefix}" | ||
| UPDATE_COMMAND "" | ||
| CONFIGURE_COMMAND ${CMAKE_COMMAND} -Wno-dev "-G${CMAKE_GENERATOR}" <SOURCE_DIR>/src | ||
| -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} | ||
| "-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} -w" | ||
| -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} | ||
| "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} -w" | ||
| -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
| -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
| -DBUILD_SHARED_LIBS:BOOL=OFF | ||
| -DBUILD_CLIENT:BOOL=OFF | ||
| -DBUILD_TEST:BOOL=OFF | ||
| -DBUILD_KTEST:BOOL=OFF | ||
| -DSUFFIX_LIB:STRING= | ||
| ${byproducts}) | ||
|
|
||
| ExternalProject_Get_Property(clBLAS-external install_dir) | ||
| add_library(clBLAS IMPORTED STATIC) | ||
| set_target_properties(clBLAS PROPERTIES IMPORTED_LOCATION ${clBLAS_location}) | ||
| add_dependencies(clBLAS clBLAS-external) | ||
| set(CLBLAS_INCLUDE_DIRS ${install_dir}/include) | ||
| set(CLBLAS_LIBRARIES clBLAS) | ||
| set(CLBLAS_FOUND ON) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| include(ExternalProject) | ||
|
|
||
| set(prefix "${CMAKE_BINARY_DIR}/third_party/clFFT") | ||
| set(clFFT_location ${prefix}/lib/import/${CMAKE_STATIC_LIBRARY_PREFIX}clFFT${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
| if(CMAKE_VERSION VERSION_LESS 3.2 AND CMAKE_GENERATOR MATCHES "Ninja") | ||
| message(WARNING "Building clFFT with Ninja has known issues with CMake older than 3.2") | ||
| set(byproducts) | ||
| else() | ||
| set(byproducts BYPRODUCTS ${clFFT_location}) | ||
| endif() | ||
|
|
||
| ExternalProject_Add( | ||
| clFFT-external | ||
| GIT_REPOSITORY https://github.com/arrayfire/clFFT.git | ||
| GIT_TAG 1c14c415d1dd8d9a73fa2546086508a34f2008af | ||
| PREFIX "${prefix}" | ||
| INSTALL_DIR "${prefix}" | ||
| UPDATE_COMMAND "" | ||
| CONFIGURE_COMMAND ${CMAKE_COMMAND} -Wno-dev "-G${CMAKE_GENERATOR}" <SOURCE_DIR>/src | ||
| -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} | ||
| "-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} -w" | ||
| -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} | ||
| "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} -w" | ||
| -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
| -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
| -DBUILD_CLIENT:BOOL=OFF | ||
| -DBUILD_SHARED_LIBRARY:BOOL=OFF | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given the comments below, I renamed BUILD_SHARED_LIBRARY to BUILD_SHARED_LIBS in the clMathLibraries/clFFT#75 |
||
| -DBUILD_TEST:BOOL=OFF | ||
| -DSUFFIX_LIB:STRING= | ||
| -DUSE_SYSTEM_GTEST:BOOL=ON | ||
| ${byproducts}) | ||
|
|
||
| ExternalProject_Get_Property(clFFT-external install_dir) | ||
| add_library(clFFT IMPORTED STATIC) | ||
| set_target_properties(clFFT PROPERTIES IMPORTED_LOCATION ${clFFT_location}) | ||
| add_dependencies(clFFT clFFT-external) | ||
| set(CLFFT_INCLUDE_DIRS ${install_dir}/include) | ||
| set(CLFFT_LIBRARIES clFFT) | ||
| set(CLFFT_FOUND ON) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this GIT_TAG necessary or can we simply use HEAD always? We would prefer having HEAD.
Also, can you change the repository URL to point to https://github.com/arrayfire/clBLAS.git
Same changes for clFFT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if the tag is necessary, but it is a good idea to keep it in my opinion: it ensures that the version used is the expected one at the time the code was written, a bit like having clBLAS and clFFT directly in the repository or in a submodule.