Skip to content
Merged
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
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 1597f0f35a644789c7ad77efe79014236cca2fab
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
-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