7
7
using System . Reflection ;
8
8
using System . Text . RegularExpressions ;
9
9
using CppSharp ;
10
+ using CppSharp . Utils ;
10
11
11
12
namespace QtSharp . CLI
12
13
{
@@ -88,18 +89,19 @@ static bool QueryQt(QtInfo qt, bool debug)
88
89
path = Path . GetDirectoryName ( qt . Make ) + Path . PathSeparator + path ;
89
90
Environment . SetEnvironmentVariable ( "Path" , path , EnvironmentVariableTarget . Process ) ;
90
91
91
- string error ;
92
- qt . Bins = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_BINS" , out error ) ;
93
- if ( ! string . IsNullOrEmpty ( error ) )
92
+ int error ;
93
+ string errorMessage ;
94
+ qt . Bins = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_BINS" , out error , out errorMessage ) ;
95
+ if ( ! string . IsNullOrEmpty ( errorMessage ) )
94
96
{
95
- Console . WriteLine ( error ) ;
97
+ Console . WriteLine ( errorMessage ) ;
96
98
return false ;
97
99
}
98
100
99
- qt . Libs = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_LIBS" , out error ) ;
100
- if ( ! string . IsNullOrEmpty ( error ) )
101
+ qt . Libs = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_LIBS" , out error , out errorMessage ) ;
102
+ if ( ! string . IsNullOrEmpty ( errorMessage ) )
101
103
{
102
- Console . WriteLine ( error ) ;
104
+ Console . WriteLine ( errorMessage ) ;
103
105
return false ;
104
106
}
105
107
@@ -112,10 +114,10 @@ static bool QueryQt(QtInfo qt, bool debug)
112
114
return false ;
113
115
}
114
116
qt . LibFiles = GetLibFiles ( libsInfo , debug ) ;
115
- qt . Headers = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_HEADERS" , out error ) ;
116
- if ( ! string . IsNullOrEmpty ( error ) )
117
+ qt . Headers = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_HEADERS" , out error , out errorMessage ) ;
118
+ if ( ! string . IsNullOrEmpty ( errorMessage ) )
117
119
{
118
- Console . WriteLine ( error ) ;
120
+ Console . WriteLine ( errorMessage ) ;
119
121
return false ;
120
122
}
121
123
DirectoryInfo headersInfo = new DirectoryInfo ( qt . Headers ) ;
@@ -126,11 +128,11 @@ static bool QueryQt(QtInfo qt, bool debug)
126
128
headersInfo . Name ) ;
127
129
return false ;
128
130
}
129
- qt . Docs = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_DOCS" , out error ) ;
131
+ qt . Docs = ProcessHelper . Run ( qt . QMake , "-query QT_INSTALL_DOCS" , out error , out errorMessage ) ;
130
132
131
133
string emptyFile = Platform . IsWindows ? "NUL" : "/dev/null" ;
132
134
string output ;
133
- ProcessHelper . Run ( "gcc" , string . Format ( "-v -E -x c++ {0 }" , emptyFile ) , out output ) ;
135
+ ProcessHelper . Run ( "gcc" , $ "-v -E -x c++ { emptyFile } ", out error , out output ) ;
134
136
qt . Target = Regex . Match ( output , @"Target:\s*(?<target>[^\r\n]+)" ) . Groups [ "target" ] . Value ;
135
137
136
138
const string includeDirsRegex = @"#include <\.\.\.> search starts here:(?<includes>.+)End of search list" ;
@@ -150,24 +152,6 @@ static bool QueryQt(QtInfo qt, bool debug)
150
152
return true ;
151
153
}
152
154
153
- static void ProcessGeneratedInlines ( )
154
- {
155
- if ( ! Platform . IsWindows )
156
- return ;
157
-
158
- #if DEBUG
159
- if ( File . Exists ( "../../../QtSharp.Tests/bin/Debug/QtCore-inlines.dll" ) )
160
- File . Delete ( "../../../QtSharp.Tests/bin/Debug/QtCore-inlines.dll" ) ;
161
-
162
- File . Copy ( "release/QtCore-inlines.dll" , "../../../QtSharp.Tests/bin/Debug/QtCore-inlines.dll" ) ;
163
- #else
164
- if ( File . Exists ( "../../../QtSharp.Tests/bin/Release/QtCore-inlines.dll" ) )
165
- File . Delete ( "../../../QtSharp.Tests/bin/Release/QtCore-inlines.dll" ) ;
166
-
167
- File . Copy ( "release/QtCore-inlines.dll" , "../../../QtSharp.Tests/bin/Release/QtCore-inlines.dll" ) ;
168
- #endif
169
- }
170
-
171
155
public static int Main ( string [ ] args )
172
156
{
173
157
Stopwatch s = Stopwatch . StartNew ( ) ;
@@ -213,8 +197,6 @@ public static int Main(string[] args)
213
197
ConsoleDriver . Run ( qtSharp ) ;
214
198
var wrappedModules = qtSharp . GetVerifiedWrappedModules ( ) ;
215
199
216
- ProcessGeneratedInlines ( ) ;
217
-
218
200
if ( wrappedModules . Count == 0 )
219
201
{
220
202
Console . WriteLine ( "Generation failed." ) ;
0 commit comments