Skip to content

mulle-kybernetik-tv/MulleObjCCLionDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MulleObjCCLionDemo

🦭 An example CLion mulle-objc project

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.

1. Generate new CLion project on GitHub

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

Welcome

choose "Get from VCS", then enter the URL of your new project:

URL

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).

configure

If this doesn't show up, check "File / Settings / Build Execution Deployment / ToolChains", which is the same dialog basically.

ToolChains

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.

2. Get mulle-objc Foundation libraries

To get things to compile you need the Foundation repackaged in a special format and placed into a folder usr in your project directory.

mulle-objc version 0.20

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.

mulle-objc version 0.21 (Future as of 1.2022) and beyond

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

3. Reload CMake caches

CLion's cmake cache needs to be resetted to work with the new configuration. Chose "Tools / Cmake / Reset Cache and Reload Project"

image