[CEImagesetEditor] Detailed Build Steps for VS2003-5 (V1.1)

Use this forum for:
- Discussion regarding unofficial CEGUI related tools, scripts and utilities.
- User to user help for the obsoleted CELayoutEditor and CEImagesetEditor tools.

Moderators: CEGUI MVP, CEGUI Team

User avatar
fjeronimo
CEGUI Tools Developer (Retired)
Posts: 59
Joined: Tue Sep 11, 2007 16:57
Location: Lisbon, Portugal
Contact:

[CEImagesetEditor] Detailed Build Steps for VS2003-5 (V1.1)

Postby fjeronimo » Thu Oct 11, 2007 18:23

Hi all,

------------------------------------------------------------------------------------------------------
    CEIMAGESETEDITOR BUILD STEPS FOR VS2003-5 (V1.1)
------------------------------------------------------------------------------------------------------


This small document details the steps needed to successfully build the latest TRUNK/HEAD version of CEImagesetEditor against WXWidgets V2.8.* (source) and CEGUI SDK 0.5.0b (binary, source or SVN), using VS2003 (7.1) or VS2005 (8.0) with SP1 in Windows XP SP2 and TortoiseSVN as the SVN client.

NOTE: For similar steps, but for the CELayoutEditor, check http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2760.

TODO: This should be added to the Wiki.

Please note that this is my particular way of doing things and reflects my own experience with CEImagesetEditor builds. Therefore, it might not be the most correct approach. I hope it might be helpful still, especially to newcomers.

History:
    NOTE: Dates in dd/mm/yy format.
    - Version 1.1 - 10/12/07 - Support for VS2003. No longer needs premake to build the VS solutions. Reflects the latest SVN changes (environment variables & post-build steps). Requirements section.
    - Version 1.0 - 11/10/07 - Initial release (thanks to dmail for the SILLY DLL problem resolution).
IMPORTANT NOTE: Be wary of concurrent installs of VS 7 and VS 8. If you are using VS 8, be sure to build all necessary solutions (CEGUI, WxWidgets and CEImagesetEditor) using VS 8 and NEVER VS7. Otherwise, you'll get quite a lot of linker errors! The opposite also holds true.

0) REQUIREMENTS:
-----------------------

CEImagesetEditor requires the use of some third party external libraries. These libraries are as follows:

This guide will offer detailed instructions on how to build them.

1) INIT:
----------

1. Close all instances of Visual Studio

2) CEGUI DOWNLOAD & SETUP:
---------------------------------------

We now need to get the latest CEGUI binaries (0.5.0b at the time of this writing). Alternatively, you could build the source yourself, either from zip or SVN. The three options are presented below:

NOTE: Unlike the CELayoutEditor, the current SVN trunk version of CEImagesetEditor can be built using CEGUI binaries, source or SVN since it doesn't require the more recent changes done to CEGUI itself (that are only present in the SVN). However, this is bound to change in the near future.

OPTION 1: Use CEGUI binaries
-------------------------------------

2.1 Download CEGUI 0.5.0b binaries for VC++ 8 or VC++7.1 from http://www.cegui.org.uk/wiki/index.php/CEGUI_Downloads_0.5.0.

2.2 Install CEGUI in desired directory.

2.3 Create an environment variable $(CEGUI) that will store the previous dir.
    2.3.1 Go to My Computer\Properties\Advanced\Environment Variables.

    2.3.2 Press new in the user variables area.

    2.3.3 Create a new variable named CEGUI and with the directory present in 2.2 as value (e.g. D:\Dev\CEGUI-SDK-0.5.0b-vc8).
OPTION 2: Build CEGUI source (ZIP)
------------------------------------------

2.1 Download CEGUI 0.5.0b source from http://www.cegui.org.uk/wiki/index.php/CEGUI_Downloads_0.5.0.

2.2 Unpack previous zip to directory of your choice.

2.3 Create an environment variable $(CEGUI) that will store the previous dir.
    2.3.1 Go to My Computer\Properties\Advanced\Environment Variables.

    2.3.2 Press new in the user variables area.

    2.3.3 Create a new variable named CEGUI and with the directory present in 2.2 as value (e.g. D:\Dev\CEGUI-0.5.0).
2.4 Download CEGUI 0.5.0b dependencies for VC++8 or VC++7.1 from http://www.cegui.org.uk/wiki/index.php/CEGUI_Downloads_0.5.0.

2.5 Unpack dependencies to $(CEGUI) directory.

2.6 Go to $(CEGUI)\makefiles\premake and run build_vs2005.bat or build_vs2003.bat (these batch files use premake to generate the VS2005 and VS2003 solution respectively).

2.7 Open the generated $(CEGUI)\makefiles\premake\CEGUI.sln.

2.8 Build the solution in both DEBUG and RELEASE configurations.

OPTION 3: Build CEGUI source (SVN)
-------------------------------------------

NOTE: I'm using TortoiseSVN as my SVN client for illustration purposes, but you can use anything you like.

2.1 In Windows Explorer, pick a directory of your choice and create a directory named CEGUI-0.5.0-SVN or any other name of your choice.

2.2 Right click in the previous directory and choose the TortoiseSVN right-mouse menu option 'SVN Checkout...'.

2.3 We want the HEAD version here, so use https://crayzedsgui.svn.sourceforge.net/svnroot/crayzedsgui/cegui_mk2/trunk as the 'URL of repository'.

2.4 Choose 'Head revision' radio button and press OK.

2.5 Create an environment variable $(CEGUI) that will store the previous dir.
    2.5.1 Go to My Computer\Properties\Advanced\Environment Variables.

    2.5.2 Press new in the user variables area.

    2.5.3 Create a new variable named CEGUI and with the directory present in 2.1 as value (e.g. D:\Dev\CEGUI-0.5.0-SVN).
2.6 Download CEGUI 0.5.0b dependencies for VC++8 or VC++7.1 from http://www.cegui.org.uk/wiki/index.php/CEGUI_Downloads_0.5.0.

2.7 Unpack dependencies to $(CEGUI) directory.

NOTE: Premake is not available in the SVN repository, so you'll need so you'll need to download and install it

2.8 Go to http://premake.sourceforge.net/download.

2.9 Download the latest premake version for windows (at the time of this writing, premake-win32-3.4.zip).

2.10 Unpack premake.exe to $(CEGUI)\makefiles\premake or any directory in the system path.

2.11 Go to $(CEGUI)\makefiles\premake or anywhere if premake is in system path and run build_vs2005.bat or build_vs2003.bat (these batch files use premake to generate the VS2005 and VS2003 solution respectively).

2.12 Open the generated $(CEGUI)\makefiles\premake\CEGUI.sln.

2.13 Build the solution in both DEBUG and RELEASE configurations.


3) WXWIDGETS DOWNLOAD & SETUP:
----------------------------------------------

Time to retrieve the latest WxWidgets source version (2.8.7 at the time of this writing). This is a required dependency of CEImagesetEditor and will need to be built later on.

NOTE: CEImagesetEditor requires wxWidgets 2.6.* or higher. This guide has been tested with the following versions: 2.8.7, 2.8.6, 2.8.5.

3.1 Go to http://www.wxwidgets.org/downloads/ and dowload wxAll source archive for version 2.8.7.

3.2 Unpack the previous tar (wxWidgets-2.8.7.tar.tar) to a directory of your choice.

3.3 Create an environment variable $(WXWIDGETS) that will store the previous dir.

    3.3.1 Go to My Computer\Properties\Advanced\Environment Variables

    3.3.2 Press new in the user variables area.

    3.3.3 Create a new variable named WXWIDGETS and with the directory present in 3.2 as value (e.g. D:\Dev\wxWidgets-2.8.7)
4) CEIMAGESETEDITOR RETRIEVAL & SETUP:
---------------------------------------------------

Instead of downloading a source or binary version, we'll retrieve the latest CEImagesetEditor version directly from the TRUNK/HEAD of SVN. I did this because I wanted to work with the latest patches, but you might choose to use a more stable version if you prefer.

NOTE: I'm using TortoiseSVN as my SVN client for illustration purposes, but you can use anything you like.

4.1 In Windows Explorer, pick a directory of your choice and create a directory named CEImagesetEditor (or another name of your choosing).

4.2 Right click in the previous directory and choose the TortoiseSVN right-mouse menu option 'SVN Checkout...'.

4.3 We want the HEAD version here, so use https://crayzedsgui.svn.sourceforge.net/svnroot/crayzedsgui/CEImagesetEditor/trunk as the 'URL of repository'.

4.4 Choose 'Head revision' radio button and press OK.

4.5 Create an environment variable $(CE_IMAGESET_EDITOR) that will store the previous dir.

    4.5.1 Go to My Computer\Properties\Advanced\Environment Variables

    4.5.2 Press new in the user variables area.

    4.5.3 Create a new variable named CE_IMAGESET_EDITOR and with the directory present in 4.1 as value (e.g. D:\Dev\CEImagesetEditor)
5) CEIMAGESETEDITOR SOLUTION CONFIG:
-------------------------------------------------

IMPORTANT NOTE: As of 10/12/07, the VC++8 (VS2005) and VC++7.1 (VS2003) solutions are already present in SVN, configured with the correct environment variables mentioned in this section. You can now skip to section 6 directly. This section is kept for reference purposes.

Let's prepare the build process. You'll notice that no CEImagesetEditor solution exists. So, start by:

5.1 If premake is not in a directory in the system path, copy premake.exe to $(CE_IMAGESET_EDITOR).

5.2 Create a file called build_vs2005.bat or build_vs2003.bat at $(CE_IMAGESET_EDITOR).

5.3 Open the previous file and enter the following lines:

build_vs2005.bat:

Code: Select all

premake --file premake.lua --target vs2005
pause

build_vs2003.bat:

Code: Select all

premake --file premake.lua --target vs2003
pause


5.4 Save file and run build_vs2005.bat or build_vs2003.bat.

5.5 Premake will generate CEImagesetEditor.sln, CEImagesetEditor.vcproj and config.h at $(CE_IMAGESET_EDITOR).

5.6 Open $(CE_IMAGESET_EDITOR)\CEImagesetEditor.sln in VS2005 or VS2003.

5.7 Right click the CEImagesetEditor project in the Solution Explorer and choose properties.

5.8 Navigate to ConfigurationProperties\C/C++\General

5.9 Open the Additional Include Directories panel

5.10 Remove the following four lines - that refer to SVN relative paths where CEGUI is located and hardcoded wxWidgets paths and therefore not needed since our own paths will probably differ - in both Debug and Release configurations (top-left dropdown menu)
    - ../cegui_mk2
    - ../cegui_mk2/include
    - ../wxWidgets-2.6.3/include
    - ../wxWidgets-2.6.3/include/msvc
5.11 We want to reference the CEGUI dir and include directories as well as the WxWidgets ones, so let's use our newly created environment variables. Add the following four lines in both Debug and Release configurations (top-left dropdown menu)
    - $(CEGUI)
    - $(CEGUI)\include
    - $(WXWIDGETS)\include
    - $(WXWIDGETS)\include\msvc
5.12 Navigate to ConfigurationProperties\Linker\General

5.13 Open the Additional Library Directories panel

5.14 Remove the following lines, for the same reason as above in both Debug and Release configurations (top-left dropdown menu)
    - ../cegui_mk2/lib
    - ../wxWidgets-2.6.3/lib/vc_lib
5.15 Add the CEGUI and WxWidgets lib dirs in both Debug and Release configurations (top-left dropdown menu)
    - $(CEGUI)\lib
    - $(WXWIDGETS)\lib\vc_lib
5.16 Navigate to ConfigurationProperties\Linker\Input

5.17 Replace the following lines (which refer to an older WxWidgets version)
    Debug Configuration

    - wxbase26d.lib TO wxbase28d.lib
    - wxmsw26d_core.lib TO wxmsw28d_core.lib
    - wxmsw26d_gl.lib TO wxmsw28d_gl.lib
    - wxmsw26d_adv.lib TO wxmsw28d_adv.lib

    Release Configuration

    - wxbase26.lib TO wxbase28.lib
    - wxmsw26_core.lib TO wxmsw28_core.lib
    - wxmsw26_gl.lib TO wxmsw28_gl.lib
    - wxmsw26_adv.lib TO wxmsw28_adv.lib
6) CEIMAGESETEDITOR INITIAL BUILD ATTEMPT:
-----------------------------------------------------------

Let's try to build our editor. We must first build WxWidgets, since it is a dependency.

6.1 Go to $(WXWIDGETS)\build\msw and open file wx.dsw in VS2005 or VS2003.

6.2 wx.dsw is a VC6 project, so it needs to be converted to VS2005 or VS2003. When prompted, accept the conversion by pressing the 'Yes To All' button.

6.3 Build the WX solution in 'Debug' and 'Release' configurations
    NOTE: This may take a while since the solution is quite big

    NOTE2: Unlike the CELayoutEditor, the current version of CEImagesetEditor does not contemplate WxWidgets in unicode mode.
6.4 If you try to build the solution CEImagesetEditor just yet, you'll notice that it will produce compile errors such as
    - error C2504: 'wxGLCanvas' : base class undefined d:\dev\ceguitests\ceimageseteditor\src\editorglcanvas.h 42
The problem lies in the fact that the WxWidgets dependency was built without OpenGL support, which is required for the CEImagesetEditor.

7) CEIMAGESETEDITOR SECOND BUILD ATTEMPT:
--------------------------------------------------------

Let's correct the previous problem and try again.

7.1 Open $(WXWIDGETS)\include\msw\setup.h and replace

Code: Select all

#define wxUSE_GLCANVAS 0
WITH

Code: Select all

#define wxUSE_GLCANVAS 1


7.2 Open $(WXWIDGETS)\include\univ\setup.h and replace

Code: Select all

#if defined(__WIN32__)
   #define wxUSE_GLCANVAS 1
else   
    #define wxUSE_GLCANVAS 0

WITH

Code: Select all

#define wxUSE_GLCANVAS 1

7.3 Rebuild the WX solution in 'Debug' and 'Release' configurations.

7.4 Rebuild CEImagesetEditor solution. Hoperfully, the build will be successful.

8) RUNNING CEIMAGESETEDITOR:
--------------------------------------

IMPORTANT NOTE: As of 10/12/07, the VC++7.1 (VS2003) and VC++8 (VS2005) solutions have post-build steps that take care of the problems enumerated in this section. You should now be able to run the editor without any further problems. This section is kept for reference purposes.

If you try to run the application, errors will popup because the required CEGUI dlls are not present in the executable directory. So, do the following:

8.1 Copy the following files from $(CEGUI)\bin to $(CE_IMAGESET_EDITOR)\bin.
    TO $(CE_IMAGESET_EDITOR)\bin (Debug configuration)
    - CEGUIBase_d.dll
    - CEGUIExpatParser_d.dll
    - CEGUIFalagardWRBase_d.dll
    - CEGUISILLYImageCodec_d.dll
    - CEGUITGAImageCodec_d.dll (technically not needed, but always a good idea)
    - OpenGLGUIRenderer_d.dll

    TO $(CE_IMAGESET_EDITOR)\bin (Release configuration)
    - CEGUIBase.dll
    - CEGUIExpatParser.dll
    - CEGUIFalagardWRBase.dll
    - CEGUISILLYImageCodec.dll
    - CEGUITGAImageCodec.dll (technically not needed, but always a good idea)
    - OpenGLGUIRenderer.dll

    NOTE: You could create a post-build step to ensure that the files are present and if not they should be copied to the executable dir.
However, even when you copy all of the above files, the following error still refuses to disappear (example for debug file, in release the file changes to CEGUISILLYImageCodec):
    - CEImagesetEditor:OnInit - Error: DynamicModule::DynamicModule - Failed to load module 'CEGUISILLYImageCodec_d': The specified module could not be found.
Despite the fact the dll is correctly placed at the executable dir.

8.2 As it turns out, the error message is not correct. As dmail explained (see post in http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2760), the GL renderer will dynamically load the the CEGUI SILLY DLL which in turn will load the SILLY DLL. And here lies the problem, since the application cannot find the SILLY DLL in the path. Therefore, the error message should be (for debug builds):
    -CEImagesetEditor:OnInit - Error: DynamicModule::DynamicModule - Failed to load module 'CEGUISILLYImageCodec_d': The specified SILLY_d module could not be found.
8.3 Copy SILLY_d.dll and SILLY.dll from $(CEGUI)\dependencies\bin to $(CE_IMAGESET_EDITOR)\bin.

8.4 Rebuild CEImagesetEditor and run it. Everything seems OK now... except if you run it from inside VS2005 directly, where you'll get the following error:
    - ImagesetEditor::OnInit - Error : DefaultResourceProvider::load - CEImagesetEditor.scheme does not exist
As indicated, the editor is trying to access the scheme file and cannot find it.

8.5 If you open $(CE_IMAGESET_EDITOR)\config.h (generated by premake), you'll find out that the following line is the source of the problem:

Code: Select all

 #define EDITOR_DATA_DIR ../data

Since the VS2005 solution is located at $(CE_IMAGESET_EDITOR) and the data directory (where the problematic scheme is located) is present at $(CE_IMAGESET_EDITOR)\data, the directory backtracking of the previous line will fail. Change it to:

Code: Select all

 #define EDITOR_DATA_DIR ./data

NOTE: You'll need to change this line whenever you change the relative position of the data directory in relation to where the CEImagesetEditor is being run.

8.6 Run the editor again from VS2005 and we're ready to rock and roll!

I hope you liked this little guide. Let me know what you think.
Last edited by fjeronimo on Mon Dec 10, 2007 17:20, edited 3 times in total.
Frederico Jerónimo
Ignite Games - http://www.ignite-games.com
Ignite Games Institutional Site - http://we.ignite-games.com

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Mon Oct 22, 2007 20:00

Made sticky until we put it on the wiki :)

User avatar
fjeronimo
CEGUI Tools Developer (Retired)
Posts: 59
Joined: Tue Sep 11, 2007 16:57
Location: Lisbon, Portugal
Contact:

Postby fjeronimo » Mon Dec 10, 2007 17:17

New update. :)
Frederico Jerónimo

Ignite Games - http://www.ignite-games.com

Ignite Games Institutional Site - http://we.ignite-games.com


Return to “Unofficial CEGUI-Related Tools”

Who is online

Users browsing this forum: No registered users and 7 guests