Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support building on Windows with Clang MSVC target #168

Merged
merged 1 commit into from
Feb 3, 2021

Conversation

triplef
Copy link
Member

@triplef triplef commented Jan 29, 2021

Added support for building on Windows with Clang MSVC target and libobjc2. This requires using a standard (non-MinGW) Clang build that e.g. comes with Visual Studio or is available as pre-built binary from the LLVM website, and requires passing a host to configure like --host=x86_64-pc-windows.

The build is best done in an MSYS2 shell that does not have any additional *-devel packages installed that might get picked up by configure. Alternatively --disable-xxx flags can be used to prevent these dependencies to be picked up.

Annotates all ObjC class interfaces with GS_EXPORT_CLASS for DLL export/import declarations, and adds missing GS_DECLARE annotations in externs.m, in order for these symbols to be correctly exported in the DLL.

I’ll send more info on the mailing list.

Requires gnustep/tools-make#14.

@triplef triplef requested a review from rfm as a code owner January 29, 2021 16:02
Copy link
Contributor

@rfm rfm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all makes sense t me, and looks straightforward, so I don't see any problems.
I have now had a chance to try it out on various platforms, just to make sure nothing has been broken.

@triplef
Copy link
Member Author

triplef commented Feb 3, 2021

Thanks @rfm! I’ll rebase the branch and delete the temporary CI change commit after merging the Make PR and before merging this one. 👍

@triplef triplef force-pushed the clang-msvc-support branch from 916d410 to 81b507f Compare February 3, 2021 11:31
@triplef triplef merged commit 61709e6 into master Feb 3, 2021
@triplef triplef deleted the clang-msvc-support branch February 3, 2021 14:02
@gcasa
Copy link
Member

gcasa commented Feb 3, 2021

While I understand and approve of these changes I am wondering why it isn't possible to change the build of libobjc2 to simply work on MinGW or MSYS2?

@triplef
Copy link
Member Author

triplef commented Feb 4, 2021

MinGW support is also underway in gnustep/libobjc2#190, but it requires fixes in Clang and I haven’t figured out yet how to build Clang with the MinGW patches in a way that David can debug it in Visual Studio.

Hopefully we can support both going forward, as they each have their pros and cons:

MSVC version

  • Pros: can be used with the standard Visual Studio toolchains and tooling, and with any other library that’s built with MSVC.
  • Cons: more involved to build dependencies, as they are not readily available as packages, and each require their own special way to build with MSVC. Hopefully we can remedy this with a set of scripts akin to tools-android.

MinGW version

  • Pros: should be easy to build, with dependencies available as packages.
  • Cons: can only be used with a MinGW toolchain, e.g. all other libraries must also be built with MinGW.

For us, the MSVC version is much more attractive for the above reasons, and it should combine nicely with projects such as C++/WinRT that are not compatible with MinGW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants