Skip to content

Instantly share code, notes, and snippets.

@npetrenko
Created December 15, 2018 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save npetrenko/5b382cf5c795d6bca8196bdc7ada8d18 to your computer and use it in GitHub Desktop.
Save npetrenko/5b382cf5c795d6bca8196bdc7ada8d18 to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.13)
project(np_test)
execute_process(
COMMAND "python3" -c "import numpy; print(numpy.get_include(), end='')"
OUTPUT_VARIABLE NUMPY_INCLUDE_DIRS
RESULT_VARIABLE NUMPY_NOTFOUND)
find_package(PythonLibs 3 REQUIRED)
if (NUMPY_NOTFOUND)
message(STATUS "Numpy not found")
exit()
endif()
add_library(nptest SHARED py.cpp)
target_include_directories(nptest PUBLIC ${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment