new file mode 100755
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+python np_setup.py --pykslibdir=$1 \
+ --trlibdir=$2 \
+ --trincdir=$3 \
+ --evlibdir=$4 \
+ --evincdir=$5 \
+ --jsnincdir=$6 \
+ build_ext -i &> pybuild.log
+
+if grep -q 'error:' pybuild.log; then
+ cat pybuild.log
+fi
+
+if grep -q 'Error:' pybuild.log; then
+ cat pybuild.log
+fi
+
+WC=$(grep 'warning' pybuild.log | wc -l)
+if ((WC > 2)); then
+ cat pybuild.log
+fi
+
+if grep -q 'usage:' pybuild.log; then
+ cat pybuild.log
+fi
@@ -45,6 +45,26 @@ if (PYTHONLIBS_FOUND AND CYTHON_FOUND AND NUMPY_FOUND)
${CMAKE_DL_LIBS}
${JSONC_LIBRARIES})
+
+ add_custom_target(kshark_wrapper ALL DEPENDS pykshark libkshark-py.c
+ COMMENT "Generating libkshark_wrapper.c")
+
+ add_custom_command(TARGET kshark_wrapper
+ PRE_BUILD
+ COMMAND ./pybuild.sh ${KS_DIR}/lib/
+ ${TRACECMD_LIBRARY_DIR} ${TRACECMD_INCLUDE_DIR}
+ ${TRACEEVENT_LIBRARY_DIR} ${TRACEEVENT_INCLUDE_DIR}
+ ${JSONC_INCLUDE_DIR}
+ COMMAND cp libkshark_wrapper.so ${KS_DIR}/bin
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/py
+ DEPENDS ${KS_DIR}/build/py/np_setup.py ${KS_DIR}/src/libkshark-py.c
+ )
+
+ set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
+ "${KS_DIR}/bin/libkshark_wrapper.so"
+ "${KS_DIR}/build/py/libkshark_wrapper.so"
+ "${KS_DIR}/build/py/libkshark_wrapper.c")
+
endif (PYTHONLIBS_FOUND AND CYTHON_FOUND AND NUMPY_FOUND)
if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
CMAKE will call the python script that build the NumPy interface. It will also takes care about cleaning. Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> --- kernel-shark/build/py/pybuild.sh | 26 ++++++++++++++++++++++++++ kernel-shark/src/CMakeLists.txt | 20 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 kernel-shark/build/py/pybuild.sh