generated from pybind/scikit_build_example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (34 loc) · 1.51 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
cmake_minimum_required(VERSION 3.15...3.19)
project(pylira_simd VERSION "0.2.0")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
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()
find_package(pybind11 CONFIG REQUIRED)
find_package(Python3)
include_directories(/usr/local/include /usr/share/R/include/)
include_directories(/usr/include /usr/include/R /usr/include/R/include)
include_directories(src/extern/pybind11/include)
include_directories(src/extern/lira_simd)
include_directories(src/extern/highway)
add_subdirectory(src/extern/highway)
link_directories(/usr/lib/R/lib)
# lira.cpp file needs its absolute location for dynamic dispatch
get_filename_component(_LIRA_SIMD_CPP_FILE_ src/extern/lira_simd/lira.cpp REALPATH)
add_compile_definitions(_LIRA_SIMD_CPP_FILE_="${_LIRA_SIMD_CPP_FILE_}")
pybind11_add_module(_pylira_simd MODULE src/main.cpp)
add_dependencies(_pylira_simd hwy)
add_compile_options(-fPIC -O2)
target_link_libraries(_pylira_simd PUBLIC hwy R Rmath pthread tbb)
target_compile_definitions(_pylira_simd PRIVATE VERSION_INFO=${PROJECT_VERSION})
install(TARGETS _pylira_simd DESTINATION .)