Skip to content

Instantly share code, notes, and snippets.

@ninjakx
Created July 26, 2019 05:25
Show Gist options
  • Save ninjakx/f18242a00e907c808650dfdc8891ffdf to your computer and use it in GitHub Desktop.
Save ninjakx/f18242a00e907c808650dfdc8891ffdf to your computer and use it in GitHub Desktop.
rm *.o myknn_wrap.cpp _myknn.so myknn.py
rm -rf __pycache__
g++ -O3 -march=native -fPIC -c myknn.cpp
# Invoke SWIG on the interface file 'knn.i' to produce C/C++ wrapper
# code ('knn_wrap.cpp'):
swig -python -c++ -o myknn_wrap.cpp myknn.i
# Next, compile the wrapper code:
g++ -O3 -march=native -w -fPIC -c $(pkg-config --cflags --libs python3) -I /home/kriti/anaconda3/lib/python3.7/site-packages/numpy/core/include myknn.cpp myknn_wrap.cpp
g++ -std=c++11 -O3 -march=native -shared myknn.o myknn_wrap.o -o _myknn.so -lm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment