Fix python include issue

This commit is contained in:
Carl Philipp Klemm 2025-10-13 16:53:56 +02:00
parent a3fbd2877b
commit b7e323603c
4 changed files with 4 additions and 23 deletions

View file

@ -28,20 +28,7 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(EISMULIPLEXER REQUIRED eismuliplexer)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Python3 REQUIRED)
# Manually set Python include directory if not found
if(NOT Python3_INCLUDE_DIRS)
execute_process(COMMAND python3 -c "import sysconfig; print(sysconfig.get_paths()['include'])"
OUTPUT_VARIABLE PYTHON_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(Python3_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
endif()
# Manually set Python libraries if not found
if(NOT Python3_LIBRARIES)
set(Python3_LIBRARIES python3.12)
endif()
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)

View file

@ -1,7 +1,8 @@
#include "pythonembed.h"
#pragma push_macro("slots")
#undef slots
#include <Python.h>
#pragma pop_macro("slots")
#include <QDebug>
PythonEmbed::PythonEmbed(QTextEdit* outputWidget, QObject* parent)
@ -70,6 +71,3 @@ void PythonEmbed::handlePythonError(const char* context) {
m_outputWidget->append(QString::fromUtf8(context) + ": No error information available");
}
}
#include "pythonembed.moc"

View file

@ -1,5 +1,3 @@
#ifndef PYTHONEMBED_H
#define PYTHONEMBED_H

View file

@ -22,5 +22,3 @@ void PythonRunner::stopScript() {
m_pythonEmbed->stopScript();
}
}
#include "pythonrunner.moc"