@@ -24,14 +24,15 @@ public static int Main(string[] args)
24
24
if ( ! File . Exists ( qmake ) )
25
25
{
26
26
Console . WriteLine ( "The specified qmake does not exist." ) ;
27
- return - 1 ;
27
+ return 1 ;
28
28
}
29
29
string make = args [ 1 ] ;
30
30
if ( ! File . Exists ( make ) )
31
31
{
32
32
Console . WriteLine ( "The specified make does not exist." ) ;
33
- return - 1 ;
33
+ return 1 ;
34
34
}
35
+ var debug = args . Length > 2 && ( args [ 2 ] == "d" || args [ 2 ] == "debug" ) ;
35
36
36
37
ConsoleLogger logredirect = new ConsoleLogger ( ) ;
37
38
logredirect . CreateLogDirectory ( ) ;
@@ -45,30 +46,30 @@ public static int Main(string[] args)
45
46
if ( ! string . IsNullOrEmpty ( error ) )
46
47
{
47
48
Console . WriteLine ( error ) ;
48
- return - 1 ;
49
+ return 1 ;
49
50
}
50
51
DirectoryInfo libsInfo = new DirectoryInfo ( libs ) ;
51
52
if ( ! libsInfo . Exists )
52
53
{
53
54
Console . WriteLine (
54
55
"The directory \" {0}\" that qmake returned as the lib direcory of the Qt installation, does not exist." ,
55
56
libsInfo . Name ) ;
56
- return - 1 ;
57
+ return 1 ;
57
58
}
58
- ICollection < string > libFiles = GetLibFiles ( libsInfo ) ;
59
+ ICollection < string > libFiles = GetLibFiles ( libsInfo , debug ) ;
59
60
string headers = ProcessHelper . Run ( qmake , "-query QT_INSTALL_HEADERS" , out error ) ;
60
61
if ( ! string . IsNullOrEmpty ( error ) )
61
62
{
62
63
Console . WriteLine ( error ) ;
63
- return - 1 ;
64
+ return 1 ;
64
65
}
65
66
DirectoryInfo headersInfo = new DirectoryInfo ( headers ) ;
66
67
if ( ! headersInfo . Exists )
67
68
{
68
69
Console . WriteLine (
69
70
"The directory \" {0}\" that qmake returned as the header direcory of the Qt installation, does not exist." ,
70
71
headersInfo . Name ) ;
71
- return - 1 ;
72
+ return 1 ;
72
73
}
73
74
string docs = ProcessHelper . Run ( qmake , "-query QT_INSTALL_DOCS" , out error ) ;
74
75
string emptyFile = Environment . OSVersion . Platform == PlatformID . Win32NT ? "NUL" : "/dev/null" ;
@@ -95,6 +96,13 @@ public static int Main(string[] args)
95
96
}
96
97
}
97
98
var modules = new List < string > { "Qt5Core" , "Qt5Gui" , "Qt5Widgets" , "Qt5Xml" , "Qt5Designer" } ;
99
+ if ( debug )
100
+ {
101
+ for ( var i = 0 ; i < modules . Count ; i ++ )
102
+ {
103
+ modules [ i ] += "d" ;
104
+ }
105
+ }
98
106
libFiles = libFiles . TopologicalSort ( l => dependencies . ContainsKey ( l ) ? dependencies [ l ] : Enumerable . Empty < string > ( ) ) ;
99
107
var wrappedModules = new List < KeyValuePair < string , string > > ( modules . Count ) ;
100
108
var astContexts = new List < ASTContext > ( libFiles . Count ) ;
@@ -130,7 +138,7 @@ public static int Main(string[] args)
130
138
if ( wrappedModules . Count == 0 )
131
139
{
132
140
Console . WriteLine ( "Generation failed." ) ;
133
- return 0 ;
141
+ return 1 ;
134
142
}
135
143
136
144
var qtSharpZip = "QtSharp.zip" ;
@@ -156,14 +164,22 @@ public static int Main(string[] args)
156
164
return 0 ;
157
165
}
158
166
159
- private static IList < string > GetLibFiles ( DirectoryInfo libsInfo )
167
+ private static IList < string > GetLibFiles ( DirectoryInfo libsInfo , bool debug )
160
168
{
161
169
List < string > modules = ( from file in libsInfo . EnumerateFiles ( )
162
170
where Regex . IsMatch ( file . Name , @"^Qt\d?\w+\.\w+$" )
163
171
select file . Name ) . ToList ( ) ;
164
- for ( int i = modules . Count - 1 ; i >= 0 ; i -- )
172
+ for ( var i = modules . Count - 1 ; i >= 0 ; i -- )
165
173
{
166
- modules . Remove ( Path . GetFileNameWithoutExtension ( modules [ i ] ) + "d" + Path . GetExtension ( modules [ i ] ) ) ;
174
+ var module = Path . GetFileNameWithoutExtension ( modules [ i ] ) ;
175
+ if ( debug && module != null && ! module . EndsWith ( "d" ) )
176
+ {
177
+ modules . Remove ( module + Path . GetExtension ( modules [ i ] ) ) ;
178
+ }
179
+ else
180
+ {
181
+ modules . Remove ( module + "d" + Path . GetExtension ( modules [ i ] ) ) ;
182
+ }
167
183
}
168
184
return modules ;
169
185
}
0 commit comments