-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
94 lines (73 loc) · 3.02 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
project(RAMA LANGUAGES CXX CUDA)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -use_fast_math")
cmake_minimum_required(VERSION 3.22.1)
set(CMAKE_CUDA_ARCHITECTURES OFF)
include_directories(external/ECL-CC)
include_directories(include)
add_library(RAMA INTERFACE)
target_include_directories(RAMA INTERFACE include/)
target_compile_features(RAMA INTERFACE cxx_std_17)
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=compute_60 -code=sm_89")
target_compile_options(RAMA INTERFACE -march=native)
target_compile_options(RAMA INTERFACE -fPIC)
target_include_directories(RAMA INTERFACE external/Eigen)
# external dependencies
set(CPM_DOWNLOAD_VERSION 0.34.0)
if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
)
endif()
include(${CPM_DOWNLOAD_LOCATION})
CPMAddPackage(
NAME pybind11
GIT_TAG master
GITHUB_REPOSITORY pybind/pybind11
OPTIONS
"PYBIND11_CPP_STANDARD -std=c++17"
"PYBIND11_INSTALL ON CACHE BOOL"
)
find_package(pybind11 REQUIRED)
CPMAddPackage("gh:NVIDIA/thrust#main")
find_package(Thrust REQUIRED CONFIG PATHS "${thrust_SOURCE_DIR}")
thrust_create_target(Thrust)
target_link_libraries(RAMA INTERFACE Thrust)
CPMAddPackage("gl:libeigen/eigen#master")
target_include_directories(RAMA INTERFACE "${eigen_SOURCE_DIR}")
CPMAddPackage("gh:CLIUtils/CLI11#main")
target_include_directories(RAMA INTERFACE "${CLI11_SOURCE_DIR}/include")
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(RAMA INTERFACE OpenMP::OpenMP_CXX)
endif()
option(WITH_TORCH "Compile with PyTorch support" OFF)
if(WITH_TORCH)
message(STATUS "Compiling with PyTorch support")
find_package(Torch REQUIRED)
add_definitions(-DWITH_TORCH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
else()
message("Compiling without PyTorch support")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(ECL-CC_11 external/ECL-CC/ECL-CC_11.cu)
target_include_directories(ECL-CC_11 INTERFACE external/ECL-CC)
add_library(gpuMST_boruvka external/cudaMST/gpuMST/gpuMST.cu)
target_link_libraries(gpuMST_boruvka RAMA Thrust)
target_include_directories(gpuMST_boruvka PUBLIC external/cudaMST/gpuMST/)
target_include_directories(gpuMST_boruvka PUBLIC external/cudaMST/common/)
add_library(gpuMST_kruskal external/cudaMST/gpuMSTdpk/gpuMST.cu)
target_link_libraries(gpuMST_kruskal RAMA Thrust)
target_include_directories(gpuMST_kruskal PUBLIC external/cudaMST/gpuMSTdpk/)
target_include_directories(gpuMST_kruskal PUBLIC external/cudaMST/common/)
add_subdirectory(src)
add_subdirectory(test)