You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/CLI/CLI.cs
+95-43Lines changed: 95 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -10,65 +10,117 @@ namespace CppSharp
10
10
classCLI
11
11
{
12
12
privatestaticOptions_options=newOptions();
13
-
privatestaticList<string>_assemblies;
14
13
15
14
staticvoidAddIncludeDirs(Stringdir)
16
15
{
17
16
_options.IncludeDirs.Add(dir);
18
17
}
19
18
20
-
staticvoidParseCommandLineArgs(string[]args)
19
+
staticboolParseCommandLineArgs(string[]args)
21
20
{
22
-
varshowHelp=args.Length==0;
21
+
varshowHelp=false;
23
22
24
23
varoptionSet=newMono.Options.OptionSet()
25
24
{
26
-
{"h|header=","the path to an header file to generate source from", h =>_options.HeaderFiles.Add(h)},
27
-
{"pa|path=","the path of a folder whose files will generate code (can append a filter at the end like '<path>/*.hpp'", pa =>{GetFilesFromPath(pa);}},
28
-
{"inc|includedir=","the path of a folder to search for include files", i =>{AddIncludeDirs(i);}},
29
-
{"l|library=","the path of a library that includes the definitions for the generated source code", l =>_options.Libraries.Add(l)},
30
-
{"ld|librarydir=","the path of a folder to search for additional libraries", l =>_options.LibraryDirs.Add(l)},
31
-
{"d|define=","a define to add for the parse of the given header files", d =>_options.Defines.Add(d)},
32
-
{"od|outputdir=","the path for the destination folder that will contain the generated code", od =>_options.OutputDir=od},
33
-
{"on|outputnamespace=","the namespace that will be used for the generated code", on =>_options.OutputNamespace=on},
34
-
{"iln|inputlibraryname=","the name of the shared library that contains the actual definitions (without extension)", iln =>_options.InputLibraryName=iln},
35
-
{"isln|inputsharedlibraryname=","the full name of the shared library that contains the actual definitions (with extension)", isln =>_options.InputSharedLibraryName=isln},
36
-
{"gen|generator=","the type of generated code: 'chsarp' or 'cli' ('cli' supported only for Windows)", g =>{GetGeneratorKind(g);}},
37
-
{"p|platform=","the platform that the generated code will target: 'win', 'osx', 'linux'", p =>{GetDestinationPlatform(p);}},
38
-
{"a|arch=","the architecture that the generated code will target: 'x86', 'x64'", a =>{GetDestinationArchitecture(a);}},
25
+
{"I=","the {PATH} of a folder to search for include files", i =>{AddIncludeDirs(i);}},
26
+
{"l=","{LIBRARY} that that contains the symbols of the generated code", l =>_options.Libraries.Add(l)},
27
+
{"L=","the {PATH} of a folder to search for additional libraries", l =>_options.LibraryDirs.Add(l)},
28
+
{"D:","additional define with (optional) value to add to be used while parsing the given header files",(n,v)=>AddDefine(n,v)},
29
+
30
+
{"o=|output=","the {PATH} for the generated bindings file (doesn't need the extension since it will depend on the generator)", v =>HandleOutputArg(v)},
31
+
{"on=|outputnamespace=","the {NAMESPACE} that will be used for the generated code", on =>_options.OutputNamespace=on},
32
+
33
+
{"iln=|inputlibraryname=","the {NAME} of the shared library that contains the symbols of the generated code", iln =>_options.InputLibraryName=iln},
34
+
35
+
{"g=|gen=|generator=","the {TYPE} of generated code: 'chsarp' or 'cli' ('cli' supported only for Windows)", g =>{GetGeneratorKind(g);}},
36
+
{"p=|platform=","the {PLATFORM} that the generated code will target: 'win', 'osx' or 'linux'", p =>{GetDestinationPlatform(p);}},
37
+
{"a=|arch=","the {ARCHITECTURE} that the generated code will target: 'x86' or 'x64'", a =>{GetDestinationArchitecture(a);}},
38
+
39
39
{"c++11","enables GCC C++ 11 compilation (valid only for Linux platform)", cpp11 =>{_options.Cpp11ABI=(cpp11!=null);}},
40
40
{"cs|checksymbols","enable the symbol check for the generated code", cs =>{_options.CheckSymbols=(cs!=null);}},
thrownewNotSupportedException("Input library name not specified and check symbols not enabled. Either set the input library name or the check symbols flag");
thrownewNotSupportedException("Input library name not specified and check symbols is enabled but no libraries were given. Either set the input library name or add at least one library");
51
57
52
58
if(_options.Architecture==TargetArchitecture.x64)
53
59
_triple="x86_64-";
@@ -81,10 +87,10 @@ public void Setup(Driver driver)
0 commit comments