User forums > Using Code::Blocks

Info about lib finder

(1/4) > >>

Max:
Dear all,
I observed a new plugin in the latest nightly build (3050 Windows XP SP2), library finder.

I tried it. Adding several dir in which .lib .a and .dll are present (I do have libs in those dir), with and without
an open project/workspace but the answer is always the same

"Didn't find any library"

Why? Is the pluging not working? (under dev) Am I using it in a wrong way? Which is its aim?

Thanks for the info.


Max

MortenMacFly:

--- Quote from: MaxGaspa on October 10, 2006, 10:06:45 am ---Why? Is the pluging not working? (under dev) Am I using it in a wrong way? Which is its aim?

--- End quote ---
You didn't read the readme.txt, did you ?! ;-)
lib_finder only "knows" libraries when they are defined in a configuration (XML based) file. Of course no tool can know what compiler/linker options to set only from the fact "somewhere in that path exists a library". Please consult the readme.txt file in the lib_finder folder and the provided template (demonstration) files under [CodeBlocks]\share\CodeBlocks\lib_finder. Anyone who wants to provide additional templates - step forward!
With regards, Morten.

tiwag:
same for me ...

i was somewhat surprised, that the directory which i selected for searching
was removed immedeately from the list - is this intended behaviour ?

could someone please give an explanation how to use this plugin correctly ?

thanks, tiwag

MortenMacFly:
Ok, here comes the content from the readme.txt file (as I have seen it's not in the nightly?!):

This Code::Blocks plugin was created to automatically find libraries installed in system. Each library is represented as global variable. If this global variable is configured by this plugin, all necessary steps to use such library is to:
- add $(#GLOBAL_VAR_NAME.include) in include directories
- add $(#GLOBAL_VAR_NAME.lib) in lib include directories
- add $(#GLOBAL_VAR_NAME.obj) in lib and resoure compiler directories
- add $(#GLOBAL_VAR_NAME.cflags) in other compiler options
- add $(#GLOBAL_VAR_NAME.lflags) in other linker options
(where GLOBAL_VAR_NAME should be changed to variable associated with given library, f.ex. WX will be used for wxWidgets, cb for Code::Blocks SDK. There's no rule describing how these global variables are named. But it should be short and easy to guess ;) These variables define all necessary directories and libraries needed during linkage.
WARNING: Because C::B allow only one directory for include / lib / obj paths, LibFinder will try to simulate others by adding them to LFLAGS and CFLAGS.
Libraries are configured in xml files (see lib_finder/README.txt for more details). LibFinder will search for these files in $(CB_DIR)/share/CodeBlocks/lib_finder. There are 3 libraries currently supported - wxWidgets (only wx 2.6 monolithic dll version), C::B sdk and OpenGL Framework.

In the folder with the XML defintion files is another readme.txt - here it goes:

This folder contains configuration files for libraries. Configurations are stored in XML format and must have .xml extension. The main skeleton of library configuration is as follows:


--- Code: ---<library name="Library Name" global_var="Global Var Name">
    <!--... Global configuration here ...-->
    <config>
        <!--... Library configurtion 1 ...-->
    </config>

    <config new_name="Changed library name">
        <!--... Library configurtion 2 ...-->
    </config>

    <!--... more configurations here ...-->
</library>

--- End code ---

LibFinder assumes that each library may have different number of configurations (static library / dll / debug version etc. ), each of these configurations is set inside <config> </config> node. It will inherit all global settings defined outsidee these blocks. If there's no special configuration, LibFinder will use global settings as main configuration.

Configurable options are described below.
* File option : file option is used to to notify that library must have specified file. File names are relative to base library directory. There's no need to check all files included with library. But given list of files must not be ambiguous. Here's example of file option from wxWidgets library:

--- Code: ---    <file name="include/wx/wx.h"/>
    <file name="include/wx/wxprec.h"/>

--- End code ---
* Path option : path option is used to add one of paths for library configuration. Like in global vars, there are three types of paths: include, lib, obj. These paths should be global, what can be done easily by using variables (it will be described later). Global Variable allow only one path to be defined but LibFinder tries to set additional directories through CFLAGS and LFLAGS. Paths can be defined with following tags:

--- Code: ---    <path include="include path"/>
    <path lib="lib path"/>
    <path obj="obj path"/>

--- End code ---
* Flags option : flags option can be used to set compiler / linker flags (options). Good example is to set automatically linked librarues with LFLAGS and required dedfines with CFLAGS. Tag describing flags can be defined like in following forms (example from wxWidgets configuration):

--- Code: ---    <flags cflags="-DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL"/>
    <flags lflags="-lwxmsw26"/>

--- End code ---
* Variables : LibFinder allow to use variables what gives more flexibility. In order to use variable, You can use $(VARIABLE_NAME) anywhere in path, flags options and in library name. If variable named VARIABLE_NAME is declared, it will be replace by corresponding value. There's one variable always defined: $(BASE_DIR) and it contains global path to library root folder (paths of required files are relative to this base path). And it should be always used when declaring paths for this library, like:

--- Code: ---    <path include="$(BASE_DIR)/include"/>

--- End code ---
Additional variables may be produced from names of directories in required files. If instead of directory name there is *$(VARIABLE_NAME), it does mean that any directory here will match and that variable named VARIABLE_NAME wil be set to this directory name. F.ex. :

--- Code: ---        <file name="lib/*$(CONFIG_NAME)/msw/wx/setup.h"/>

--- End code ---
will set variable CONFIG_NAME with names of all directories inside lib, containing msw/wx/setup.h. (OF course, this path will be used when other file requirements are met). If variable is declared in more than one path, is must be same in all paths, otherwise, this will be threated like file name mismatch.

Anyway: Please notice that this plugin is still experimental. There are knows bugs (e.g. libs in root-folders are not recognised - thus, C:\wxWidgets is not found, but C:\Devel\wxWidgets) and this plugin has been added mainly to take it under source control and because the code was nearly lost. As with all contrib plugins: Use it at your own risk but any help with development is really welcome.

With regards, Morten.

MortenMacFly:

--- Quote from: tiwag on October 10, 2006, 10:29:30 am ---could someone please give an explanation how to use this plugin correctly ?

--- End quote ---
What happens:
1.) Select the directories to search for libraries (that are defined in the XML config files, e.g. wxWidgets)
2.) Let lib_finder search the folders. Once the libs are found, configurations are offered to choose from (e.g. for wxWidgets the Unicode, non-Unicode...) -> choose one
3.) lib_finder will create global variables and fill their content accordingly.
4.) Create a new project and make use of the global vars (e.g. "WX") that have been setup.
"Unfortunately" this works for me - so currently I don't know what happens in your case - could you give me a step-by-step explanation to reproduce?
With regards, Morten.

Navigation

[0] Message Index

[#] Next page

Go to full version