I would like to port the arithmetic processing (written in C ++) using Point Cloud Library to an iOS application (swift). Is it possible to use PCL with swift?
There is no supported version of PCL compiled for arm64 yet. However, the following project may be useful:
https://github.com/patmarion/pcl-superbuild
It has difficulties with the current version of Boost for iOS, so you can replace Boost with a project like this:
https://github.com/danoli3/ofxiOSBoost/
Or maybe you can use the precompiled libraries from a project like this:
https://github.com/stevenroach7/3DScanr/tree/master/PCL_Build_Artifacts
Related
I have a native C library (.so) build in versions for android and iOS. I want them to be used in a flutter app I am building.
For android I use System.loadLibrary() in Java to load the file (wrapped in JNI) and it is included via the Gradle build system/CMake.
But how do I get the same for iOS in objective C ?
Seems like I can use dlopen() on the library and then dlsym() every single function to get their symbol into the app at runtime. Seems pretty dump but I guess it could work (when I at some point have convinced the buildsystem to include the lib into the actual package it builds.
I wrote a game for Android using Android NDK. Core of game logic written in pure C++. So, I want to port it to iOS. I know how to port Java (JNI) wrapping to Objective-C.
My question is how to organize this project on FS? I want to keep a single code base, and I use git (link).
First, note that there should be no need at all do wrap your C++ code: the objective-C extension of the C language is also compatible with C++. So, you can compile your code as "Objective-C++" and directly use C++ classes with Objective-C code.
Second, you can put your code anywhere you wish on the disk. Both eclipse for Android and xcode for iOS will let you include source code into your project from any relative directory.
If you ever need platform-specific native code you can use #ifdef __ANDROID__ for android-specific code inside your C++.
I'm working on a plugin in Unity3D for iOS. For some reason, I need to specify some code in the native code (.mm in Xcode) to be compiled under before Unity3D 4.1 and other be compiled after Unity3D 4.1(including). Maybe something like this:
#if UNITY_VERSION < UNITY_4_1
//Some code be compiled before Unity4.1
#else
//Some code for new version
#endif
I know there is a Platform Dependent Compilation in the Unity3D Editor, but how can I get the engine's version in Xcode and do a "Unity Engine version based condition compilation"? Any suggestion will be appreciated!
Edit: Maybe I can write two .mm files for different version and delete one of them in [PostProcessAttribute]. But I don't think it is a good idea...
It isn't exactly clear on what you are trying to do. Are you building your native code by injecting into the XCode project that Unity creates? Or are you building your native code to a library that is included by Unity during the build?
AFAIK there is no way for XCode to know ahead of time which version of Unity you are using without examing the install of Unity and figuring out a way to determine that.
If you doing the latter, i.e. building a native code library that is included into Unity's build. You would need two separate libraries in that case, and instruct the user to include whichever one is relevant.
If you are doing the former, i.e. injecting new native code into the XCode project that Unity created then Unity does export the #defines so you could then determine which version of Unity your native code needs to compile against.
I want to embed mono into my iOS application. I do not want to use MonoTouch. I want to embed mono manually like this:
http://www.mono-project.com/Embedding_Mono
I've have done this successfully on windows, using the above guide and various online examples, here's a good Windows one:
https://github.com/inkdev/Embedded-Mono-Sample
However I'm having trouble getting started on iOS. I know it can be done, companies like Unity3d use it to power their game engine tech. I can't work out how to compile and link mono for iOS nor can I find any good instructions to do so. I've not found any help using search engines, they exclusively seem to turn up articles about MonoTouch (Xamarin's own commercial wrapper around embedding mono into iOS).
Here's a few more noteworthy links:
http://www.mono-project.com/Mono:ARM
http://web.archive.org/web/20090106023130/http://mono-project.com./Mono:Iphone
Is there somewhere I can get precompiled libraries and headers for Mono for iOS, so in my C code I can simply link and include?
Could someone provide and example of how to compile mono for iOS ARM CPUs?
MonoTouch provides a great wrapper around all of the iOS Objective C APIs, however you don't necessarily need all of that, as I understand it should be possible to compile and then embed mono yourself and then use pInvoke to call the few native functions you will need.
Any help would be greatly appreciated, ty!
While not exactly what you are asking for, iOS 7 has added support for scripting with JavaScript. Many people finding this post may want to use this new capability to achieve what you are attempting. Link
As Rolf said, you need to read Mono Licensing document first. Embedding mono on iOS requires special permission from Xamarin.
You need to change several build settings from XCode, and here's what I did.
Open (or Create) iOS project
Add libmonoboehm-2.0.a to your project(You can use another version of .a file)
It's in Library/Frameworks/Mono.framework/Versions/{version}/lib folder
Project -> Build Settings -> Header Search
Add path: /Library/Frameworks/Mono.frameworks/Versions/{version}/include/mono-2.0
Project -> Build Settings -> Library Search
Add path: /Library/Frameworks/Mono.frameworks/Versions/{version}/lib
And, code like this in your iOS application
#include <mono/jit/jit.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/environment.h>
// ....
const char* dllFile = "ABSOLUTE_PATH_TO_DLL_OR_EXE";
domain = mono_jit_init(dllFile);
mAssembly = mono_domain_assembly_open(domain, dllFile);
// ... Do whatever you want :)
Please remember. You need to get license from Xamarin when embedding mono on iOS.
Enjoy :)
For one of my current iOS project, some business logic has been provided to me through a DLL and Native C++ binding code that i have to recompile in a dynamic library (dylib) and then use the DLL through this dynamic library.
Finally the DLL is used like this example:
int main(int argc, char** argv){
RTEnvironnement::CreateRTEnvironnement("../dll/RT.dll");
RT::RT_Facade * mFacade = new RT::RT_Facade();
RT::RT_Data_Projet * mProjet = new RT::RT_Data_Projet();
mProjet->Load_From_XMLFile(argv[1]);
...
Objects RTEnvironnement, RT_Facade, RT_Data_Projet are provided by the binding C++ dynamic lib. I cannot get the code of the base DLL and i have to use the DLL as it is on IOS.
I'm currently studying if mono touch can able my IOS app (basic iOS Objective C based on Xcode ), to launch the DLL that as been build with the standard mono framework. Before purchasing a license, I have to be sure that MonoTouch is able to do this.
Is someone do something similar ? Is there a simplest way to this ?
If i choose to use MonoTouch, can i keep my project in Xcode and just build the dylib in MonoDevelop and then import the lib the Xcode project ?
Thanks for your help.
the DLL that as been build with the standard mono framework.
MonoTouch (like Mono for Android) provide a base class library (BCL) profile that is similar (a superset) to Silverlight. However it's a subset of the whole Mono framework.
As such it's very common that assemblies compiled against the full framework won't work on MonoTouch unless they are re-compiled (against the MonoTouch BCL).
If i choose to use MonoTouch, can i keep my project in Xcode and just build the dylib in MonoDevelop and then import the lib the Xcode project ?
It's more complicated than that (e.g. MonoDevelop won't give you a .dylib). You might be able to google some instructions to do this, however be aware that this scenario is unsupported.
An supported alternative is to make MonoTouch drive the application, load any assemblies you need, expose those and then transfer control to your Objective-C code.