Sign in to follow this  
TonyFish

building luabind

Recommended Posts

TonyFish    126
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.

Share this post


Link to post
Share on other sites
XXX_Andrew_XXX    340
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'.

Share this post


Link to post
Share on other sites
TonyFish    126
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

Share this post


Link to post
Share on other sites
TonyFish    126
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]

Share this post


Link to post
Share on other sites
XXX_Andrew_XXX    340
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this