-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
158 lines (127 loc) · 3.36 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
cmake_minimum_required(VERSION 3.10)
project(
BITGRAPH
VERSION 1.0.0
LANGUAGES CXX CUDA
)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CUDA_FLAGS "-forward-unknown-to-host-compiler --expt-relaxed-constexpr --expt-extended-lambda")
# Minimum supported arch is 75
set(CMAKE_CUDA_ARCHITECTURES "86")
set(POSITION_INDEPENDENT_CODE True)
set(INTERFACE_POSITION_INDEPENDENT_CODE True)
find_package(Python 3.10 COMPONENTS Interpreter Development.Module REQUIRED)
add_library(
bitgraph SHARED
structure/BitGraph_construct.cpp
structure/BitGraph_access.cpp
structure/BitGraph_convert.cpp
structure/BitGraph_query.cpp
structure/BitGraph_index.cu
traversal/BitGraphTraversalSource.cpp
step/BitGraphVStep.cpp
strategy/BitGraphStrategy.cpp
strategy/BitGraphSelectionStrategy.cpp
)
target_compile_options(
bitgraph
PUBLIC
-O3
-funsafe-math-optimizations
-frename-registers
-funroll-loops
-fsized-deallocation
)
target_include_directories(
bitgraph
PUBLIC
"include/" # bitgraph path
"../gremlin++" # gremlinxx path
"../maelstrom/include" # maelstrom path
"../faiss" # faiss path
)
function(AddBitGraphExec EXEC_NAME)
add_executable(${EXEC_NAME} ${ARGN})
set_target_properties(
${EXEC_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "bin"
)
target_link_directories(
${EXEC_NAME}
PRIVATE
"../maelstrom/"
"../gremlin++/"
"../faiss/build/faiss"
)
target_link_libraries(
${EXEC_NAME}
PRIVATE
bitgraph
gremlinxx
maelstrom
faiss
)
endfunction()
AddBitGraphExec(
"components.exe" "examples/components.cu"
)
AddBitGraphExec(
"edge_query.exe" "examples/edge_query.cu"
)
AddBitGraphExec(
"shortest_path.exe" "examples/shortest_path.cu"
)
function(AddBitGraphTest EXEC_NAME)
add_executable(${EXEC_NAME} ${ARGN})
set_target_properties(
${EXEC_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "test/bin"
)
target_link_directories(
${EXEC_NAME}
PRIVATE
"../maelstrom/"
"../gremlin++/"
"../faiss/build/faiss"
)
target_link_libraries(
${EXEC_NAME}
PRIVATE
bitgraph
gremlinxx
maelstrom
faiss
)
endfunction()
AddBitGraphTest(
"test_basic.exe" "test/test_basic.cpp"
)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Detect the installed nanobind package and import it into CMake
execute_process(
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE NB_DIR)
list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}")
find_package(nanobind CONFIG REQUIRED)
nanobind_add_module(pybitgraph bindings/PyBitGraph.cpp)
target_link_libraries(
pybitgraph
PRIVATE
bitgraph
gremlinxx
maelstrom
faiss
)
target_link_directories(
pybitgraph
PRIVATE
"../maelstrom/"
"../gremlin++/"
"../faiss/build/faiss"
)