Subversion Repositories DevTools

Rev

Rev 1148 | Rev 1152 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1148 Rev 1150
Line 40... Line 40...
40
# Returns         : None
40
# Returns         : None
41
#
41
#
42
BEGIN
42
BEGIN
43
{
43
{
44
    #
44
    #
-
 
45
    #   Locate the QT package
-
 
46
    #   Done by looking for the include/QtGui directory
-
 
47
    #       If we don't find it then don't install the Qt hooks
-
 
48
    #       Generate a warning when Qt is 'Used'
-
 
49
    #       This allows for the building of packages that have Qt and Non-Qt parts
-
 
50
    #
-
 
51
    foreach my $entry ( getPackageList() )
-
 
52
    {
-
 
53
        foreach my $path ( $entry->getIncDirs(1) )
-
 
54
        {
-
 
55
            if ( -d "$path/QtGui" )
-
 
56
            {
-
 
57
                $qt_package = $entry;
-
 
58
                last;
-
 
59
            }
-
 
60
        }
-
 
61
    }
-
 
62
 
-
 
63
    #
-
 
64
    #   Qt not supported in this type of a build
-
 
65
    #   Just exist now. Will create an error if QtUses is activated
-
 
66
    #
-
 
67
    return
-
 
68
        unless ( $qt_package );
-
 
69
 
-
 
70
 
-
 
71
    #
45
    #   Define QT specfic rules.
72
    #   Define QT specfic rules.
46
    #   Will be found in the same directory as this file
73
    #   Will be found in the same directory as this file
47
    #
74
    #
48
    Rules ( StripFileExt( __FILE__ ), 'qt.rul' );
75
    Rules ( StripFileExt( __FILE__ ), 'qt.rul' );
49
 
76
 
Line 53... Line 80...
53
    #
80
    #
54
    RegisterSrcHook ('.qrc', \&src_hook_qrc );
81
    RegisterSrcHook ('.qrc', \&src_hook_qrc );
55
    RegisterSrcHook ('.ui',  \&src_hook_ui );
82
    RegisterSrcHook ('.ui',  \&src_hook_ui );
56
    RegisterSrcHook ('.h',   \&src_hook_h );
83
    RegisterSrcHook ('.h',   \&src_hook_h );
57
    RegisterSrcHook ('.cpp', \&src_hook_cpp );
84
    RegisterSrcHook ('.cpp', \&src_hook_cpp );
-
 
85
    RegisterSrcHook ('.ts',  \&src_hook_ts );
58
 
86
 
59
    #
87
    #
60
    #   Files will be placed into the OBJDIR
88
    #   Files will be placed into the OBJDIR
61
    #   Ensure that the compiler searches this directory
89
    #   Ensure that the compiler searches this directory
62
    #
90
    #
63
    AddIncDir( '*' , "\$(OBJDIR)", '--NoWarn' );
91
    AddIncDir( '*' , "\$(OBJDIR)", '--NoWarn' );
64
 
-
 
65
    #
-
 
66
    #   Locate the QT package
-
 
67
    #   Done by looking for the include/QtGui directory
-
 
68
    #   It MUST exist
-
 
69
    #
-
 
70
    foreach my $entry ( getPackageList() )
-
 
71
    {
-
 
72
        foreach my $path ( $entry->getIncDirs(1) )
-
 
73
        {
-
 
74
            if ( -d "$path/QtGui" )
-
 
75
            {
-
 
76
                $qt_package = $entry;
-
 
77
                last;
-
 
78
            }
-
 
79
        }
-
 
80
    }
-
 
81
    Error ("Cannot find the QT Base Package") unless ( $qt_package );
-
 
82
}
92
}
83
 
93
 
84
#-------------------------------------------------------------------------------
94
#-------------------------------------------------------------------------------
85
# Function        : QtUses
95
# Function        : QtUses
86
#
96
#
Line 106... Line 116...
106
{
116
{
107
    my ($platforms, @components) = @_;
117
    my ($platforms, @components) = @_;
108
    Debug( "QtUses: ",$platforms, @components );
118
    Debug( "QtUses: ",$platforms, @components );
109
    return if ( ! ActivePlatform($platforms) );
119
    return if ( ! ActivePlatform($platforms) );
110
 
120
 
-
 
121
    Error ("Cannot find the Qt Base Package, or Qt is not supported", "on this platform") unless ( $qt_package );
-
 
122
    
111
    foreach my $component ( @components )
123
    foreach my $component ( @components )
112
    {
124
    {
113
        #
125
        #
114
        #   Only do it once
126
        #   Only do it once
115
        #
127
        #
Line 441... Line 453...
441
    $me->Print();
453
    $me->Print();
442
 
454
 
443
    ToolsetRule ( $var );
455
    ToolsetRule ( $var );
444
}
456
}
445
 
457
 
-
 
458
#-------------------------------------------------------------------------------
-
 
459
# Function        : src_hook_ts
-
 
460
#
-
 
461
# Description     : This function will be invoked when a .TS file
-
 
462
#                   is encountered in the Src directive
-
 
463
#
-
 
464
#                   .TS file are QT Translation Source Files
-
 
465
#                   These need to be processed into .qm files
-
 
466
#                   by the lrelease tool
-
 
467
#
-
 
468
# Inputs          : $path           - Source path
-
 
469
#                   $path           - Source file name
-
 
470
#                   $base           - Base file name (no dir or ext)
-
 
471
#                   $ext            - Extension
-
 
472
#
-
 
473
# Returns         : 
-
 
474
#
-
 
475
sub src_hook_ts
-
 
476
{
-
 
477
    Debug ("src_hook_ts: @_");
-
 
478
    my ( $srcfile ,$path, $base, $ext ) = @_;
-
 
479
 
-
 
480
    #
-
 
481
    #   Convert the TS file into a QM file
-
 
482
    #   Place the QM file in the BIN directory
-
 
483
    #
-
 
484
    my $target = "\$(BINDIR)/${base}.qm";
-
 
485
    GenerateSrcFile ( 1, $target  );
-
 
486
 
-
 
487
    #
-
 
488
    #   The user may have specified some dependencies
-
 
489
    #   Create a list of these to be a part of the generated Rule
-
 
490
    #
-
 
491
    my @dlist = split( /$;/, $SRC_DEPEND{$path} )
-
 
492
        if ( exists $SRC_DEPEND{$path} );
-
 
493
    
-
 
494
    #
-
 
495
    #   Create a Rule to build this file
-
 
496
    #   Will be placed in the Rules section
-
 
497
    #
-
 
498
    my $var;
-
 
499
    my $me = MakeEntry::New (\$var, $target );
-
 
500
    $me->AddComment ("QT Translation File: $path" );
-
 
501
    $me->AddDependancy ( $srcfile );
-
 
502
    $me->AddDependancy ( @dlist );
-
 
503
    $me->AddDependancy ( '$(SCM_MAKEFILE)' );
-
 
504
    $me->AddDependancy ( '$(GBE_OBJDIR)' );
-
 
505
    $me->AddRecipe     ( '$(XX_PRE)$(QT_TRANSLATE)' );
-
 
506
    $me->Print();
-
 
507
 
-
 
508
    ToolsetRule ( $var );
-
 
509
 
-
 
510
    #
-
 
511
    #   Append the generated file to a list
-
 
512
    #
-
 
513
    push( @::QT_PMFILES, "${base}.qm" );
-
 
514
}
-
 
515
 
446
 
516
 
447
1;
517
1;