[LLVMdev] Using LLVM JIT inside a Cocoa application

Camille Troillard camille at osculator.net
Fri Jun 5 04:49:06 PDT 2009


Bonjour Jean-Daniel,

I didn't know about the clang Xcode project, and indeed it works very naturally.
It seems the key to successfully build a project within Xcode is to set :

GCC_PREPROCESSOR_DEFINITIONS = __STDC_CONSTANT_MACROS __STDC_LIMIT_MACROS=1

I was fearing the makefiles were involving more work behind the
scenes, but that's not true: include the headers, libraries, and set
the C++ macros.

Thanks for the info!


Best,
Cam


On Fri, Jun 5, 2009 at 1:31 PM, Jean-Daniel Dupas<devlists at shadowlab.org> wrote:
> Hello,
>
> I'm not an LLVM expert, but I think you can build a Cocoa/LLVM project
> by using the LLVM's libraries and headers the same way you did with
> any other third party library.
>
> In fact, that's what the clang Xcode project does. It does not use any
> makefile.
>
> In short:
>        - Add the llvm/include folder in you header search path (in the
> project's build settings).
>
> To add libraries, an option may be to drop the *.a you need in your
> Xcode project, and Xcode is smart enough to adjust the library search
> path as needed.
>
> and other option (the one chosen by clang) may be to change build
> settings:
>        - Add the llvm/<output>/lib/ folder in you library search path
> (replace <output> by the name of the llvm build dir. You can choose a
> value based on your build configuration to use different libraries
> variant in Debug and Release).
>        - Add linker flags to tell the linker which LLVM libraries you want
> to use.
>
>
>
> Le 5 juin 09 à 11:59, Camille Troillard a écrit :
>
>> Hello,
>>
>> I am trying to compile a project I am writing with Xcode that will use
>> LLVM libraries to generate code executed with the JIT.
>> I would be curious to learn how you deal with LLVM header files,
>> libraries, makefiles and Cocoa application projects.
>>
>> My candid understanding is that LLVM projects need to be built with
>> LLVM makefiles (hence the previous message I sent about LLVM
>> Projects).  I am not totally reluctant to the idea of building a
>> library outside of Xcode and then linking it to my Cocoa project, but
>> I find it rather annoying to maintain two project structures.  With
>> some work it would be possible to automate all of this build project
>> inside Xcode, but I was hoping a more straightforward solution.
>>
>> Any ideas?
>>
>> Best Regards,
>> Camille
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list