| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::Build::CMake; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
369076
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
80
|
|
|
4
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
139
|
|
|
5
|
3
|
|
|
3
|
|
60
|
use 5.008001; |
|
|
3
|
|
|
|
|
11
|
|
|
6
|
3
|
|
|
3
|
|
14
|
use Config; |
|
|
3
|
|
|
|
|
12
|
|
|
|
3
|
|
|
|
|
125
|
|
|
7
|
3
|
|
|
3
|
|
461
|
use Alien::Build::Plugin; |
|
|
3
|
|
|
|
|
3521
|
|
|
|
3
|
|
|
|
|
22
|
|
|
8
|
3
|
|
|
3
|
|
542
|
use Capture::Tiny qw( capture ); |
|
|
3
|
|
|
|
|
16345
|
|
|
|
3
|
|
|
|
|
1633
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: CMake plugin for Alien::Build |
|
11
|
|
|
|
|
|
|
our $VERSION = '0.04_02'; # TRIAL VERSION |
|
12
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub cmake_generator |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
2
|
50
|
|
2
|
1
|
64
|
if($^O eq 'MSWin32') |
|
18
|
|
|
|
|
|
|
{ |
|
19
|
0
|
0
|
|
|
|
0
|
return 'MinGW Makefiles' if is_dmake(); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
{ |
|
22
|
0
|
|
|
0
|
|
0
|
my($out, $err) = capture { system $Config{make}, '/?' }; |
|
|
0
|
|
|
|
|
0
|
|
|
23
|
0
|
0
|
|
|
|
0
|
return 'NMake Makefiles' if $out =~ /NMAKE/; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
{ |
|
27
|
0
|
|
|
0
|
|
0
|
my($out, $err) = capture { system $Config{make}, '--version' }; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
28
|
0
|
0
|
|
|
|
0
|
return 'MinGW Makefiles' if $out =~ /GNU Make/; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
die 'make not detected'; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
else |
|
34
|
|
|
|
|
|
|
{ |
|
35
|
2
|
|
|
|
|
10
|
return 'Unix Makefiles'; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub init |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
1
|
|
|
1
|
1
|
40644
|
my($self, $meta) = @_; |
|
42
|
|
|
|
|
|
|
|
|
43
|
1
|
50
|
|
|
|
8
|
$meta->prop->{destdir} = $^O eq 'MSWin32' ? 0 : 1; |
|
44
|
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
7
|
$meta->add_requires('share' => 'Alien::cmake3' => '0.02'); |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
50
|
|
|
|
16
|
if(is_dmake()) |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
|
|
|
|
|
|
# even on at least some older versions of strawberry that do not |
|
50
|
|
|
|
|
|
|
# use it, come with gmake in the PATH. So to save us the effort |
|
51
|
|
|
|
|
|
|
# of having to install Alien::gmake lets just use that version |
|
52
|
|
|
|
|
|
|
# if we can find it! |
|
53
|
0
|
|
|
|
|
0
|
my $found_gnu_make = 0; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
foreach my $exe (qw( gmake make mingw32-make )) |
|
56
|
|
|
|
|
|
|
{ |
|
57
|
0
|
|
|
0
|
|
0
|
my($out, $err) = capture { system $exe, '--version' }; |
|
|
0
|
|
|
|
|
0
|
|
|
58
|
0
|
0
|
|
|
|
0
|
if($out =~ /GNU Make/) |
|
59
|
|
|
|
|
|
|
{ |
|
60
|
0
|
|
|
0
|
|
0
|
$meta->interpolator->replace_helper('make' => sub { $exe }); |
|
|
0
|
|
|
|
|
0
|
|
|
61
|
0
|
|
|
|
|
0
|
$found_gnu_make = 1; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
0
|
if(!$found_gnu_make) |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
0
|
|
|
|
|
0
|
$meta->add_requires('share' => 'Alien::gmake' => '0.20'); |
|
68
|
0
|
|
|
0
|
|
0
|
$meta->interpolator->replace_helper('make' => sub { require Alien::gmake; Alien::gmake->exe }); |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
1
|
|
|
1
|
|
4
|
$meta->interpolator->replace_helper('cmake' => sub { require Alien::cmake3; Alien::cmake3->exe }); |
|
|
1
|
|
|
|
|
22583
|
|
|
|
1
|
|
|
|
|
9
|
|
|
73
|
1
|
|
|
|
|
2227
|
$meta->interpolator->add_helper('cmake_generator' => \&cmake_generator); |
|
74
|
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
17
|
my @args = ( |
|
76
|
|
|
|
|
|
|
-G => '%{cmake_generator}', |
|
77
|
|
|
|
|
|
|
'-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true', |
|
78
|
|
|
|
|
|
|
'-DCMAKE_INSTALL_PREFIX:PATH=%{.install.prefix}', |
|
79
|
|
|
|
|
|
|
'-DCMAKE_MAKE_PROGRAM:PATH=%{make}', |
|
80
|
|
|
|
|
|
|
); |
|
81
|
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
318
|
$meta->default_hook( |
|
83
|
|
|
|
|
|
|
build => [ |
|
84
|
|
|
|
|
|
|
['%{cmake}', @args, '.' ], |
|
85
|
|
|
|
|
|
|
['%{make}' ], |
|
86
|
|
|
|
|
|
|
['%{make}', 'install' ], |
|
87
|
|
|
|
|
|
|
], |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# TODO: set the makefile type ?? |
|
91
|
|
|
|
|
|
|
# TODO: handle destdir on windows ?? |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $is_dmake; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub is_dmake |
|
97
|
|
|
|
|
|
|
{ |
|
98
|
2
|
50
|
|
2
|
1
|
27
|
unless(defined $is_dmake) |
|
99
|
|
|
|
|
|
|
{ |
|
100
|
2
|
50
|
|
|
|
10
|
if($^O eq 'MSWin32') |
|
101
|
|
|
|
|
|
|
{ |
|
102
|
0
|
|
|
0
|
|
0
|
my($out, $err) = capture { system $Config{make}, '-V' }; |
|
|
0
|
|
|
|
|
0
|
|
|
103
|
0
|
0
|
|
|
|
0
|
$is_dmake = $out =~ /dmake/ ? 1 : 0; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
else |
|
106
|
|
|
|
|
|
|
{ |
|
107
|
2
|
|
|
|
|
3
|
$is_dmake = 0; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
2
|
|
|
|
|
12
|
$is_dmake; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
__END__ |