Code::Blocks Forums

User forums => Help => Topic started by: deadneurons on October 11, 2007, 06:25:25 am

Title: build options?
Post by: deadneurons on October 11, 2007, 06:25:25 am
Hi,
I am using a custom makefile and the only way I'm able to compile is if I change the default variables in "make commands" dialog e.g.
Code
$make -f $makefile $target          to    $make -f $makefile all
$make -f $makefile clean$target   to    $make -f $makefile clean
I'm fiddling with wizard script and I actually made it work :)
Is there a way to change values in "make commands" tab in  project build option dialog using wizard script?
I digged into the templates folder and made a copy of "avr" folder renamed it to "winarm" I made me a matching images for the project, then read the wiki.
I am now able to load a project using modified wizard script from the avr folder, (ofcourse I don't have the options for my actual target)but I got me a template that works. (BTW In my "Global Compiler settings" I have "GNU ARM GCC Compiler" selected but I had it renamed as "WinARM GCC Compiler", so all the FLAGS are there but not used).

Code
////////////////////////////////////////////////////////////////////////////////
//
// Code::Blocks new project wizard script
// base on Brian Sidebotham avr script
// Project: WinARM project
// Author:  OLE CARM
//
////////////////////////////////////////////////////////////////////////////////
function BeginWizard()
{
    local wiz_type = Wizard.GetWizardType();

    if (wiz_type == wizProject)
    {
        local intro_msg = _T("Welcome to the new WinARM project wizard!\n" +
                             "This wizard will guide you to create a new WinARM project.\n\n" +
                             "When you 're ready to proceed, please click \"Next\"...");

        Wizard.AddInfoPage(_T("WinARMIntro"), intro_msg);
        Wizard.AddProjectPathPage();
        Wizard.AddCompilerPage(_T("WinARM GCC Compiler"), _T("arm*"), false, true);
        //Wizard.AddPage(_T("processorChoice"));       
    }
    else
        print(wiz_type);
}

function GetFilesDir()
{
    local result = _T("winarm/files");
    return result;
}
////////////////////////////////////////////////////////////////////////////////
// Processor choice page
////////////////////////////////////////////////////////////////////////////////
function SetupProject(project)
{   
    //Custom Makefile is used
project.SetMakefileCustom(true);
project.ShowOptions(true);

    // Debug build target
    local target = project.GetBuildTarget(Wizard.GetDebugName());

    // Release build target
    target = project.GetBuildTarget(Wizard.GetReleaseName());
    if (!IsNull(target))
{
target.SetTargetType(ttConsoleOnly);
target.SetTargetFilenameGenerationPolicy(tgfpPlatformDefault, tgfpNone);
target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + _T(".elf"));
//OptimizationsOn(target, Wizard.GetCompilerID());
}

    return true;
}


This is working good for me, but I want to also be able to just click the build/clean without showing the options dialog box and changing the make commands variable, if there is a way.

thanks.







[attachment deleted by admin]
Title: Re: build options?
Post by: Biplab on October 11, 2007, 08:13:14 am
Use SetMakeCommandFor(MakeCommand cmd, const wxString& make) sdk function which is available through script. In the script use it as-

Code
target.SetMakeCommandFor(mcBuild, _T("$make -f $makefile all"));

MakeCommand is defined as-

Quote
enum MakeCommand

Enumerator:
    mcClean   
    mcDistClean   
    mcBuild   
    mcCompileFile   
    mcLast  *Don't* use this. It's only used internally for enumerations... 


HTH. :)
Title: Re: build options?
Post by: deadneurons on October 11, 2007, 01:41:49 pm
'works like a charm :)

thank you.


edit: just incase anyone gets interested here's a zip file, extract to wizard folder.
The templates files is the same as the one in winarm\examples\lpc2138_uart0_irq.
It's not really a template but a compilable source that could be a basis for the actual
template. (me, got to actually learn how to program now).

[attachment deleted by admin]