Advertisement

building luabind

Started by August 04, 2004 08:26 AM
3 comments, last by XXX_Andrew_XXX 20 years, 3 months ago
Someone once said
Quote: The recommended way using VC is to add *all* the luabind files to the workspace, but I found it faster and just as easy to compile luabind as a static library and then link to it - you just have to be careful about linking to the correct version (release / debug, multi-threaded / single-threaded)
How would one go about this? I using vc7 and I'm new to libraries.
<Fish>{
That would be me...

Just so you know, when I said faster I meant a little faster. The biggest tip is to make sure you only include the luabind headers into a small number of .cpp files. This isolates the number of compilation modules which will have the really slow builds.

Build times for anything that uses luabind are terrible because of the amount of templates in the header files. This helps a little if you needs to frequently 'clean' or 'rebuild all' in a solution.

Once you have the static library, prefer doing a 'clean' followed by a 'build' on the main project rather than using 'rebuild all'

- Create a new win32 project.

- On the 'Application Settings' tab, select 'static library' and turn 'precompiled headers' off.

- Add all of the files in the luabind\src directory to the project. Adding the headers to the project is optional, they'll get pulled in automatically, and you shouldn't need to ever change them.

- Add the include directories to both lua and luabind (you can do this through either tools->options or via project properties-> C++ -> General -> 'additional include directories'

- in the project you want to use luabind from, right click on the solution in the solution explorer -> add -> 'existing project'.

- Navigate to the luabind .vcproj file. luabind should now appear in the solution as a second project.

- Right click on your project and select 'additional dependancies'. Check the luabind tick box. This step forces VC.NET to automatically link to your project.

- Ensure that both projects use the same runtime library. 'project properties'-> C++ -> 'Code Generation' -> 'Runtime Library'.
Advertisement
what about multi vs single threaded? I'm new to this and now I'm wondering if I've built lua right. all I did was to use the release build setting.

thanks
<Fish>{
sorry but is that process to generate the static lib? why the other project linking? why not simply create the library and link it in to the other project?

[Edited by - TonyFish on August 4, 2004 10:54:29 AM]
<Fish>{
The last part of my post was about how to link - I've spent the last 8 weeks teaching newbies how to use VS.NET for the first time, so you'll have to forgive me if I was going a little slow.

Threading settings depend on what you want to do. Typically build everything with multithreaded dll unless you have a good reason not too.

Debug - Debug Multithread DLL
Release - Multithreaded DLL

This topic is closed to new replies.

Advertisement