Strip down CEGUI for embedded device

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Strip down CEGUI for embedded device

Postby komarx6 » Fri Oct 31, 2014 19:09

Hello everyone!

I found out CEGUI just recently while I was looking for gui system to be used on very low resource embedded hardware.
I'm going to use Lua as scripting language, and I'm going to write my own renderer (at least partially but probably all).

My biggest problem is the CEGUI's base lib. It's to large. So my first question is: is it possible to reduce it's memory footprint below (or about) 300kB?
I don't need most of widgets and I don't need animations. I also don't need mouse, so i commented out all code that uses mouse (actually, I used #ifdef for that). It was partialy successful.

Currently, I'm stuck trying to use uSTL instead of STL. Since it's my first time to work with CMake, I'm not really sure what code and files I should use, and where should I place them to make it work. Can you help about that?

Can you give me some more advices and hints, please?

Thank you.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Strip down CEGUI for embedded device

Postby Ident » Sun Nov 02, 2014 11:49

I am not sure what uSTL is, so I am not sure what CMAKE has to do with it. It sounds like a Search-And-Replace that needs to be done on the final project generated by CMake.

Regarding low-memory footprint: You want to use Lua. Are you aware that this will create a lot of extra memory needs? The bindings etc will need quite some space.

You are free to use whatever plugins you want, I think the default-parser (expat) isnt the smallest, you could create your own parser or use either tinyxml or rapidxml, i think rapidxml is the smallest.

That is all I have for now.

300Kb is really small, tell us how it is going for you.
CrazyEddie: "I don't like GUIs"

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Strip down CEGUI for embedded device

Postby komarx6 » Thu Nov 06, 2014 08:30

I'm sorry, I couldn't replay earlier. For the same reason I didn't make any progress. I'll inform you about my success (or failure), of course.
Can you just tell me your opinio, do you think that CEGUIBase lib could be stripped down to 300kB? Do you think that is even possible?

Thank you.

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Strip down CEGUI for embedded device

Postby komarx6 » Thu Nov 06, 2014 09:14

uSTL is actaually micro-STL, made for this situations. It has potentail to make huge difference. But I don't know how to tell CMake to use it. I did a lot of code replacement, but I need to tell CMake (so it can tell compiler) where is this library.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Strip down CEGUI for embedded device

Postby Ident » Thu Nov 06, 2014 10:22

komarx6 wrote:I'm sorry, I couldn't replay earlier. For the same reason I didn't make any progress. I'll inform you about my success (or failure), of course.
Can you just tell me your opinio, do you think that CEGUIBase lib could be stripped down to 300kB? Do you think that is even possible?

Thank you.

I am pretty sure it is possible. The biggest chunk is CEGUIBase, which has 2.2 MB on Release on my PC and I did not optimise any of the options.
Regarding replacing STL, I m sure it is possible but no idea how, never tried.
CrazyEddie: "I don't like GUIs"

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Strip down CEGUI for embedded device

Postby komarx6 » Thu Nov 06, 2014 12:55

OK, thank you.

I'll inform you as I sad. I'll probably also post source code somewhere.

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Strip down CEGUI for embedded device

Postby komarx6 » Wed Nov 12, 2014 13:25

I'm still struggling with it.
Can you tell me how to build Silly Image codec only with libpng? I don't need jpeg and others.
Thank you.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Strip down CEGUI for embedded device

Postby Ident » Wed Nov 12, 2014 13:34

I don't know. I assume Paul would know but he is on hiatus. You could probably do it manually by opening the solution for silly and removing the .lib files and headers of the image libraries that you do not want to use (jpg etc). Then you could build again and by using the build errors you would get all code locations that contain now undefined references that need to be deleted. Then you could remove the associated code. Might work.
CrazyEddie: "I don't like GUIs"

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Strip down CEGUI for embedded device

Postby komarx6 » Tue Nov 25, 2014 14:51

I really don't have to much time to spend on this project, but I'm not giving up yet.
Can you help me with including uSTL in project (or maybe you know some one who can)?
I have never used CMake before, so I decided to learn a bit of CMake and try to make CMakeLists.txt file for small project that uses uSTL.
This is how that file looks like:

Code: Select all

cmake_minimum_required (VERSION 2.6)
project (test1)

include_directories(${CMAKE_SOURCE_DIR}/deps/ustl/include)

add_executable(test1 ${CMAKE_SOURCE_DIR}/main.cpp)

find_library(USTL_LIB ustl ${CMAKE_SOURCE_DIR}/deps/ustl/lib)
target_link_libraries(test1 ${USTL_LIB})



And this is cpp file:

Code: Select all

#include "ustl.h"

using namespace ustl;

int main(){
   vector<int> vec;

   for(int i = 1; i < 4; vec.push_back(i), i++);

   for(int i = 0; i < 3; i++){
      cout << vec[i];
   }

}


And it works.
But I don't know how to make that with CEGUI.
CEGUI CMake files are to complex, and I don't really have experience.
My plan is to Search&Replace all "std::" string in CEGUI and replace them with "ustl::", and in CEGUI's Base.h file to add line "#include "ustl.h" ".
But I don't know how to do it. I did try something but that didn't made any sense. :D

I think that this wouldn't be problem for someone how understands CEGUI's CMake files, it should be 5 minute job.

Can you help?

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Strip down CEGUI for embedded device

Postby Ident » Tue Nov 25, 2014 18:40

If I understand you correctly, you want to scan all header and source files and replace the std includes? and std types? I am not sure if or how CMake can do that.

I suggest you to ask in the CMake IRC channel, I had good experiences there in the past. Just give em some time to answer. Also check their forums. Or maybe someone else in the forum knows how to do this with CMake
CrazyEddie: "I don't like GUIs"

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Strip down CEGUI for embedded device

Postby komarx6 » Wed Nov 26, 2014 09:13

No, I all have all ready done that. I need to put CMake instructions that I posted in CEGUI's CMakeLists.txt or other appropriate file so that compiler knows where to find uSTL include files and linker where to find uSTL library. But CEGUI's CMake is so complex and I don't understand so I don't know who to do that.
Making compiler know where to find include files is easier, but I can't do that either.

Thank you for your help any way.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Strip down CEGUI for embedded device

Postby Ident » Wed Nov 26, 2014 11:16

Modules are usually added like this:

Code: Select all

cegui_add_dependency(${CEGUI_TARGET_NAME} TINYXML)


You have to call this in

Code: Select all

CEGUI\cegui\src\CMakeLists.txt
around or before the other calls similar to this one

Obviously you will have to adapt the "TINYXML" to something else. e.g. USTL.
Before that you will have to set (using the CMake set-command) variables for USTL. These are:

Code: Select all

USTL_DEFINITIONS and USTL_DEFINITIONS_DYNAMIC
If you need any COMPILE_DEFINITIONS (see CMake docu)
and

Code: Select all

USTL_H_PATH USTL_LIB USTL_LIB_DBG
The first points to the path including your headers, the second points to the release lib (dynamic) and the last to the debug lib (dynamic)

If you want another name replace USTL with something else.
If you want to statically link then tell me.
Other than that I think this should work, please try it out.
CrazyEddie: "I don't like GUIs"

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Strip down CEGUI for embedded device

Postby komarx6 » Wed Nov 26, 2014 12:45

Thank you so much, I'm going to try it right away.
I'm definitely going to need static linking.
But priority is to make it work any way. :)

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Strip down CEGUI for embedded device

Postby Ident » Wed Nov 26, 2014 12:57

I advise against static building but if you wanna use it you will need to change then UTIL_Static needs to be defiend somehow. Didn't look into it yet.
CrazyEddie: "I don't like GUIs"

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Strip down CEGUI for embedded device

Postby komarx6 » Wed Nov 26, 2014 13:55

I failed, I think I'm missing something here.
But can I make it simple. What is simplest method to add "-I/path/to/ustl/include" as comiler option when compiling any file in CEGUI hierarchy, and -L... for linking stage and /path/to/ustllib?

I'm sorry, I feel like I'm boring you. If that's the case just tell me.
Maybe somebody else could help.
I'm already really thankful.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests