Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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.

C++
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.

Python
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.
Posted

1 solution

I don't think you can... if you want to use CMake, you'd have to use Swig to tie your C++ in with your Python. You're sort of mixing two things that don't have too much to do with each other.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900