This example project is also useful as a template for new CLion projects. Follow these three steps to generate a new mulle-objc project based on the Foundation.
On GitHub generate your own project with MulleObjCClionDemo as the template. Here we are using "myproject" as the new name.
In CLion in the welcome screen or the new/open project dialog
choose "Get from VCS", then enter the URL of your new project:
You may have to trust the project to proceed. In the New/Open Project Wizard that should now open. You neeed to configure the mulle-clang compiler (and optionally the mulle-gdb debugger).
If this doesn't show up, check "File / Settings / Build Execution Deployment / ToolChains", which is the same dialog basically.
On the "Toolchains > CMake" configuration page, you can leave everything as is.
You should now have the local project opened in CLion. But there will be some errors, because libraries aren't installed yet:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
C_WRAP_LIB
linked by target "MulleObjCClionDemo" in directory /home/mulle-kybernetik-tv/CLionProjects/myproject
FOUNDATION_WRAP_LIB
linked by target "MulleObjCClionDemo" in directory /home/mulle-kybernetik-tv/CLionProjects/myproject
FOUNDATION_WRAP_STARTUP_LIB
linked by target "MulleObjCClionDemo" in directory /home/mulle-kybernetik-tv/CLionProjects/myproject
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
To get things to compile you need the Foundation repackaged in a special format and placed
into a folder usr
in your project directory.
For this to work you need to repackage all the Objective-C libraries as well as mulle-sprintf of Foundation into
FoundationWrap. Place the Foundation-startup
, mulle-atinit
, mulle-atexit
libraries into FoundationWrap-startup. Combine all the remaining
C files into a c-wrap library. Create a directory usr/include
and copy all the headers recursively there. Create a directory usr/lib
and copy the three
libraries there.
Check the FoundationWrap" for possibly pre-packaged release archives. Otherwise install the FoundationWrap headers and libraries with mulle-sde.
Assuming your project is called "myproject" and has been placed into ~/CLionProjects
.
mulle-sde install --debug --prefix ~/CLionProjects/myproject/usr https://github.com/MulleFoundation/FoundationWrap
CLion's cmake cache needs to be resetted to work with the new configuration. Chose "Tools / Cmake / Reset Cache and Reload Project"