Boost.python and python.h can be added in cmake file.

In uhd/host/example/CMakeLists.txt, add and python library as below solved the 
question.
#for each source: build an executable and install
FOREACH(example_source ${example_sources})
    find_package(PythonLibs REQUIRED) # Added
    include_directories(${PYTHON_INCLUDE_DIRS}) # Added
    GET_FILENAME_COMPONENT(example_name ${example_source} NAME_WE)
    ADD_EXECUTABLE(${example_name} ${example_source})
    TARGET_LINK_LIBRARIES(${example_name} uhd ${Boost_LIBRARIES})
    target_link_libraries(${example_name} ${PYTHON_LIBRARIES} ) # Added
    UHD_INSTALL(TARGETS ${example_name} RUNTIME DESTINATION 
${PKG_LIB_DIR}/examples COMPONENT examples)
ENDFOREACH(example_source)

________________________________
From: USRP-users <usrp-users-boun...@lists.ettus.com> on behalf of Xingjian 
Chen via USRP-users <usrp-users@lists.ettus.com>
Sent: Monday, September 16, 2019 8:36:45 PM
To: USRP-users@lists.ettus.com; usrp-users-boun...@lists.ettus.com
Subject: [USRP-users] How to add gcc compile argument in Makefile for UHD CPP 
for E312?


Hi there,

Good evening. I have a special need to embed python code in CPP for my E312 
because I want to do some data processing and generate a waveform. In order to 
do so, <Python.h> must be included as header, however it requires changing the 
gcc compiler argument. Could someone point me in which file I can add the gcc 
arguments? The argument needed to be added should be something like below. 
Thank you in advance.

gcc mycode.cpp -o mycode -lpython2.7 -lm -L/usr/lib/python2.7/config/ 
-I/usr/include/python2.7/


Best

James
_______________________________________________
USRP-users mailing list
USRP-users@lists.ettus.com
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

Reply via email to