Subversion Repositories DevTools

Rev

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

Rev 5877 Rev 5969
Line 24... Line 24...
24
use JatsVersionUtils;
24
use JatsVersionUtils;
25
use FileUtils;
25
use FileUtils;
26
use Pod::Usage;
26
use Pod::Usage;
27
use Getopt::Long;
27
use Getopt::Long;
28
use File::Path;
28
use File::Path;
-
 
29
use XML::Writer;
29
 
30
 
30
our $BuildVersion           = "2.1.0";
31
our $BuildVersion           = "2.1.0";
31
 
32
 
32
#.. Switchs
33
#.. Switchs
33
#
34
#
Line 4188... Line 4189...
4188
 
4189
 
4189
    return $path;
4190
    return $path;
4190
}
4191
}
4191
 
4192
 
4192
#-------------------------------------------------------------------------------
4193
#-------------------------------------------------------------------------------
-
 
4194
# Function        : WinPath 
-
 
4195
#
-
 
4196
# Description     : Covert path to a windows formatted path
-
 
4197
#
-
 
4198
# Inputs          : One path element
-
 
4199
#
-
 
4200
# Returns         : One ugly path element
-
 
4201
#
-
 
4202
 
-
 
4203
sub WinFullPath
-
 
4204
{
-
 
4205
    my ($path) = @_;
-
 
4206
    $path = FullPath($path);
-
 
4207
    $path =~ tr~\\/~\\~s;
-
 
4208
    return $path;
-
 
4209
}
-
 
4210
 
-
 
4211
#-------------------------------------------------------------------------------
-
 
4212
# Function        : BuildPropertyPages 
-
 
4213
#
-
 
4214
# Description     : Create a props file suitable for use by VS2010, VS2012 (possibly others)
-
 
4215
#                   Only supported for C/C++ projects
-
 
4216
#                   Provide info for:
-
 
4217
#                       Include Search paths
-
 
4218
#                       Library search paths
-
 
4219
#                       Nice Macros 
-
 
4220
#
-
 
4221
# Inputs          : 
-
 
4222
#
-
 
4223
# Returns         : 
-
 
4224
#
-
 
4225
sub BuildPropertyPages
-
 
4226
{
-
 
4227
    StartBuildPhase();                      # Starting the build phase. No more data collection
-
 
4228
    foreach my $platform ( keys %BUILDINFO )
-
 
4229
    {
-
 
4230
        next unless $BUILDINFO{$platform}{MSBUILDPROPS};
-
 
4231
        my $propsFile = $Srcdir . '/jats_'. $BUILDINFO{$platform}{TARGET} . '.props';
-
 
4232
        Message("BuildPropertyPages: $propsFile");
-
 
4233
 
-
 
4234
        #
-
 
4235
        #   Remove files that are created
-
 
4236
        #
-
 
4237
        if ( $Clobber )
-
 
4238
        {
-
 
4239
            unlink $propsFile;
-
 
4240
            next;
-
 
4241
        }
-
 
4242
 
-
 
4243
        my %macros;
-
 
4244
        my @libpaths;
-
 
4245
        my @incpaths;
-
 
4246
        my @parts = @{$BUILDINFO{$platform}{PARTS}};
-
 
4247
 
-
 
4248
        #
-
 
4249
        #   Basic definitions
-
 
4250
        #   
-
 
4251
        $macros{'GBE_ROOT'}     = WinFullPath(".");
-
 
4252
        $macros{'GBE_PLATFORM'} = $BUILDINFO{$platform}{PLATFORM};
-
 
4253
        $macros{'GBE_PRODUCT'}  = $BUILDINFO{$platform}{PRODUCT};
-
 
4254
        $macros{'GBE_TARGET'}   = $BUILDINFO{$platform}{TARGET};
-
 
4255
        $macros{'GBE_MACHTYPE'} = $::GBE_MACHTYPE;
-
 
4256
        $macros{'GBE_PKGDIR'}   = WinFullPath('./pkg/' . $BUILDNAME_PACKAGE);
-
 
4257
        $macros{'GBE_BUILDNAME'}= $BUILDNAME_PACKAGE;
-
 
4258
 
-
 
4259
        #
-
 
4260
        #   Paths from the current build
-
 
4261
        #       Local directory         - for installed components
-
 
4262
        #       Interface directory     - for BuildPkgArchives
-
 
4263
        #
-
 
4264
        if ( $BUILDLOCAL )
-
 
4265
        {
-
 
4266
            my $macroName = 'GBE_LOCALDIR';
-
 
4267
            $macros{$macroName} = WinFullPath("$BUILDLOCAL") ;
-
 
4268
            $macroName = '$(' . $macroName . ')';
-
 
4269
            foreach ( @parts )
-
 
4270
            {
-
 
4271
                push @libpaths, catdir($macroName, 'lib', $_);
-
 
4272
                push @incpaths, catdir($macroName ,'include' ,$_);
-
 
4273
            }
-
 
4274
            push @incpaths, catdir($macroName ,'include');
-
 
4275
        }
-
 
4276
 
-
 
4277
        my $macroName = 'GBE_INTERFACEDIR';
-
 
4278
        $macros{$macroName} = WinFullPath("$BUILDINTERFACE") ;
-
 
4279
        $macroName = '$(' . $macroName . ')';
-
 
4280
 
-
 
4281
        foreach ( @parts )
-
 
4282
        {
-
 
4283
                push @libpaths, catdir($macroName, 'lib' , $_);
-
 
4284
                push @incpaths, catdir($macroName ,'include' ,$_);
-
 
4285
        }
-
 
4286
        push @incpaths, catdir($macroName ,'include');
-
 
4287
 
-
 
4288
        #
-
 
4289
        #   For each LinkPkgArchive
-
 
4290
        #
-
 
4291
        foreach my $package ( @{$PKGRULES{$platform}} )
-
 
4292
        {
-
 
4293
            next unless ( $package->{'type'} eq 'link' );
-
 
4294
 
-
 
4295
            my $macroName = 'GBE_PACKAGE_'.$package->{'name'};
-
 
4296
            $macros{$macroName} = WinFullPath($package->{'base'}) ;
-
 
4297
            $macroName = '$(' . $macroName . ')';
-
 
4298
 
-
 
4299
            for my $path ( @{$package->{'PLIBDIRS'}} )
-
 
4300
            {
-
 
4301
                push @libpaths, catdir($macroName, $path);
-
 
4302
            }
-
 
4303
            for my $path ( @{$package->{'PINCDIRS'}} )
-
 
4304
            {
-
 
4305
                push @incpaths, catdir($macroName, $path);
-
 
4306
            }
-
 
4307
        }
-
 
4308
 
-
 
4309
        my $AdditionalIncludeDirectories = join(';', @incpaths );
-
 
4310
        my $AdditionalLibraryDirectories = join(';', @libpaths);
-
 
4311
        my $PreprocessorDefinitions = 'JATS=1';
-
 
4312
 
-
 
4313
        #
-
 
4314
        #   Create a props file formatted for VS2012
-
 
4315
        #
-
 
4316
        open (my $XML, '>', $propsFile) || Error ("Cannot create output file: $propsFile", $!);
-
 
4317
 
-
 
4318
        my $writer = XML::Writer->new(OUTPUT => $XML, UNSAFE => 0, DATA_INDENT => 4, DATA_MODE => 1);
-
 
4319
        $writer->xmlDecl("UTF-8");
-
 
4320
        $writer->comment('This file is generated by JATS build');
-
 
4321
        $writer->comment('Do not edit this file');
-
 
4322
        $writer->comment('Do not version control this file');
-
 
4323
        $writer->startTag('Project', "ToolsVersion", "4.0", "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
-
 
4324
        $writer->emptyTag('ImportGroup', 'Label' , "PropertySheets");
-
 
4325
 
-
 
4326
        #
-
 
4327
        #   Special Macro for handling production/debug libraries
-
 
4328
        #
-
 
4329
        $writer->startTag('PropertyGroup', 'Label' , "UserMacros", 'Condition', "'\$(Configuration)' == 'Debug'");
-
 
4330
        $writer->dataElement('GBE_TYPE', 'D');
-
 
4331
        $writer->endTag('PropertyGroup');
-
 
4332
        
-
 
4333
        $writer->startTag('PropertyGroup', 'Label' , "UserMacros", 'Condition', "'\$(Configuration)' != 'Debug'");
-
 
4334
        $writer->dataElement('GBE_TYPE', 'P');
-
 
4335
        $writer->endTag('PropertyGroup');
-
 
4336
 
-
 
4337
        #
-
 
4338
        #   Define macros
-
 
4339
        #   
-
 
4340
        $writer->startTag('PropertyGroup', 'Label' , "UserMacros");
-
 
4341
        foreach my $key ( sort keys %macros)
-
 
4342
        {
-
 
4343
            $writer->dataElement($key, $macros{$key});
-
 
4344
        }
-
 
4345
        $writer->endTag('PropertyGroup');
-
 
4346
        $macros{'GBE_TYPE'}     = 1;
-
 
4347
 
-
 
4348
        #
-
 
4349
        #   Extend the search paths for includes and libaraies
-
 
4350
        #   
-
 
4351
        #$writer->emptyTag('ItemDefinitionGroup');
-
 
4352
        $writer->startTag('ItemDefinitionGroup');
-
 
4353
 
-
 
4354
        $writer->startTag('ClCompile');
-
 
4355
        $writer->dataElement('AdditionalIncludeDirectories', $AdditionalIncludeDirectories . ';%(AdditionalIncludeDirectories)');
-
 
4356
        $writer->dataElement('PreprocessorDefinitions', $PreprocessorDefinitions . ';%(PreprocessorDefinitions)');
-
 
4357
        $writer->endTag('ClCompile');
-
 
4358
 
-
 
4359
        $writer->startTag('Link');
-
 
4360
        $writer->dataElement('AdditionalLibraryDirectories', $AdditionalLibraryDirectories . ';%(AdditionalLibraryDirectories)');
-
 
4361
        $writer->endTag('Link');
-
 
4362
        $writer->endTag('ItemDefinitionGroup');
-
 
4363
 
-
 
4364
        #
-
 
4365
        #   Specify all macro names
-
 
4366
        #
-
 
4367
        $writer->startTag('ItemGroup');
-
 
4368
        foreach my $key ( sort keys %macros)
-
 
4369
        {
-
 
4370
            $writer->startTag('BuildMacro', 'Include' , $key);
-
 
4371
            $writer->dataElement('Value', '$(' . $key . ')');
-
 
4372
            $writer->endTag('BuildMacro');
-
 
4373
        }
-
 
4374
 
-
 
4375
        #
-
 
4376
        #   Close tags and write the XML file
-
 
4377
        #
-
 
4378
        $writer->endTag('ItemGroup');
-
 
4379
        $writer->endTag('Project');
-
 
4380
        $writer->end();
-
 
4381
    }
-
 
4382
}
-
 
4383
 
-
 
4384
 
-
 
4385
#-------------------------------------------------------------------------------
4193
# Function        : Usage
4386
# Function        : Usage
4194
#
4387
#
4195
# Description     : Display program usage information
4388
# Description     : Display program usage information
4196
#
4389
#
4197
# Inputs          : args            - Text message to display
4390
# Inputs          : args            - Text message to display