mulle-objc-developer: The Big Picture
As the next community release based on clang 5.0.0 is on the horizon, I’d like to explain from a sort of broader perspective, where this project is going.
The mulle-objc project is a work in progress, which tackles these three objectives:
- the Objective C language and its evolution (mulle-clang, mulle-objc-runtime)
- the Objective-C Foundation based on this runtime (MulleFoundation)
- cross-platform development tools enabling Objective-C everywhere (mulle-sde)
In this article, the focus is on “cross-platform” and how it is supposed to work.
Cross platform development using mulle-objc-developer
Currently if you are developing Objective-C you are probably doing it on Xcode. That means you have your whole project information in an inscrutable
.xcodeproj, which is only useable on MacOS.
I picked cmake as the tool of choice for cross platform development. cmake doesn’t build your project itself. It uses ‘CMakeLists.txt’ to produce the platform specific build system files, let say ninjas
build.ninja or nmakes
Makefile for example. cmake can also be used to create distribution packages for multiple platforms, which is a useful bonus.
What tipped the scales in favor of cmake over other tools was, that it can produce Xcode and Visual Studio project files. So it’s possible to continue to develop in either Xcode or Visual Studio. Having to maintain only one project file for all platforms, is a major win.
CMakeLists.txt file is the center piece of a mulle-objc project. You use mulle-objc-developer (not shown) to setup a project and the initial ‘CMakeLists.txt’.
Then there is the
.bootstrap folder and a cloud-based
bootstrap-info repository. mulle-bootstrap uses them to build the dependency libraries and tools for the specific platform. (‘bootstrap-info’ is somewhat akin to homebrew formula). For mulle-objc projects, this will download and build the runtime and the required libraries.
Then mulle-sde will setup something akin to a virtual environment for you. So if mulle-bootstrap installed some binaries, they will be available and preferred over the built-in binaries.
mulle-build uses this ‘CMakeLists.txt’ and the project source files to produce the platform-specific project output using cmake and make (or ninja, xcodebuild, msbuild..).
Inside mulle-sde you run your editor or IDE of choice. If you start the mulle-sde project monitor, the monitor observes the project filesystem and updates the ‘CMakeLists.txt’ when source files appear, get deleted or have been changed. In then runs mulle-build to build the project and run tests if so desired.
IDEs and mulle-objc
mulle-clang is clang (with some patches) and mulle-lldb is lldb (with even less patches). So if an IDE supports clang, it should be a matter of configuration to replace the standard clang/lldb with the mulle versions.
Generally IDEs will not update the ‘CMakeLists.txt’ file though. So you will have to do double work to maintain the IDE project and the ‘CMakeLists.txt’.
mulle-sde can use tools like mulle-xcode-to-cmake to keep the `CMakeLists.txt in sync for you
Sublime Text 3 as an IDE
Sublime Text is an editor that runs on Mac, Windows, and various Linux flavors. It also has some sort of project management, which I haven’t really bonded with. With project management and building out of the way, due to mulle-sde. It features a plugin system, where you can hook up various external tools to make it pretty much an IDE:
- Completion using EasyClangComplete
- Debugging using SublimeAnarchyDebug
- Jump to definitions using sublime-rtags
Using mulle-clang with Xcode is just a matter of adding another compiler definition. mulle-objc-developer can do this for you. Adding mulle-lldb to Xcode hasn’t been attempted yet.
Visual Studio (Community Edition)
Visual Studio also supports Clang nowadays. Since version 22.214.171.124 mulle-objc has been tested to work on windows, the obstacles to use mulle-clang in VS2015 and later appear surmountable.
Visual Studio Code
Another unexplored option is Visual Studio Code which also has a plugin model.