-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
29 lines (24 loc) · 966 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
cmake_minimum_required(VERSION 3.10)
set(target_name myLayers)
project(${target_name})
find_package(PythonInterp 3.6 REQUIRED)
find_package(PythonLibs "${PYTHON_VERSION_STRING}" EXACT REQUIRED)
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "import numpy; print(numpy.get_include())"
OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE NUMPY_NOT_FOUND
)
if(NUMPY_NOT_FOUND)
message(FATAL_ERROR "NumPy headers not found")
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(${target_name} MODULE myLayers.cpp)
target_include_directories(${target_name} PRIVATE ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
target_link_libraries(${target_name} ${PYTHON_LIBRARIES})
set_target_properties(${target_name} PROPERTIES PREFIX "")
if(WIN32)
set_target_properties(${target_name} PROPERTIES SUFFIX ".pyd")
endif()