Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

My wizard doesn't work anymore!

<< < (2/2)

mandrav:

--- Quote from: Trikko ---LOL. Probably i can't explain better the problem. I've just realized this. I've just converted syntax where needed. But now there's a strange "GetInstance : etc... etc... " (as reported before), that seems not to be a syntax-convertion error...
--- End quote ---


--- Quote from: mandrav ---If you still have problems, post your script here.
--- End quote ---

Trikko:

--- Code: ---function BeginWizard() {
    Wizard.AddProjectPathPage();
    Wizard.AddPage("OptSelection");
}

// Base Directory Selection
function OnEnter_OptSelection(fwd) {

    local value;

    value = Wizard.GetTextControlValue("m_txtBasePath");

    if (value.length() == 0) {
        value = ConfigManager.Read("/wx_multi_target/BasePath", "");
        Wizard.SetTextControlValue("m_txtBasePath", value);
    }

    value = Wizard.GetTextControlValue("m_txtVersion");

    if (value.length() == 0) {
        value = ConfigManager.Read("/wx_multi_target/Version", "26");
        Wizard.SetTextControlValue("m_txtVersion", value);
    }

   return true;
}

function OnLeave_OptSelection(fwd) {

    ConfigManager.Write("/wx_multi_target/BasePath", Wizard.GetTextControlValue("m_txtBasePath"),true);
    ConfigManager.Write("/wx_multi_target/Version", Wizard.GetTextControlValue("m_txtVersion"),true);

    return true;
}

function OnClick_m_cmdBrowse() {

    local dir = Wizard.GetTextControlValue("m_txtBasePath");
    dir = IO.SelectDirectory("Please select wxWidgets' top-level folder", dir, false);

    if (IO.DirectoryExists(dir))
        Wizard.SetTextControlValue("m_txtBasePath", dir);

}


// setup the already created project
function SetupProject(project) {

    local basePath = ConfigManager.Read("/wx_multi_target/BasePath", "");
    local version = ConfigManager.Read("/wx_multi_target/Version", "");
    local custom_lib_dir;

    local compilers_count = 5;
    local i,k;

    // Include dir is the same for all compilers
    project.AddIncludeDir(basePath + "\\include");
    project.RemoveBuildTarget("default");

    for (i = 0; i<compilers_count; i++) {
        local compilerWxSign, compilerCbSign, compilerName, libPrefix, libSuff;

        switch (i) {


        case 0:
            libPrefix = "";
            libSuff = ".lib";
            compilerCbSign = "dmc";
            compilerWxSign = "dmc";
            compilerName = "Digital Mars";
            break;
        case 1:
            libPrefix = "lib";
            libSuff = ".a";
            compilerCbSign = "gcc";
            compilerWxSign = "gcc";
            compilerName = "GCC/MingW";
            break;
      case 2:
            libPrefix = "";
            libSuff = ".lib";
            compilerCbSign = "msvc8";
            compilerWxSign = "vc";
            compilerName = "VC++";
            break;

        case 3:
            libPrefix = "";
            libSuff = ".lib";
            compilerCbSign = "ow";
            compilerWxSign = "wat";
            compilerName = "Open Watcom";
            break;
        case 4:
            libPrefix = "";
            libSuff = ".lib";
            compilerCbSign = "bcc";
            compilerWxSign = "bcc";
            compilerName = "Borland CC";
            break;
        }

        for (k = 0; k < 2 ; k++) {

            local debugFlag;
            local targetTitle;

            if (k != 0) {
                debugFlag = "d";
                targetTitle = "Debug - ";
            } else {
                debugFlag = "";
                targetTitle = "Release - ";
            }
            custom_lib_dir = basePath + "\\lib\\" + compilerWxSign + debugFlag + "_lib";

            if (IO.DirectoryExists(custom_lib_dir)) {

                // New target for our compiler
                local target = project.AddBuildTarget(targetTitle + compilerName);
                if (target != null) {
                    local tmp;

                    target.AddIncludeDir(custom_lib_dir + "\\msw" + debugFlag);
                    target.AddLibDir(custom_lib_dir);
                    target.SetCompilerID(compilerCbSign);
                    target.SetTargetType(ttExecutable);

                    tmp = ".\\";
                    target.SetObjectOutput(tmp + "_" + compilerWxSign + "_objs");

                    if (k==0)
                        target.SetOutputFilename(tmp + "RELEASE/output_" + compilerWxSign + ".exe");
                    else
                        target.SetOutputFilename(tmp + "DEBUG/output_" + compilerWxSign + ".exe");

                    tmp = "";
                    // Add Libraries
                    target.AddLinkLib(custom_lib_dir + "\\" + libPrefix + "wxmsw" + debugFlag + version + libSuff);
                    target.AddLinkLib(custom_lib_dir + "\\" + libPrefix + "wxtiff" + debugFlag + libSuff);
                    target.AddLinkLib(custom_lib_dir + "\\" + libPrefix  + "wxpng" + debugFlag + libSuff);
                    target.AddLinkLib(custom_lib_dir + "\\" + libPrefix  + "wxjpeg" + debugFlag + libSuff);
                    target.AddLinkLib(custom_lib_dir + "\\" + libPrefix  + "wxzlib" + debugFlag + libSuff );
                    target.AddLinkLib(custom_lib_dir + "\\" + libPrefix  + "wxregex" + debugFlag + libSuff );
                    target.AddLinkLib(custom_lib_dir + "\\" + libPrefix  + "wxexpat" + debugFlag + libSuff);

                    target.AddLinkLib("kernel32");
                    target.AddLinkLib("user32");
                    target.AddLinkLib("gdi32");
                    target.AddLinkLib("comdlg32");
                    target.AddLinkLib("winspool");
                    target.AddLinkLib("winmm");
                    target.AddLinkLib("shell32");
                    target.AddLinkLib("comctl32");
                    target.AddLinkLib("ole32");
                    target.AddLinkLib("oleaut32");
                    target.AddLinkLib("uuid");
                    target.AddLinkLib("rpcrt4");
                    target.AddLinkLib("advapi32");
                    target.AddLinkLib("wsock32");
                    target.AddLinkLib("odbc32");


                    // Compiler dependent settings
                    local compOpts;
                    local linkOpts;

                    switch (i) {

                        // DMARS
                    case 0:
                        compOpts = "-mn -cpp -Ae -Ar -o -w- -6 -D_WIN32_WINNT=0x0400 -D__WXMSW__ -DNOPCH -D__WIN32__";
                        linkOpts = "/NOLOGO /SILENT /NOI /DELEXECUTABLE /EXETYPE:NT /su:windows:4.0";
                        if (k==1) compOpts += "-g -D__WXDEBUG__";
                        break;
                        // GCC
                    case 1:
                        compOpts = "-s -O3 -Os -mthreads -W -Wall -DNOPCH  -D__WXMSW__ -Wno-ctor-dtor-privacy -DHAVE_W32API_H -MD";
                        linkOpts = "-s -mthreads -Wl,--subsystem,windows -mwindows";
                        if (k==1) compOpts += "-g -D__WXDEBUG__";
                        break;
                        // OW
                    case 2:
                        compOpts = "/MT /W4 /O2 /Ot /GR /GRR /EHsc /GA /DWIN32 /DNOPCH /D_WINDOWS /D__WXMSW__ /D__WIN32__";
                        linkOpts = "/SUBSYSTEM:WINDOWS";
                        if (k==1) compOpts += "-zi /D_DEBUG /D__WXDEBUG__";
                        break;
                    case 3:
                        compOpts = "-bw -br -bn -ot -d -d0 -zw -bt=nt -fp6 -wcd=549 -wcd=656 -wcd=657 -wcd=667 -wcd=726 -d_WXMSW_";
                        linkOpts = "-\"system nt_win\"";
                        if (k==1) compOpts += "-g";
                        break;

                    case 4:
                        break;

                    }

                    target.AddLinkerOption(linkOpts);
                    target.AddCompilerOption(compOpts);
                    target.SetIncludeInTargetAll(true);

                }
            }

        }

    }

    for (i = 0; i<project.GetBuildTargetsCount(); i++) {
        project.AddFile(i,"app.cpp",true,true,50);
        project.AddFile(i,"frmMain.cpp",true,true,50);
        project.AddFile(i,"wx.rc",true,true,50);
        project.AddFile(i,"frmMain.h",false,false,50);
        project.AddFile(i,"_wx_intellisense.h",false,false,50);
    }

    return true;
}

function GetFilesDir() {

    local result = "wxWidgets-multi/files";
    return result;
}

--- End code ---

This is the code...

mandrav:
Oh, I forgot to tell you the last thing you should do :).

[*] All literal strings in Squirrel which will be passed to SDK-bound functions, must be enclosed in _T(). So, Wizard.GetTextControlValue("m_txtBasePath"); would become Wizard.GetTextControlValue(_T("m_txtBasePath"));, etc.

Trikko:

--- Quote from: mandrav on August 31, 2006, 03:53:30 pm ---Oh, I forgot to tell you the last thing you should do :).

[*] All literal strings in Squirrel which will be passed to SDK-bound functions, must be enclosed in _T(). So, Wizard.GetTextControlValue("m_txtBasePath"); would become Wizard.GetTextControlValue(_T("m_txtBasePath"));, etc.

--- End quote ---

Good it works now. But there's a wizard-related problem. (This problem exists in old version too...).

Take a look:

--- Code: ---    for (i = 0; i<project.GetBuildTargetsCount(); i++) {
        project.AddFile(i,_T("app.cpp"),true,true,50);
        project.AddFile(i,_T("frmMain.cpp"),true,true,50);
        project.AddFile(i,_T("wx.rc"),true,true,50);
        project.AddFile(i,_T("frmMain.h"),false,false,50);
        project.AddFile(i,_T("_wx_intellisense.h"),false,false,50);
    }

--- End code ---

I add these files to project for each target. But when i compile the new project it won't works becouse on project "properties -> targets -> selected build target files"  static box all items are unchecked. How can i "check" them from script?

Thanks in advance!

Navigation

[0] Message Index

[*] Previous page

Go to full version