I built the list by hand though trial and error. I'm not sure if and how llvm-config works with cmake. Its seems now that I got the right dependencies in the right order, there have been no ongoing maintenance issues. On Sun, Jun 13, 2010 at 4:32 PM, sam lee <skynare at gmail.com> wrote:> Ah, thank you so much. > How did you get the list of target_link_libraries() ? > Did you use llvm-config? > If you did not have access to llvm-config, how would you get list of > libraries to link to? > > Thanks. > Sam > > > > On Sun, Jun 13, 2010 at 2:44 PM, Nathan Jeffords <blunted2night at gmail.com>wrote: > >> This isn't meant to be a sample, but I can share with you the cmake files >> I use for my compiler. It builds in both windows user MSVC, and linux using >> G++, but should work with MinGW. >> >> the structure is >> >> src/ >> CMakeLists.txt # root make file >> front/ >> CMakeLists.txt # library >> middle/ >> CMakeLists.txt # library >> back/ >> CMakeLists.txt # library >> npp/ >> CMakeLists.txt # executable >> >> >> >> On Sun, Jun 13, 2010 at 8:00 AM, Óscar Fuentes <ofv at wanadoo.es> wrote: >> >>> sam lee <skynare at gmail.com> writes: >>> >>> > Hi, >>> > >>> > I built LLVM on Windows XP through cmake and MinGW make. That was a >>> breeze! >>> > Now, I wanted to start a project. >>> > It seems like I need Makefile.rules and Makefile.config to start a new >>> > project (from http://llvm.org/docs/Projects.html). >>> >>> Those files are unrelated to cmake. >>> >>> > And llvm/projects/sample uses autoconf (or ./configure). Is there cmake >>> > based sample project available? >>> > I could not find any from official release. Has any of you written >>> sample >>> > project template that uses cmake? >>> >>> Just make a directory under LLVM_ROOT/projects and put your source >>> there, with a CMakeLists.txt file that contains the right directives >>> (you can use any of the llvm tools or libraries under LLVM_ROOT/tools or >>> LLVM_ROOT/lib as an example.) After creating those files, you must >>> re-invoke cmake for it taking notice of your new project. >>> >>> Another approach is to build and install LLVM and write your project as >>> an standalone source tree outside LLVM's. Then link the LLVM libraries >>> into your executable. >>> >>> [snip] >>> >>> _______________________________________________ >>> 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 >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100613/74848d45/attachment.html>
On Monday 14 June 2010, Nathan Jeffords wrote:> I built the list by hand though trial and error. I'm not sure if and how > llvm-config works with cmake. Its seems now that I got the > right dependencies in the right order, there have been no > ongoing maintenance issues.I use llvm-config with cmake, for this I wrote a FindLLVM.cmake file [1], it provides a FIND_LLVM_LIBS macro that calls llvm-config, example of use in [2]. Unfortunately it does not work with MSVC, so I had to hardcode the libraries when building with MSVC. The LLVM_NATIVE_OBJECTS part of FIND_LLVM_LIBS is probably not needed anymore, since everything seems to be shipped as static library nowdays. [1] http://bitbucket.org/opengtl/opengtl/src/tip/cmake/modules/FindLLVM.cmake [2] http://bitbucket.org/opengtl/opengtl/src/tip/OpenGTL/GTLCore/CMakeLists.txt -- Cyrille Berger
Ok, I created cmake sample project that can build fibonacci.cpp (from llvm/examples/Fibonacci/fibonacci.cpp). I am linking to all libraries. I'm on windows and I could not make llvm-config to work. How does llvm-config work? I would like to port it to Python or Lua that works on every platform. I know it's Perl, but somehow I could not get it to build on windows. I built it on MSYS. But, invoking it (llvm-config --libs) says: llvm-config: unknown component name: pic16codegen. And, llvm-config --libs core only returns -lLLVMCore (it should return -lLLVMSystem and -lLLVMSupport). And thank you for FindLLVM.cmake. When I have working llvm-config script, I'll use it. Thanks. Sam On Mon, Jun 14, 2010 at 5:14 AM, Cyrille Berger <cberger at cberger.net> wrote:> On Monday 14 June 2010, Nathan Jeffords wrote: > > I built the list by hand though trial and error. I'm not sure if and how > > llvm-config works with cmake. Its seems now that I got the > > right dependencies in the right order, there have been no > > ongoing maintenance issues. > > I use llvm-config with cmake, for this I wrote a FindLLVM.cmake file [1], > it > provides a FIND_LLVM_LIBS macro that calls llvm-config, example of use in > [2]. > Unfortunately it does not work with MSVC, so I had to hardcode the > libraries > when building with MSVC. > > The LLVM_NATIVE_OBJECTS part of FIND_LLVM_LIBS is probably not needed > anymore, > since everything seems to be shipped as static library nowdays. > > [1] > http://bitbucket.org/opengtl/opengtl/src/tip/cmake/modules/FindLLVM.cmake > [2] > http://bitbucket.org/opengtl/opengtl/src/tip/OpenGTL/GTLCore/CMakeLists.txt > > -- > Cyrille Berger > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100614/466561e2/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-sample-project.7z Type: application/octet-stream Size: 2595 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100614/466561e2/attachment.obj>