-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
23 lines (18 loc) · 861 Bytes
/
CMakeLists.txt
File metadata and controls
23 lines (18 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Build the Python extension for the ppca package.
cmake_minimum_required(VERSION 3.18)
project(ppca-cpp LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Build the C++ core library
add_subdirectory(src/cpp)
# Ensure Python interpreter/dev and pybind11 are available.
set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)
find_package(Python3 COMPONENTS NumPy REQUIRED)
# The C++ core library 'ppca' is expected to exist (built by src/cpp).
pybind11_add_module(_ppca_bindings MODULE ${CMAKE_SOURCE_DIR}/src/python/ppca/_ppca_bindings.cpp)
target_link_libraries(_ppca_bindings PRIVATE ppca)
target_link_libraries(_ppca_bindings PRIVATE Python3::NumPy)
# Install into the Python package directory so scikit-build maps it into the wheel
install(TARGETS _ppca_bindings DESTINATION ppca)