-
Notifications
You must be signed in to change notification settings - Fork 24
/
CMakeLists.txt
34 lines (33 loc) · 1.22 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
cmake_minimum_required(VERSION 3.2)
project(MHCUDA)
find_package(OpenMP REQUIRED)
find_package(CUDA QUIET REQUIRED)
if (NOT DISABLE_PYTHON)
find_package(PythonLibs 3 REQUIRED)
endif()
if (PROFILE OR CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPROFILE")
endif()
#set(CMAKE_VERBOSE_MAKEFILE on)
if (NOT DEFINED CUDA_ARCH)
set(CUDA_ARCH "80")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -march=native -Wall -Werror -DCUDA_ARCH=${CUDA_ARCH} -std=c++17 ${OpenMP_CXX_FLAGS}")
if (DEBUGINFO)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif()
set(SOURCE_FILES minhashcuda.cc minhashcuda.h wrappers.h private.h kernel.cu)
if (NOT DISABLE_PYTHON)
list(APPEND SOURCE_FILES python.cc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${NUMPY}")
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(NVCC_FLAGS "-G -g")
endif()
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -arch=sm_${CUDA_ARCH} -Xptxas=-v -D_MWAITXINTRIN_H_INCLUDED -D_FORCE_INLINES")
cuda_add_library(MHCUDA SHARED ${SOURCE_FILES} OPTIONS ${NVCC_FLAGS})
target_link_libraries(MHCUDA ${CUDA_curand_LIBRARY})
if(PYTHONLIBS_FOUND)
include_directories(${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDES})
target_link_libraries(MHCUDA ${PYTHON_LIBRARIES})
endif()