[objc] Add support for building the native library with debug information. (#53)
This commit is contained in:
Родитель
c0b00f4222
Коммит
b89e3cf8a0
|
@ -41,3 +41,5 @@ bindings.m
|
||||||
/tests/**/gen/objc
|
/tests/**/gen/objc
|
||||||
/tests/**/gen/java
|
/tests/**/gen/java
|
||||||
packages
|
packages
|
||||||
|
*.dSYM
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,14 @@ namespace Embeddinator {
|
||||||
{
|
{
|
||||||
bool shared = true; // dylib
|
bool shared = true; // dylib
|
||||||
var action = Action.None;
|
var action = Action.None;
|
||||||
|
var debug = false;
|
||||||
|
|
||||||
var os = new OptionSet {
|
var os = new OptionSet {
|
||||||
{ "o|out|outdir=", "output directory", v => OutputDirectory = v },
|
{ "o|out|outdir=", "output directory", v => OutputDirectory = v },
|
||||||
{ "h|?|help", "Displays the help", v => action = Action.Help },
|
{ "h|?|help", "Displays the help", v => action = Action.Help },
|
||||||
{ "v|verbose", "generates diagnostic verbose output", v => ErrorHelper.Verbosity++ },
|
{ "v|verbose", "generates diagnostic verbose output", v => ErrorHelper.Verbosity++ },
|
||||||
{ "version", "Display the version information.", v => action = Action.Version },
|
{ "version", "Display the version information.", v => action = Action.Version },
|
||||||
|
{ "debug", "Build the native library with debug information.", v => debug = true },
|
||||||
};
|
};
|
||||||
|
|
||||||
var assemblies = os.Parse (args);
|
var assemblies = os.Parse (args);
|
||||||
|
@ -64,7 +66,7 @@ namespace Embeddinator {
|
||||||
return 0;
|
return 0;
|
||||||
case Action.Generate:
|
case Action.Generate:
|
||||||
try {
|
try {
|
||||||
return Generate (assemblies, shared);
|
return Generate (assemblies, shared, debug);
|
||||||
} catch (NotImplementedException e) {
|
} catch (NotImplementedException e) {
|
||||||
throw new EmbeddinatorException (1000, $"The feature `{e.Message}` is not currently supported by the tool");
|
throw new EmbeddinatorException (1000, $"The feature `{e.Message}` is not currently supported by the tool");
|
||||||
}
|
}
|
||||||
|
@ -90,7 +92,7 @@ namespace Embeddinator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Generate (List<string> args, bool shared)
|
static int Generate (List<string> args, bool shared, bool debug)
|
||||||
{
|
{
|
||||||
Console.WriteLine ("Parsing assemblies...");
|
Console.WriteLine ("Parsing assemblies...");
|
||||||
|
|
||||||
|
@ -126,6 +128,8 @@ namespace Embeddinator {
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder options = new StringBuilder ("clang ");
|
StringBuilder options = new StringBuilder ("clang ");
|
||||||
|
if (debug)
|
||||||
|
options.Append ("-g -O0 ");
|
||||||
options.Append ("-DMONO_EMBEDDINATOR_DLL_EXPORT ");
|
options.Append ("-DMONO_EMBEDDINATOR_DLL_EXPORT ");
|
||||||
options.Append ("-framework CoreFoundation ");
|
options.Append ("-framework CoreFoundation ");
|
||||||
options.Append ("-framework Foundation ");
|
options.Append ("-framework Foundation ");
|
||||||
|
|
|
@ -8,7 +8,7 @@ managed.dll:
|
||||||
|
|
||||||
libmanaged.dylib: managed.dll
|
libmanaged.dylib: managed.dll
|
||||||
xbuild ../../objcgen/objcgen.csproj
|
xbuild ../../objcgen/objcgen.csproj
|
||||||
mono ../../objcgen/bin/Debug/objcgen.exe managed.dll
|
mono ../../objcgen/bin/Debug/objcgen.exe --debug managed.dll
|
||||||
|
|
||||||
test: libmanaged.dylib
|
test: libmanaged.dylib
|
||||||
clang test-managed.m -lmanaged -L. -framework Foundation -o test-cli
|
clang test-managed.m -lmanaged -L. -framework Foundation -o test-cli
|
||||||
|
|
Загрузка…
Ссылка в новой задаче