<div dir="ltr">Hello all!<div><br></div><div>While reviewing <a href="https://github.com/apple/swift/pull/5904">https://github.com/apple/swift/pull/5904</a>, I had a crazy thought, and I&#39;d like to get some feedback on it.</div><div><br></div><div>Here&#39;s my original comment &lt;<a href="https://github.com/apple/swift/pull/5904#discussion_r89797900">https://github.com/apple/swift/pull/5904#discussion_r89797900</a>&gt;.</div><div><br></div><div>Basically, I notice that we have two sets of targets we compile the Swift runtime and standard library for:</div><div><br></div><div>1. &#39;ALL_APPLE_PLATFORMS&#39;, which is composed of macOS, iOS, tvOS, and watchOS.</div><div>2. The other platforms: Linux, FreeBSD, Android, Cygwin, and (as of the pull request above) Windows.</div><div><br></div><div>In other words:</div><div><br></div><div>1. All the platforms that support Objective-C interop. I suggest we call these &#39;OBJC_INTEROP_PLATFORMS&#39; in CMake.</div><div>2. All the platforms that don&#39;t. I suggest we call these &#39;NO_OBJC_INTEROP_PLATFORMS&#39; in CMake.</div><div><br></div><div>---</div><div><br></div><div>I think the above is a good idea, regardless of how you feel about my other, zanier thought:</div><div><br></div><div>Over the weekend I learned of the mulle-objc project &lt;<a href="https://mulle-objc.github.io">https://mulle-objc.github.io</a>&gt;. It boasts an Objective-C compiler and runtime that works on Linux.</div><div><br></div><div>Now, I don&#39;t know if Swift&#39;s Objective-C interop will work completely with mulle-objc, but I did a bit of experimenting over the weekend, and it seems possible. But one obstacle is the fact that the Swift build system conflates &quot;an Apple target&quot; with &quot;capable of Objective-C interop.&quot; To even start working with mulle-objc, I had to remove a lot of `#ifdef __APPLE__` in the code.</div><div><br></div><div>So I&#39;d like to propose that we augment the build system to allow a person compiling the Swift project to turn Objective-C interop on or off for any given target. That would allow me to compile for Linux, but with Objective-C interop enabled. Alternatively, I could compile for macOS, but with Objective-C interop disabled.</div><div><br></div><div>Any thoughts? I could clean up my local implementation and send a pull request, provided there&#39;s interest.</div><div><br></div><div>- Brian Gesiak</div><div><br></div></div>