[objc] Add support for building the native library with debug information. (#53)

This commit is contained in:
Rolf Bjarne Kvinge 2017-04-03 17:55:50 +02:00 коммит произвёл Sebastien Pouliot
Родитель c0b00f4222
Коммит b89e3cf8a0
3 изменённых файлов: 9 добавлений и 3 удалений

2
.gitignore поставляемый
Просмотреть файл

@ -41,3 +41,5 @@ bindings.m
/tests/**/gen/objc
/tests/**/gen/java
packages
*.dSYM

Просмотреть файл

@ -36,12 +36,14 @@ namespace Embeddinator {
{
bool shared = true; // dylib
var action = Action.None;
var debug = false;
var os = new OptionSet {
{ "o|out|outdir=", "output directory", v => OutputDirectory = v },
{ "h|?|help", "Displays the help", v => action = Action.Help },
{ "v|verbose", "generates diagnostic verbose output", v => ErrorHelper.Verbosity++ },
{ "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);
@ -64,7 +66,7 @@ namespace Embeddinator {
return 0;
case Action.Generate:
try {
return Generate (assemblies, shared);
return Generate (assemblies, shared, debug);
} catch (NotImplementedException e) {
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...");
@ -126,6 +128,8 @@ namespace Embeddinator {
}
StringBuilder options = new StringBuilder ("clang ");
if (debug)
options.Append ("-g -O0 ");
options.Append ("-DMONO_EMBEDDINATOR_DLL_EXPORT ");
options.Append ("-framework CoreFoundation ");
options.Append ("-framework Foundation ");

Просмотреть файл

@ -8,7 +8,7 @@ managed.dll:
libmanaged.dylib: managed.dll
xbuild ../../objcgen/objcgen.csproj
mono ../../objcgen/bin/Debug/objcgen.exe managed.dll
mono ../../objcgen/bin/Debug/objcgen.exe --debug managed.dll
test: libmanaged.dylib
clang test-managed.m -lmanaged -L. -framework Foundation -o test-cli