Commit 26fa3740 authored by David Schulz's avatar David Schulz
Browse files

Debugger: check for python when builing cdbext with qbs



Change-Id: Ife169124f9fcd885774cd39698281e9a64e4545b
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent 8e178c08
......@@ -2,6 +2,8 @@ import qbs
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Process
import qbs.Utilities
QtcLibrary {
condition: qbs.toolchain.contains("msvc") && cdbPath
......@@ -45,11 +47,95 @@ QtcLibrary {
}
return undefined;
}
cpp.includePaths: [FileInfo.joinPaths(cdbPath, "inc")]
cpp.dynamicLibraries: [
"user32.lib",
FileInfo.joinPaths(cdbLibPath, "dbgeng.lib")
]
property string pythonInstallDir: Environment.getEnv("PYTHON_INSTALL_DIR")
Probe {
id: pythonDllProbe
condition: product.condition
property string pythonDir: pythonInstallDir // Input
property string buildVariant: qbs.buildVariant // Input
property string fileNamePrefix // Output
configure: {
function printWarning(msg) {
console.warn(msg + " The python dumpers for cdb will not be available.");
}
if (!pythonDir) {
printWarning("PYTHON_INSTALL_DIR not set.");
return;
}
if (!File.exists(pythonDir)) {
printWarning("The provided python installation directory '" + pythonDir
+ "' does not exist.");
return;
}
var p = new Process();
try {
var pythonFilePath = FileInfo.joinPaths(pythonDir, "python.exe");
p.exec(pythonFilePath, ["--version"], true);
var output = p.readStdOut().trim();
var magicPrefix = "Python ";
if (!output.startsWith(magicPrefix)) {
printWarning("Unexpected python output when checking for version: '"
+ output + "'");
return;
}
var versionNumberString = output.slice(magicPrefix.length);
var versionNumbers = versionNumberString.split('.');
if (versionNumbers.length < 2) {
printWarning("Unexpected python output when checking for version: '"
+ output + "'");
return;
}
if (Utilities.versionCompare(versionNumberString, "3.5") < 0) {
printWarning("The python installation at '" + pythonDir
+ "' has version " + versionNumberString + ", but 3.5 or higher "
+ "is required.");
return;
}
found = true;
fileNamePrefix = "python" + versionNumbers[0] + versionNumbers[1];
if (buildVariant === "debug")
fileNamePrefix += "_d"
} finally {
p.close();
}
}
}
Group {
name: "pythonDumper"
condition: pythonDllProbe.found
files: [
"pycdbextmodule.cpp",
"pycdbextmodule.h",
"pyfield.cpp",
"pyfield.h",
"pystdoutredirect.cpp",
"pystdoutredirect.h",
"pytype.cpp",
"pytype.h",
"pyvalue.cpp",
"pyvalue.h",
]
}
cpp.defines: ["WITH_PYTHON=1"]
cpp.includePaths: {
var paths = [FileInfo.joinPaths(cdbPath, "inc")];
if (pythonDllProbe.found)
paths.push(FileInfo.joinPaths(pythonInstallDir, "include"));
return paths;
}
cpp.dynamicLibraries: {
var libs = [ "user32.lib", FileInfo.joinPaths(cdbLibPath, "dbgeng.lib") ];
if (pythonDllProbe.found)
libs.push(FileInfo.joinPaths(pythonInstallDir, "libs",
pythonDllProbe.fileNamePrefix + ".lib"));
return libs;
}
cpp.linkerFlags: ["/DEF:" + FileInfo.toWindowsSeparators(
FileInfo.joinPaths(product.sourceDirectory,
"qtcreatorcdbext.def"))]
......@@ -61,6 +147,16 @@ QtcLibrary {
dirName += "32";
return FileInfo.joinPaths(qtc.libDirName, dirName);
}
Group {
condition: pythonDllProbe.found
files: [FileInfo.joinPaths(pythonInstallDir, pythonDllProbe.fileNamePrefix + ".dll")]
qbs.install: true
qbs.installDir: installDir
}
useNonGuiPchFile: false
files: [
"common.cpp",
"common.h",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment