Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions CMakeModules/FindBoostCompute.cmake

This file was deleted.

93 changes: 0 additions & 93 deletions CMakeModules/FindCLBLAS.cmake

This file was deleted.

78 changes: 0 additions & 78 deletions CMakeModules/FindclFFT.cmake

This file was deleted.

61 changes: 61 additions & 0 deletions CMakeModules/build_boost_compute.cmake
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}")
39 changes: 39 additions & 0 deletions CMakeModules/build_clBLAS.cmake
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
Copy link
Member

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.

Copy link
Contributor Author

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.

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)
39 changes: 39 additions & 0 deletions CMakeModules/build_clFFT.cmake
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
Copy link
Member

Choose a reason for hiding this comment

The 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)
Loading