diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-09-15 14:59:17 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-09-16 10:30:27 +0200 |
| commit | b20d6f6906f91f9df608d7800f4e27f7a7160abe (patch) | |
| tree | 8deceb4b89eb5c608699fd80bf6a4f6f13c35cb0 /sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp | |
| parent | f41af9d876d265fbb7febac191d9ba15887252e7 (diff) | |
shiboken6: Add command line options for compiler, path and platform
Task-number: PYSIDE-2057
Task-number: PYSIDE-1812
Change-Id: I3b43e7f747df87174c7feec0b29c292d3bddb23c
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp')
| -rw-r--r-- | sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp index 2e342fefb..9f28402cd 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp @@ -43,6 +43,32 @@ static Compiler _compiler = Compiler compiler() { return _compiler; } +bool setCompiler(const QString &name) +{ + bool result = true; + if (name == u"msvc") + _compiler = Compiler::Msvc; + else if (name == u"g++") + _compiler = Compiler::Gpp; + else if (name == u"clang") + _compiler = Compiler::Clang; + else + result = false; + return result; +} + +QString _compilerPath; // Pre-defined compiler path (from command line) + +const QString &compilerPath() +{ + return _compilerPath; +} + +void setCompilerPath(const QString &name) +{ + _compilerPath = name; +} + static Platform _platform = #if defined (Q_OS_DARWIN) Platform::macOS; @@ -54,6 +80,20 @@ static Platform _platform = Platform platform() { return _platform; } +bool setPlatform(const QString &name) +{ + bool result = true; + if (name == u"windows") + _platform = Platform::Windows; + else if (name == u"darwin") + _platform = Platform::macOS; + else if (name == u"unix") + _platform = Platform::Unix; + else + result = false; + return result; +} + static bool runProcess(const QString &program, const QStringList &arguments, QByteArray *stdOutIn = nullptr, QByteArray *stdErrIn = nullptr) { @@ -255,6 +295,8 @@ static QString findClangBuiltInIncludesDir() static QString compilerFromCMake(const QString &defaultCompiler) { + if (!compilerPath().isEmpty()) + return compilerPath(); // Added !defined(Q_OS_DARWIN) due to PYSIDE-1032 QString result = defaultCompiler; if (platform() != Platform::macOS) |
