@@ -74,9 +74,29 @@ void SetupTargetTriple()
74
74
75
75
public bool ValidateOptions ( List < string > messages )
76
76
{
77
+ if ( options . HeaderFiles . Count == 0 )
78
+ {
79
+ messages . Add ( "No source header file has been given to generate bindings from." ) ;
80
+ return false ;
81
+ }
82
+
77
83
if ( ! options . Platform . HasValue )
78
84
options . Platform = GetCurrentPlatform ( ) ;
79
85
86
+ if ( string . IsNullOrEmpty ( options . OutputDir ) )
87
+ {
88
+ options . OutputDir = Path . Combine ( Directory . GetCurrentDirectory ( ) , "gen" ) ;
89
+ }
90
+
91
+ var dir = Path . GetDirectoryName ( options . HeaderFiles . First ( ) ) ;
92
+ var moduleName = new DirectoryInfo ( dir ) . Name ;
93
+
94
+ if ( string . IsNullOrEmpty ( options . OutputFileName ) )
95
+ options . OutputFileName = moduleName ;
96
+
97
+ if ( string . IsNullOrEmpty ( options . OutputNamespace ) )
98
+ options . OutputNamespace = moduleName ;
99
+
80
100
if ( Platform . IsWindows && options . Platform != TargetPlatform . Windows )
81
101
{
82
102
messages . Add ( "Cannot create bindings for a platform other that Windows from a Windows host." ) ;
@@ -105,36 +125,6 @@ public bool ValidateOptions(List<string> messages)
105
125
return false ;
106
126
}
107
127
108
- if ( options . HeaderFiles . Count == 0 )
109
- {
110
- messages . Add ( "No source header file has been given to generate bindings from." ) ;
111
- return false ;
112
- }
113
-
114
- if ( string . IsNullOrEmpty ( options . OutputNamespace ) )
115
- {
116
- messages . Add ( "Output namespace not specified (see --outputnamespace option)." ) ;
117
- return false ;
118
- }
119
-
120
- if ( string . IsNullOrEmpty ( options . OutputFileName ) )
121
- {
122
- messages . Add ( "Output directory not specified (see --output option)." ) ;
123
- return false ;
124
- }
125
-
126
- if ( string . IsNullOrEmpty ( options . InputLibraryName ) && ! options . CheckSymbols )
127
- {
128
- messages . Add ( "Input library name not specified and check symbols option not enabled.\n Either set the input library name or the check symbols flag." ) ;
129
- return false ;
130
- }
131
-
132
- if ( string . IsNullOrEmpty ( options . InputLibraryName ) && options . CheckSymbols && options . Libraries . Count == 0 )
133
- {
134
- messages . Add ( "Input library name not specified and check symbols is enabled but no libraries were given.\n Either set the input library name or add at least one library." ) ;
135
- return false ;
136
- }
137
-
138
128
SetupTargetTriple ( ) ;
139
129
140
130
0 commit comments