[sword-devel] BCB 6.0 - compiling a new project - requirements

Jonathan Mickelson sword-devel@crosswire.org
Thu, 08 Apr 2004 19:11:52 -0400


This thread will archive the neccesary steps to compile your own Sword 
Project from scratch using BCB 6.0

Later, this material will be consolidated into a tutorial.


I am building a CLX project though either CLX or VCL (standard) may be used.

1) modify the Project Options dialog box.
    TAB "Directories/Conditional"

    Include Path =
         $(BCB)\include
         $(BCB)\include
         ..\..\sword\include
         ..\..\icu-sword\source\common
         ..\..\icu-sword\source\i18n

    Library Path =
         $(BCB)\lib\obj
         $(BCB)\lib
         ..\..\icu-sword\as_is\borland
         ..\..\sword\lib

    Conditional Defines  (VERY IMPORTANT)
        _DEBUG
        _ICU_
        _ICUSWORD_
        _USE_OLD_RW_STL
        U_HAVE_PLACEMENT_NEW=0

2) here is my simple program to display module names and descriptions on 
a form.
//-------------
// download and install BibleCS 1.5.6.  This creates all the proper 
production directories.
// download some bible modules
// test that BibleCS is working properly
//-------------
// Create a new project
// Add a memo component to the form (it's under the "Standard" tab)
// Create Form Events for OnDestroy and OnShow
// judiciously use the code below putting things in their proper place
// compile and run
// the form should appear with a list of module names and descriptions
//-------------
#include <clx.h>    // used for CLX projects
#pragma hdrstop

#include "MySampleProject.h"
#include <string>
#include <swmgr.h>
#include <swconfig.h>
#include <markupfiltmgr.h>

#define WM_VERSE (WM_APP + 1995)
extern AnsiString startVerse;

using namespace sword;
//---------------------------------------------------------------------------
//#pragma package(smart_init)
#pragma resource "*.xfm"

SWConfig *userPrefs;
SWMgr *mainmgr;
SWConfig *optionsconf;


TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
    if (mainmgr)
        delete mainmgr;
    if (userPrefs)
    {
        userPrefs->Save();
        delete userPrefs;
    }
    if (optionsconf)
        delete optionsconf;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
//    MyLibrary = new SWMgr(0, 0, true, new 
MarkupFilterMgr(FMT_HTMLHREF, ENC_HTML));

    ModMap::iterator it;
    SWModule *MyMod;

    optionsconf = new SWConfig("./options.conf");

    try
    {
        mainmgr = new SWMgr(0, 0, false, new MarkupFilterMgr(FMT_RTF, 
ENC_RTF));
          userPrefs = 0;
        mainmgr->Load();

        userPrefs = new SWConfig("./userprefs.conf");
        if ((mainmgr->config) && (userPrefs))
        (*(mainmgr->config)) += (*userPrefs);
    }
    catch (...)
    {
        Application->Terminate();
    }

    if (!mainmgr->config)
        Application->Terminate();

    for (it = mainmgr->Modules.begin(); it != mainmgr->Modules.end(); it++)
    {
        MyMod = (*it).second;
          if (!strcmp((*it).second->Type(), "Biblical Texts"))
        {
            Memo1->Lines->Append(MyMod->Name());
            Memo1->Lines->Append(MyMod->Description());
        }
    }
}
//----------------
// End of code
//----------------