Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

For Mac (xamarinmac20), dylib must be in Native References #12

Open
tofutim opened this issue Feb 8, 2017 · 1 comment
Open

For Mac (xamarinmac20), dylib must be in Native References #12

tofutim opened this issue Feb 8, 2017 · 1 comment
Assignees

Comments

@tofutim
Copy link

tofutim commented Feb 8, 2017

I think either iOS or Android already do this. Can we duplicate what they do? If, then although the dylib is copied into the /bin directory, it never makes it into the OSX package. Currently, I manually add a reference to libxsqlite3 to the packages directory, but this is not ideal.

libx

(This is a change from previous Xamarin.Mac behavior. Now it is "Xamarin Mac Mobile Framework" so the behavior is getting closer to Xamarin iOS.)

@tofutim tofutim assigned tofutim and holland01 and unassigned tofutim Feb 8, 2017
@tofutim
Copy link
Author

tofutim commented Feb 8, 2017

Perhaps there is no analog. Looks like Xamarin.iOS the .a gets added as an Include/Link. Android, the libraries get Embedded. For Xamarin.Mac, it works to place the libxsqlite3 in Native References. For the csproj, it means adding

  <ItemGroup>
    <NativeReference Include="..\..\..\..\..\..\Users\tim\ownCloud\Loqu8\ext\sqlite\lib_archive\osx\universal\libxsqlite3.dylib">
      <Kind>Dynamic</Kind>
      <SmartLink>False</SmartLink>
    </NativeReference>
  </ItemGroup>

In this case the NativeReference would have to point to the package directory.

Update. iOS in SQLitePCL.raw does this

                        {
                            // throw new NotImplementedException(string.Format("{0}, {1}", cfg.env, cfg.what));

                            // for now, if you have multiple libs, use libtool -static -o new.a old1.a old2.a ... to make a gigantic universal one
                            string lib = string.Format("lib{0}.a", cfg.what);
                            string libPath = libPattern
                                .Replace("$which", "sqlite")
                                .Replace("$platform", "ios")
                                .Replace("$arch", "universal")
                                .Replace("$lib", lib);

                            f.WriteStartElement("ItemGroup");
                            // TODO warning says this is deprecated
                            f.WriteStartElement("ManifestResourceWithNoCulture");
                            // TODO underscore
                            f.WriteAttributeString("Include", Path.Combine(libRoot, libPath));
                            f.WriteElementString("Link", lib);
                            f.WriteEndElement(); // ManifestResourceWithNoCulture
                            f.WriteEndElement(); // ItemGroup
                        }

If we make a version of this for Mac (instead of simply copying it into the /bin directory), it should work. Will need to write an ItemGroup with NativeReference and Kind/SmartLink inside of it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants