Another attempt at fixing the 'do we need the --embed flag for Python' problem.

This change looks at the output from python-config --help (which may go
to stderr or stdout), and if it includes --embed, adds it to the later
call to get the libs string.
This commit is contained in:
Dave Page 2020-04-29 16:19:54 +01:00
parent 97be3d8179
commit e8a4b46ba1

View File

@ -73,15 +73,11 @@ else {
message(Using $$PYTHON_CONFIG)
PYTHON_VERSION = $$system($$PYTHON_CONFIG --libs | grep -o -i "[0-9]\.[0-9]" | sed "s/\.//g")
PYTHON_EMBED = $$system($$PYTHON_CONFIG --help 2>&1 | grep -o \'\\-\\-embed\')
QMAKE_CXXFLAGS += $$system($$PYTHON_CONFIG --includes)
QMAKE_LFLAGS += $$system($$PYTHON_CONFIG --ldflags)
greaterThan(PYTHON_VERSION, 37) {
LIBS += $$system($$PYTHON_CONFIG --libs --embed)
} else {
LIBS += $$system($$PYTHON_CONFIG --libs)
}
LIBS += $$system($$PYTHON_CONFIG --libs $$PYTHON_EMBED)
contains( LIBS, -lpython2.* ) {
DEFINES += PYTHON2