I have a C++ logic which I'm calling from Python. I have created a setup.py using distutils to build and install. The C++ logic has a cmake file. To build the C++ this cmake file needs to be incorporated into the setup.py file. How can I do this? Below is my cmake file for the C++ code.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
set(name "facerec")
project(facerec_cpp_samples)
#SET(OpenCV_DIR /path/to/your/opencv/installation)
# packages
find_package(OpenCV REQUIRED) # http://opencv.willowgarage.com
add_executable(fisherfaces_app fisherfaces_app.cpp)
target_link_libraries(fisherfaces_app opencv_contrib opencv_core opencv_imgproc opencv_highgui)
Below is my setup.py file.
from distutils.core import setup,Extension
extension_mod=Extension("getGender",["getGender.cpp"])
setup(name="getGender",ext_modules=[extension_mod])
I am new to embedded python and cmake. Please advice on how to do this.
So rather than messing it up with both cmake and setup.py, I incorporated the Python header file into cmake and built a shared library. Then used this shared library to call my functions from Python. My cmake is as follows,