limbo icon indicating copy to clipboard operation
limbo copied to clipboard

Build for iOS

Open L1onKing opened this issue 10 months ago • 5 comments

Hello everyone!

First of all, thank you for this amazing library!

I’m wondering if anyone has successfully used the Limbo library in an iOS project — either by building it as a static library or by integrating parts of the code directly into the project. If so, could you please share a guide or any tips on how to do it?

Any help would be greatly appreciated! 😊

L1onKing avatar Jun 12 '25 07:06 L1onKing

Hello @L1onKing! Very interesting question.

We've never tried, but I would imagine that everything boils down to 4 things:

  1. Making Boost compile for iOS
  2. Making Eigen compile for iOS
  3. Compiling optional dependencies (mainly for optimizers, e.g. NLOpt, CMAES)
  4. Adapting waf scripts for iOS

I have no experience with iOS development, how would you install Boost/Eigen there? If you cannot install them via a system package or something, you could build them (static libs) and then adapt the waf scripts to look for those libraries/includes.

Overall, I would start with compiling/installing the required Boost libraries (Eigen is header only, so it should be straightforward). We need the following libraries/components from Boost: serialization filesystem system unit_test_framework program_options thread.

Another important issue is with threading: does iOS support threading? If not, we might need to adapt some parts of the library (mainly from library dependencies). Which leads me to the final important point: compiling the optimizer dependencies. For this you should refer to the respective communities/documentations.

Hope this was helpful!

costashatz avatar Jun 12 '25 07:06 costashatz

Hello @costashatz !

Well, boost and eigen are easy. I don't recall using boost on iOS, but I'm 99% confident there are out-of-box solutions that I can use. Eigen is a header-only as you mentioned, so I don't even build it, I just put the code with eigen folder inside my project and I can use it.

NLOpt and waf - that's what worries me. I want limbo to have optimizers, because the task for what I need the library is performance-sensitive. And waf.. well, I have no experience with waf.

Anyway, thanks for your thoughts on the subject, it is helpful! Then I know two areas where I need to focus on. I will share some updates as my progress goes in this thread šŸ‘

L1onKing avatar Jun 15 '25 07:06 L1onKing

Waf is to ease compilation and configuration on Linux, but Limbo is actually header-only (it only compiles examples). For IOS, the only use of WAF would be to setup the proper compilation flags (mostly standard ones: compile in C++-14, activate optimizations like -O3 and select if NLOPT and CMA-ES are activated)

For IOS, I would create an Xcode project and do the compilation of an example using the IOS tools. I would not try to use waf. You can link to NLopt and/or CMAES manually and set the flags the way you want (USE_NLOPT and USE_LIBCMAES). Last, I think Adam does not use any dependencies (no NLOPT or CMA-ES), so you could check if it works for you.

The easiest way would be to compile on Linux an example that works for you, and take inspiration from the compilation lines.

jbmouret avatar Jun 15 '25 09:06 jbmouret

Hey guys!

A small update: I have managed to run limbo inside iOS project. At first I was using it without optimizers, but then I quickly realised the constraint of grid search for my use-case, so I also built NLOpt and successfully attached to it.

So your library works like a charm on iOS as well, just so you know :) If there is a request for it, I will write a comprehensive tutorial on how to use limbo + NLOpt on iOS (NLOpt doesn't provide building instructions for iOS, but it wasn't that hard to figure out) to this thread.

L1onKing avatar Jun 22 '25 09:06 L1onKing

Thank you for the update and I am glad it works. If you have a few hints (maybe not a 'comprehensive tutorial'), I think this could be useful!

jbmouret avatar Jun 22 '25 16:06 jbmouret