-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
36 lines (29 loc) · 1.47 KB
/
CMakeLists.txt
File metadata and controls
36 lines (29 loc) · 1.47 KB
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
cmake_minimum_required(VERSION 3.15...3.25)
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION})
find_package(pybind11 CONFIG REQUIRED)
# Sets -fPIC. Necessary because Dragonbox builds a static library. Any static library loaded to Python needs -fPIC.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Accept a pointer to the directory to include fast_matrix_market from.
# This is needed in some build systems where pip may relocate this directory but not the parent,
# thus breaking the symbolic links in ./fast_matrix_market/
if(DEFINED ENV{FMM_PYTHON_DIR})
set(FMM_CWD "$ENV{FMM_PYTHON_DIR}/python")
else()
set(FMM_CWD ".")
endif()
set(FMM_DIR "${FMM_CWD}/fast_matrix_market")
message("Including fast_matrix_market from: ${FMM_DIR}")
add_subdirectory(${FMM_DIR} cmake-build)
pybind11_add_module(_fmm_core MODULE
src/fast_matrix_market/_fmm_core.cpp
src/fast_matrix_market/_fmm_core_read_array.cpp
src/fast_matrix_market/_fmm_core_read_coo.cpp
src/fast_matrix_market/_fmm_core_write_array.cpp
src/fast_matrix_market/_fmm_core_write_coo_32.cpp
src/fast_matrix_market/_fmm_core_write_coo_64.cpp
src/fast_matrix_market/_fmm_core_write_csc_32.cpp
src/fast_matrix_market/_fmm_core_write_csc_64.cpp
)
target_compile_definitions(_fmm_core PRIVATE VERSION_INFO=${PROJECT_VERSION})
target_link_libraries(_fmm_core PRIVATE fast_matrix_market::fast_matrix_market)
install(TARGETS _fmm_core DESTINATION fast_matrix_market)