mirror of
https://github.com/CNugteren/CLBlast.git
synced 2024-08-24 05:52:27 +02:00
Merge pull request #86 from intelfx/cmake
CMakeLists.txt: provide a find_package() config for dependent projects
This commit is contained in:
commit
c3712f5b36
|
@ -1,8 +1,8 @@
|
||||||
environment:
|
environment:
|
||||||
global:
|
global:
|
||||||
CLBLAST_ROOT: "%APPVEYOR_BUILD_FOLDER%\\bin\\clblast"
|
CLBLAST_ROOT: "%APPVEYOR_BUILD_FOLDER%\\..\\bin\\clblast"
|
||||||
OPENCL_REGISTRY: "https://www.khronos.org/registry/cl"
|
OPENCL_REGISTRY: "https://www.khronos.org/registry/cl"
|
||||||
OPENCL_ROOT: "%APPVEYOR_BUILD_FOLDER%\\bin\\opencl"
|
OPENCL_ROOT: "%APPVEYOR_BUILD_FOLDER%\\..\\bin\\opencl"
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- x64
|
- x64
|
||||||
|
|
32
.travis.yml
32
.travis.yml
|
@ -17,49 +17,21 @@ addons:
|
||||||
- kubuntu-backports
|
- kubuntu-backports
|
||||||
packages:
|
packages:
|
||||||
- cmake
|
- cmake
|
||||||
|
- ocl-icd-opencl-dev
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- CLBLAST_ROOT=${TRAVIS_BUILD_DIR}/bin/clblast
|
- CLBLAST_ROOT=${TRAVIS_BUILD_DIR}/bin/clblast
|
||||||
- OPENCL_REGISTRY=https://www.khronos.org/registry/cl
|
|
||||||
- OPENCL_ROOT=${TRAVIS_BUILD_DIR}/bin/opencl
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- cmake --version;
|
- cmake --version;
|
||||||
- ${CC} --version;
|
- ${CC} --version;
|
||||||
- ${CXX} --version;
|
- ${CXX} --version;
|
||||||
|
|
||||||
install:
|
|
||||||
# The following linux logic is necessary because of Travis's move to the GCE platform, which does not
|
|
||||||
# currently contain packages for fglrx: https://github.com/travis-ci/travis-ci/issues/5221
|
|
||||||
# We build our own linkable .so file
|
|
||||||
- if [ ${TRAVIS_OS_NAME} == "linux" ]; then
|
|
||||||
mkdir -p ${OPENCL_ROOT};
|
|
||||||
pushd ${OPENCL_ROOT};
|
|
||||||
travis_retry git clone --depth 1 https://github.com/KhronosGroup/OpenCL-ICD-Loader.git;
|
|
||||||
mv ./OpenCL-ICD-Loader/* .;
|
|
||||||
travis_retry git clone --depth 1 https://github.com/KhronosGroup/OpenCL-Headers.git inc/CL;
|
|
||||||
pushd inc/CL;
|
|
||||||
travis_retry wget -w 1 -np -nd -nv -A h,hpp ${OPENCL_REGISTRY}/api/2.1/cl.hpp;
|
|
||||||
popd;
|
|
||||||
mkdir -p lib;
|
|
||||||
pushd lib;
|
|
||||||
cmake -G "Unix Makefiles" ..;
|
|
||||||
make;
|
|
||||||
cp ./bin/libOpenCL.so .;
|
|
||||||
popd;
|
|
||||||
pushd inc/CL;
|
|
||||||
travis_retry git fetch origin opencl12:opencl12;
|
|
||||||
git checkout opencl12;
|
|
||||||
popd;
|
|
||||||
mv inc/ include/;
|
|
||||||
popd;
|
|
||||||
fi
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir -p ${CLBLAST_ROOT}
|
- mkdir -p ${CLBLAST_ROOT}
|
||||||
- pushd ${CLBLAST_ROOT}
|
- pushd ${CLBLAST_ROOT}
|
||||||
- cmake -DOPENCL_ROOT=${OPENCL_ROOT} -DTESTS=ON -DCLIENTS=ON ${TRAVIS_BUILD_DIR}
|
- cmake -DTESTS=ON -DCLIENTS=ON ${TRAVIS_BUILD_DIR}
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make
|
- make
|
||||||
|
|
|
@ -127,11 +127,6 @@ endif()
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
|
|
||||||
# Includes directories: CLBlast and OpenCL
|
|
||||||
include_directories(${clblast_SOURCE_DIR}/include ${clblast_SOURCE_DIR}/src ${OPENCL_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
# ==================================================================================================
|
|
||||||
|
|
||||||
# Sets the supported routines and the used kernels. New routines and kernels should be added here.
|
# Sets the supported routines and the used kernels. New routines and kernels should be added here.
|
||||||
set(KERNELS copy_fast copy_pad transpose_fast transpose_pad xaxpy xdot xger xgemm xgemv)
|
set(KERNELS copy_fast copy_pad transpose_fast transpose_pad xaxpy xdot xger xgemm xgemv)
|
||||||
set(SAMPLE_PROGRAMS_CPP sgemm)
|
set(SAMPLE_PROGRAMS_CPP sgemm)
|
||||||
|
@ -173,17 +168,27 @@ endforeach()
|
||||||
add_library(clblast SHARED ${SOURCES})
|
add_library(clblast SHARED ${SOURCES})
|
||||||
target_link_libraries(clblast ${OPENCL_LIBRARIES})
|
target_link_libraries(clblast ${OPENCL_LIBRARIES})
|
||||||
|
|
||||||
|
# Includes directories: CLBlast and OpenCL
|
||||||
|
target_include_directories(clblast PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${clblast_SOURCE_DIR}/include>
|
||||||
|
$<BUILD_INTERFACE:${clblast_SOURCE_DIR}/src>
|
||||||
|
$<INSTALL_INTERFACE:include>
|
||||||
|
${OPENCL_INCLUDE_DIRS})
|
||||||
|
|
||||||
# Sets the proper __declspec(dllexport) keyword for Visual Studio when the library is built
|
# Sets the proper __declspec(dllexport) keyword for Visual Studio when the library is built
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_definitions(clblast PRIVATE COMPILING_DLL=1) # requires at least CMake 2.8.11
|
target_compile_definitions(clblast PRIVATE COMPILING_DLL=1) # requires at least CMake 2.8.11
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Installs the library
|
# Installs the library
|
||||||
install(TARGETS clblast DESTINATION lib)
|
install(TARGETS clblast EXPORT CLBlast DESTINATION lib)
|
||||||
install(FILES include/clblast.h DESTINATION include)
|
install(FILES include/clblast.h DESTINATION include)
|
||||||
install(FILES include/clblast_c.h DESTINATION include)
|
install(FILES include/clblast_c.h DESTINATION include)
|
||||||
install(FILES include/clblast_half.h DESTINATION include)
|
install(FILES include/clblast_half.h DESTINATION include)
|
||||||
|
|
||||||
|
# Installs the config for find_package in dependent projects
|
||||||
|
install(EXPORT CLBlast DESTINATION lib/cmake/CLBLast FILE CLBlastConfig.cmake)
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
|
|
||||||
# Sets a default platform ($DEVICEPLATFORM) and device ($DEFAULT_DEVICE) to run tuners and tests on
|
# Sets a default platform ($DEVICEPLATFORM) and device ($DEFAULT_DEVICE) to run tuners and tests on
|
||||||
|
@ -226,7 +231,6 @@ endif()
|
||||||
if(TUNERS)
|
if(TUNERS)
|
||||||
|
|
||||||
# Includes CLTune
|
# Includes CLTune
|
||||||
include_directories(${CLTUNE_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
# Visual Studio requires the sources of non-exported objects/libraries
|
# Visual Studio requires the sources of non-exported objects/libraries
|
||||||
set(TUNERS_COMMON )
|
set(TUNERS_COMMON )
|
||||||
|
@ -238,6 +242,7 @@ if(TUNERS)
|
||||||
foreach(KERNEL ${KERNELS})
|
foreach(KERNEL ${KERNELS})
|
||||||
add_executable(clblast_tuner_${KERNEL} ${TUNERS_COMMON} src/tuning/kernels/${KERNEL}.cpp)
|
add_executable(clblast_tuner_${KERNEL} ${TUNERS_COMMON} src/tuning/kernels/${KERNEL}.cpp)
|
||||||
target_link_libraries(clblast_tuner_${KERNEL} clblast ${CLTUNE_LIBRARIES} ${OPENCL_LIBRARIES})
|
target_link_libraries(clblast_tuner_${KERNEL} clblast ${CLTUNE_LIBRARIES} ${OPENCL_LIBRARIES})
|
||||||
|
target_include_directories(clblast_tuner_${KERNEL} PUBLIC ${CLTUNE_INCLUDE_DIRS})
|
||||||
install(TARGETS clblast_tuner_${KERNEL} DESTINATION bin)
|
install(TARGETS clblast_tuner_${KERNEL} DESTINATION bin)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
@ -281,9 +286,6 @@ if(CLIENTS OR TESTS)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Sets the include directories
|
|
||||||
include_directories(${clblast_SOURCE_DIR} ${REF_INCLUDES})
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ==================================================================================================
|
# ==================================================================================================
|
||||||
|
@ -299,6 +301,10 @@ if(CLIENTS)
|
||||||
else()
|
else()
|
||||||
# Creates the common performance-tests objects (requires CMake 2.8.8)
|
# Creates the common performance-tests objects (requires CMake 2.8.8)
|
||||||
add_library(test_performance_common OBJECT test/performance/client.cpp)
|
add_library(test_performance_common OBJECT test/performance/client.cpp)
|
||||||
|
# Adds clblast's interface include pathes because we can't link to clblast here
|
||||||
|
target_include_directories(test_performance_common PRIVATE
|
||||||
|
$<TARGET_PROPERTY:clblast,INTERFACE_INCLUDE_DIRECTORIES>
|
||||||
|
${clblast_SOURCE_DIR})
|
||||||
set(CLIENTS_COMMON ${CLIENTS_COMMON} $<TARGET_OBJECTS:test_performance_common>)
|
set(CLIENTS_COMMON ${CLIENTS_COMMON} $<TARGET_OBJECTS:test_performance_common>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -321,6 +327,7 @@ if(CLIENTS)
|
||||||
endforeach()
|
endforeach()
|
||||||
foreach(ROUTINE ${ROUTINES})
|
foreach(ROUTINE ${ROUTINES})
|
||||||
target_link_libraries(clblast_client_${ROUTINE} clblast ${REF_LIBRARIES} ${OPENCL_LIBRARIES})
|
target_link_libraries(clblast_client_${ROUTINE} clblast ${REF_LIBRARIES} ${OPENCL_LIBRARIES})
|
||||||
|
target_include_directories(clblast_client_${ROUTINE} PUBLIC ${clblast_SOURCE_DIR} ${REF_INCLUDES})
|
||||||
install(TARGETS clblast_client_${ROUTINE} DESTINATION bin)
|
install(TARGETS clblast_client_${ROUTINE} DESTINATION bin)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
@ -342,6 +349,9 @@ if(TESTS)
|
||||||
# Creates the common correctness-tests objects (requires CMake 2.8.8)
|
# Creates the common correctness-tests objects (requires CMake 2.8.8)
|
||||||
add_library(test_correctness_common OBJECT
|
add_library(test_correctness_common OBJECT
|
||||||
test/correctness/tester.cpp test/correctness/testblas.cpp)
|
test/correctness/tester.cpp test/correctness/testblas.cpp)
|
||||||
|
target_include_directories(test_correctness_common PUBLIC
|
||||||
|
$<TARGET_PROPERTY:clblast,INTERFACE_INCLUDE_DIRECTORIES>
|
||||||
|
${clblast_SOURCE_DIR})
|
||||||
set(TESTS_COMMON ${TESTS_COMMON} $<TARGET_OBJECTS:test_correctness_common>)
|
set(TESTS_COMMON ${TESTS_COMMON} $<TARGET_OBJECTS:test_correctness_common>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -365,6 +375,7 @@ if(TESTS)
|
||||||
foreach(ROUTINE ${ROUTINES})
|
foreach(ROUTINE ${ROUTINES})
|
||||||
target_link_libraries(clblast_test_${ROUTINE} clblast ${REF_LIBRARIES} ${OPENCL_LIBRARIES})
|
target_link_libraries(clblast_test_${ROUTINE} clblast ${REF_LIBRARIES} ${OPENCL_LIBRARIES})
|
||||||
install(TARGETS clblast_test_${ROUTINE} DESTINATION bin)
|
install(TARGETS clblast_test_${ROUTINE} DESTINATION bin)
|
||||||
|
target_include_directories(clblast_test_${ROUTINE} PUBLIC ${clblast_SOURCE_DIR} ${REF_INCLUDES})
|
||||||
add_test(clblast_test_${ROUTINE} clblast_test_${ROUTINE} ${DEVICEPLATFORM})
|
add_test(clblast_test_${ROUTINE} clblast_test_${ROUTINE} ${DEVICEPLATFORM})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue