-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
64 lines (52 loc) · 2.21 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# CuBool library Cmake config file
# Add this file as sub-directory to your project to use library functionality
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(cuBool LANGUAGES CXX)
# Exposed to the user build options
option(CUBOOL_WITH_CUDA "Build library with cuda backend (default)" ON)
option(CUBOOL_WITH_SEQUENTIAL "Build library with cpu sequential backend (fallback)" ON)
option(CUBOOL_WITH_NAIVE "Build library with naive and naive-shared dense matrix multiplication" OFF)
option(CUBOOL_BUILD_TESTS "Build project unit-tests with gtest" ON)
option(CUBOOL_COPY_TO_PY_PACKAGE "Copy compiled shared library into python package folder (for package use purposes)" ON)
set(CUBOOL_VERSION_MAJOR 1)
set(CUBOOL_VERSION_MINOR 0)
set(CUBOOL_VERSION_SUB 0)
set(CUBOOL_DEBUG OFF)
set(CUBOOL_RELEASE OFF)
if (${CMAKE_BUILD_TYPE} MATCHES Release)
message(STATUS "Build cubool in release mode")
set(CUBOOL_RELEASE ON)
elseif (${CMAKE_BUILD_TYPE} MATCHES Debug)
message(STATUS "Build cubool in debug mode")
set(CUBOOL_DEBUG ON)
else()
message(STATUS "Build cubool in release mode (default: was not specified)")
set(CUBOOL_RELEASE ON)
set(CMAKE_BUILD_TYPE Release)
endif()
# Configure cuda dependencies
if (CUBOOL_WITH_CUDA)
message(STATUS "Add cub as cuda utility")
set(CUB_ENABLE_HEADER_TESTING OFF CACHE BOOL "" FORCE)
set(CUB_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(CUB_ENABLE_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(deps/cub)
add_library(cub INTERFACE IMPORTED)
target_link_libraries(cub INTERFACE CUB::CUB)
message(STATUS "Add nsparse library as crs matrix multiplication backend")
add_subdirectory(deps/nsparse-um)
endif()
if (CUBOOL_WITH_NAIVE)
message(STATUS "Add naive library as dense matrix multiplication implementation for benchmarks")
add_subdirectory(deps/naive)
endif()
if (CUBOOL_BUILD_TESTS)
message(STATUS "Add googletest as unit-testing library")
add_subdirectory(deps/gtest)
endif()
# Actual cxx implementation
add_subdirectory(cubool)
# Copy scripts into binary directory
file(COPY scripts DESTINATION ${CMAKE_BINARY_DIR}/)
# Copy python related stuff
file(COPY python DESTINATION ${CMAKE_BINARY_DIR}/)