-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
31 lines (24 loc) · 1018 Bytes
/
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
cmake_minimum_required(VERSION 3.15...3.26)
project(nanobind_project LANGUAGES CXX)
# find_package(OpenMP REQUIRED)
# Try to import all Python components potentially needed by nanobind
find_package(Python 3.8
REQUIRED COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)
# Import nanobind through CMake's find_package mechanism
find_package(nanobind CONFIG REQUIRED)
nanobind_add_module(_deck STABLE_ABI NB_STATIC src/deck.cpp)
# Compiler-specific options
if(MSVC)
# Use MSVC optimization levels and OpenMP setup
target_compile_options(_deck PRIVATE /O2 /std:c++17)
else()
# Assuming GCC or Clang
target_compile_options(_deck PRIVATE -O3)
endif()
# Example debugging
# set solib-search-path /home/user/python/.venv311/lib/python3.11/site-packages/lsdyna_mesh_reader/
# set breakpoint with b _deck.cpp:<LINE_NUMBER>
# target_compile_options(_deck PRIVATE -g -O0)
# Install directive for scikit-build-core
install(TARGETS _deck LIBRARY DESTINATION lsdyna_mesh_reader)