User forums > Help

wizard 'staticlib' help

(1/3) > >>

LETARTARE:
hello,
environment :

--- Quote ---Vista Business Pack 2,   Mingw32 with TDM-GCC 4.7.1
C::B 12.11 release (wxWidgets unicode 2.8.12)
--- End quote ---

With the help of the wizard

--- Quote ---'File->New->Project->Static library'
--- End quote ---
I create a static library project 'libOne.cbp':

--- Quote ---Project title = 'libOne'
Compiler =  'GNU  GCC compiler 4.7.1'
Create Release configuration = 'One'
Output dir = 'lib\'
Objects output dir = 'obj'
--- End quote ---

I watch 'Project-> Properties-> Build targets' :

--- Quote ---Output filename = 'libOne.a'
--- End quote ---
path Output dir = 'lib\' does not appear !
I waited 'lib\libOne.a'.

Generation is correct and the library is in the root of the project :

--- Quote ---libOne.a
--- End quote ---

Where is the error ?

LETARTARE:
hello,
the error was in the file 'staticlib/wizard.script'.
in function :

--- Code: ---function SetupTarget(target, is_debug)
{
    if (IsNull(target))
        return false;

    target.SetTargetType(ttStaticLib);
   
    if (target.GetWorkingDir().Matches(_T("")))
        target.SetOutputFilename(target.SuggestOutputFilename());
    else
        target.SetOutputFilename(target.GetWorkingDir() + wxFILE_SEP_PATH + target.SuggestOutputFilename());

    if (is_debug)
    {
        // enable debugging symbols for this target
        // DebugSymbolsOn(target, Wizard.GetTargetCompilerID()); // TODO: doesn't seem to work?
        DebugSymbolsOn(target, Wizard.GetCompilerID());
    }
    else
    {
        // enable optimizations for this target
        // OptimizationsOn(target, Wizard.GetTargetCompilerID()); // TODO: doesn't seem to work?
        OptimizationsOn(target, Wizard.GetCompilerID());
    }

    return true;
}

--- End code ---
the function

--- Quote ---GetWorkingDir() -> wxString CompileTargetBase::GetWorkingDir()
--- End quote ---
always returns _T("") for a target 'ttstaticlib'
So it is always

--- Code: ---target.SetOutputFilename (target.SuggestOutputFilename ());
--- End code ---
which is executed.

I propose

--- Code: ---local outputdir = _T("")
    if ( target.GetTitle().Matches(Wizard.GetDebugName()) )
outputdir = Wizard.GetDebugOutputDir()
    if ( target.GetTitle().Matches(Wizard.GetReleaseName()) )
outputdir = Wizard.GetReleaseOutputDir()

    if (target.GetWorkingDir().Matches(_T("")))   /// ALWAYS !!
        target.SetOutputFilename( outputdir + target.SuggestOutputFilename());
--- End code ---

With this fix, generation is correctly positioned

--- Quote ---lib\libOne.a
--- End quote ---

Could you check this proposal ?


LETARTARE:
If you add a target (static library) in a project  include the same problem
Also must add more:   
--- Code: ---local outputdir = _T("")
    if ( target.GetTitle().Matches(Wizard.GetDebugName()) )
   outputdir = Wizard.GetDebugOutputDir()
    else
    if ( target.GetTitle().Matches(Wizard.GetReleaseName()) )
   outputdir = Wizard.GetReleaseOutputDir()
    else
          outputdir = Wizard.GetTargetOutputDir()
--- End code ---
which take into account the directory 'Output dir'

Cordially.

Alpha:
Could you generate a patch with svn diff please?

LETARTARE:
yes
with CB 12.11 r8628

Navigation

[0] Message Index

[#] Next page

Go to full version