Skip to content

Commit

Permalink
make "-ObjC" an option to be added into LinkerOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuang-i committed Oct 11, 2023
1 parent e4486bb commit 4b1c4c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sharpmake.Generators/Apple/XCodeProj.cs
Expand Up @@ -1248,8 +1248,9 @@ private Options.ExplicitOptions GenerateOptions(XCodeGenerationContext context)

var linkerOptions = new Strings(conf.AdditionalLinkerOptions);

// TODO: make this an option
linkerOptions.Add("-ObjC");
var linkObjC = Options.GetObject<Options.XCode.Linker.LinkObjC>(conf);
if (linkObjC == Options.XCode.Linker.LinkObjC.Enable)
linkerOptions.Add("-ObjC");

// linker(ld) of Xcode: only accept libfilename without prefix and suffix.
linkerOptions.AddRange(libFiles.Select(library =>
Expand Down
10 changes: 10 additions & 0 deletions Sharpmake/Options.XCode.cs
Expand Up @@ -1132,6 +1132,16 @@ public PrelinkLibraries(string path)
{
}
}

/// <summary>
/// When enable, "-ObjC" will be added into LinkerOptions, then linker Loads all members of static archive libraries that implement an Objective-C class or category.
/// </summary>
public enum LinkObjC
{
Disable,
[Default]
Enable
}
}

/// <summary>
Expand Down

0 comments on commit 4b1c4c5

Please sign in to comment.