Finding 'automagically' resource installation paths?
Posted: Fri Jun 17, 2011 12:26
Hi,
I am not sure it is fully relevant, but an issue for me was to tell the CEGUI library where to find the various resources it relies on (ex: 'defaultResProvider.setResourceGroupDirectory("schemes",..' etc. for imagesets, fonts, layouts, etc.).
As the library I am integrating CEGUI into, like the CEGUI itself, can be installed in a user-specified location, I had to tell the integrating library what CEGUI's base path was to be used for resources (either as a configure-generated symbol in a file, or thanks to the -D preprocessor option and some macro hack to protect this path).
I did it but it was not very straightforward; I was wondering if something simpler/cleaner could be done.
I was thinking that a function like const std::string & CEGUI::GetDefaultInstallBaseResourceDirectory() would be ideal from the users' point of view (it would for example return "/home/joe/my-CEGUI-0.7.5-install/share/CEGUI"). It could be possible to implement, provided one does not override the install target (specified at configure-time) once CEGUI has been built.
Another option would be to generate a config script that would set all compile and link settings for the users, a bit like SDL does it:
CEGUI's counterpart could then add a -DCEGUI_RSC_PATH="/home/joe/Projects/CEGUI-0.7.5/share/CEGUI" for example.
Would it make sense? Is there any better solution for that resource path issue?
Thanks in advance for any hint,
Olivier Boudeville.
I am not sure it is fully relevant, but an issue for me was to tell the CEGUI library where to find the various resources it relies on (ex: 'defaultResProvider.setResourceGroupDirectory("schemes",..' etc. for imagesets, fonts, layouts, etc.).
As the library I am integrating CEGUI into, like the CEGUI itself, can be installed in a user-specified location, I had to tell the integrating library what CEGUI's base path was to be used for resources (either as a configure-generated symbol in a file, or thanks to the -D preprocessor option and some macro hack to protect this path).
I did it but it was not very straightforward; I was wondering if something simpler/cleaner could be done.
I was thinking that a function like const std::string & CEGUI::GetDefaultInstallBaseResourceDirectory() would be ideal from the users' point of view (it would for example return "/home/joe/my-CEGUI-0.7.5-install/share/CEGUI"). It could be possible to implement, provided one does not override the install target (specified at configure-time) once CEGUI has been built.
Another option would be to generate a config script that would set all compile and link settings for the users, a bit like SDL does it:
Code: Select all
> bin/sdl-config --cflags
-I/home/joe/Projects/SDL-1.2.14/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
> bin/sdl-config --libs
-L/home/joe/Projects/SDL-1.2.14/lib -lSDL -lpthread
CEGUI's counterpart could then add a -DCEGUI_RSC_PATH="/home/joe/Projects/CEGUI-0.7.5/share/CEGUI" for example.
Would it make sense? Is there any better solution for that resource path issue?
Thanks in advance for any hint,
Olivier Boudeville.