forked from flatironinstitute/nifty-ls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
36 lines (27 loc) · 1.12 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
cmake_minimum_required(VERSION 3.15...3.27)
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
# put a symlink to the compile_commands.json in the build dir
# so the LSP can find it in a known directory without the platform tag
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
${CMAKE_CURRENT_BINARY_DIR}/../compile_commands.json
)
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED ${SKBUILD_SABI_COMPONENT})
find_package(nanobind CONFIG REQUIRED)
option(NIFTY_LS_OPENMP "Enable OpenMP support in the compiled extensions" ON)
if(NIFTY_LS_OPENMP)
find_package(OpenMP REQUIRED)
endif()
nanobind_add_module(cpu_helpers src/nifty_ls/cpu_helpers.cpp NOMINSIZE STABLE_ABI)
target_compile_options(cpu_helpers PRIVATE
-Wall -Wextra -std=c++17
)
if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_options(cpu_helpers PRIVATE -Ofast)
endif()
if (OpenMP_CXX_FOUND)
target_link_libraries(cpu_helpers PRIVATE OpenMP::OpenMP_CXX)
endif()
install(TARGETS cpu_helpers LIBRARY DESTINATION nifty_ls)