forked from purine/purine2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
78 lines (60 loc) · 2.15 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
cmake_minimum_required (VERSION 2.6)
project (Purine)
# The version number.
set (Purine_VERSION_MAJOR 2)
set (Purine_VERSION_MINOR 0)
# CMake Scripts dir
set(CMAKE_SCRIPT_DIR ${CMAKE_SOURCE_DIR}/CMakeScripts)
#CMake module path for custom module finding
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SCRIPT_DIR})
find_package (CUDA 6.5 REQUIRED)
include_directories (${CUDA_INCLUDE_DIRS})
# Google-glog
find_package(Glog REQUIRED)
include_directories(${GLOG_INCLUDE_DIRS})
# Google-gflags
find_package(GFlags REQUIRED)
include_directories(${GFLAGS_INCLUDE_DIRS})
# BLAS
find_package(Atlas REQUIRED)
include_directories(${Atlas_INCLUDE_DIR})
set(BLAS_LIBRARIES ${Atlas_LIBRARIES})
find_package(LibUV REQUIRED)
include_directories(${LIBUV_INCLUDE_DIRS})
find_package(LMDB REQUIRED)
include_directories(${LMDB_INCLUDE_DIR})
find_package(MPI)
include_directories(${MPI_INCLUDE_PATH})
include_directories(${PROJECT_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_20,code=sm_20
-gencode arch=compute_20,code=sm_21
-gencode arch=compute_30,code=sm_30
-gencode arch=compute_35,code=sm_35
-gencode arch=compute_50,code=sm_50
-gencode arch=compute_50,code=compute_50
)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-std=c++11
)
add_subdirectory(caffeine/proto)
file(GLOB_RECURSE PURINE_CU_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cu)
cuda_add_library(purine_cu STATIC ${PURINE_CU_SOURCES})
file(GLOB_RECURSE PURINE_CPP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
file(GLOB_RECURSE TEST_CPP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/test_*.cpp)
file(GLOB_RECURSE EXAMPLE_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} examples/*.cpp)
list(REMOVE_ITEM PURINE_CPP_SOURCES ${TEST_CPP_SOURCES})
list(REMOVE_ITEM PURINE_CPP_SOURCES ${EXAMPLE_SOURCES})
add_library(purine STATIC ${PURINE_CPP_SOURCES})
target_link_libraries(purine purine_cu proto
${CUDA_CUBLAS_LIBRARIES}
${CUDA_curand_LIBRARY}
${BLAS_LIBRARIES}
${MPI_C_LIBRARIES}
${LMDB_LIBRARIES}
/usr/local/lib/libcudnn.so
)
CUDA_ADD_CUBLAS_TO_TARGET(purine)
add_subdirectory(tests)
add_subdirectory(examples)