How to build ASSIMP Library for iOS (Device and Simulator) with boost-library?

前端 未结 4 1878
孤城傲影
孤城傲影 2020-12-29 11:05

I want to use the ASSIMP library http://assimp.sourceforge.net in an iOS project. Unfortunately, I\'m not very experienced with makefiles and that stuff, so I need some help

相关标签:
4条回答
  • 2020-12-29 11:45

    I also had a few issues getting assimp to work on iOS devices.

    Here's what I did in case anyone is also having similar issues - similar to Artur Sampaio's example above, but with a few differences:

    1. get the latest assimp from https://github.com/assimp/assimp, i.e., git clone git://github.com/assimp/assimp.git

    2. cd into the assimp directory and open up CMakeLists.txt. For some reason, the make file couldn't find my glut and gl libs, so I commented out the lines in CMakeLists.txt that referred to making the samples, i.e., the "IF ( BUILD_ASSIMP_SAMPLES)" block of code. There's probably a simple way to point to these, but since I didn't need the samples I just did commented those lines out.

    3. cd to port/iOS/ and then sudo ./build_ios.sh (it takes a few minutes to compile all 3 versions of the lib).

    4. now if you cd to assimp/lib/ios and lipo -info libassimp.a you will see that the library is a fat file with i386, arm6 and arm7 architectures (and will work on both the simulator and the arm6 or arm7 device).

    5. to get it to work in XCode 4.3.2, drag&drop the libassimp.a file into my project (from the finder). You don't have to actually copy it over to your project directory, it doesn't hurt if you do though.

    6. for some reason, a build will still fail unless you explicitly link to the libz dynamic library. Click the main project from the XCode file list, select TARGETS, then click on the Build Settings tab, scroll down to the Linking section, and then add "/usr/lib/libz.dylib" under "Other Linker Flags".

    7. the current version of assimp on github seems to have restructured the code somewhat, and while all of the examples I tested from the assimp website work, they all require different, or at least renamed, header files:

    Here I've commented out the previous names of the headers and below are the new names:

    //#include <assimp.hpp>      // C++ importer interface
    //#include <aiScene.h>       // Output data structure
    //#include <aiPostProcess.h> // Post processing flags
    #include "Importer.hpp"
    #include "scene.h"
    #include "postprocess.h"
    

    After this point I was able to use assimp on my iPad.

    Also, you probably want to make sure that you have uninstalled other versions of assimp before doing this (eg from macports or brew).

    0 讨论(0)
  • 2020-12-29 11:52

    What I did was: download version 1090 of the Assimp repo: http://assimp.svn.sourceforge.net/viewvc/assimp/trunk/?pathrev=1090

    unzip

    cd ~/Downloads/trunk/port/iOS

    sudo ./build_ios.sh

    (replace ~/Downloads/trunk with the path to the unzipped folder)

    wait...

    check libs at ~/Downloads/trunk/libs/ios/

    hope that works

    0 讨论(0)
  • 2020-12-29 11:57

    I found branch where one guy already changed project setting for your needs. https://github.com/blandinw/assimp/tree/ios-xcode46/doc

    0 讨论(0)
  • 2020-12-29 12:02

    I personally don't do any iOS development, but I know that others have successfully compiled Assimp for their iDevices using Xcode. An Xcode 3 project should be included with the distribution, although I don't know if you can use it without further modification.

    The architecture preprocessor defines are currently only used for logging output (in code/Importer.cpp), and support for ARM has been added to trunk in the meantime (r919, to be exact).

    0 讨论(0)
提交回复
热议问题