-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
38 lines (30 loc) · 1.21 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
cmake_minimum_required(VERSION 3.15...3.19)
project(ngtpy VERSION "0.1.1")
if(SKBUILD)
# Scikit-Build does not add your site-packages to the search path
# automatically, so we need to add it _or_ the pybind11 specific directory
# here.
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c
"import pybind11; print(pybind11.get_cmake_dir())"
OUTPUT_VARIABLE _tmp_dir
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
list(APPEND CMAKE_PREFIX_PATH "${_tmp_dir}")
endif()
if(PORTABLE_WHEEL)
message(STATUS "Building ngtpy for portable wheels")
set(NGT_MARCH_NATIVE_DISABLED, ON)
set(NGT_AVX_DISABLED ON)
else()
message(STATUS "Building optimized ngtpy for local installation")
# Use same compiler options as NGT
add_compile_options(-Ofast -march=native -DNDEBUG)
endif()
add_subdirectory(extern/NGT EXCLUDE_FROM_ALL)
find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(_ngtpy MODULE src/ngtpy/_ngtpy.cpp)
find_package(OpenMP REQUIRED)
target_link_libraries(_ngtpy PUBLIC OpenMP::OpenMP_CXX)
target_link_libraries(_ngtpy PUBLIC ngtstatic)
target_include_directories(_ngtpy PUBLIC extern/NGT/lib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/extern/NGT/lib)
install(TARGETS _ngtpy DESTINATION .)