Alien-Bit
view release on metacpan or search on metacpan
my $libdir = catfile( $prefix, 'lib' );
# Set the compiler flags
$build->runtime_prop->{cflags} = "-I$incdir";
# Set the linker flags
$build->runtime_prop->{libs} = "-L$libdir -lbit";
$build->runtime_prop->{ffi_name} = "bit";
# store the actual paths if you ever have to debug
$build->runtime_prop->{include_dir} = $incdir;
$build->runtime_prop->{lib_dir} = $libdir;
};
test sub {
my ($build) = @_;
my $binary_dest_directory =
catfile( $build->install_prop->{stage}, 'lib' );
my $runTests_exec = $^O eq 'MSWin32' ? 'test_bit.exe' : 'test_bit';
$runTests_exec = catfile( $binary_dest_directory, $runTests_exec );
print("Can't find test executable") if not -e $runTests_exec;
print("\n**************** Running Bit Tests ****************\n");
my $test_output = `$runTests_exec`;
print $test_output;
if ( $test_output =~ /All tests passed/m ) {
print(
"\n**************** Bit tests passed successfully ****************\n"
);
}
else {
croak("Bit tests failed");
}
## execute benchmarks
my $runBench_exec = $^O eq 'MSWin32' ? 'benchmark.exe' : 'benchmark';
$runBench_exec = catfile( $binary_dest_directory, $runBench_exec );
print("Can't find benchmark executable") if not -e $runBench_exec;
print("\n**************** Running Bit Benchmarks ****************\n");
my $bench_output = `$runBench_exec`;
print $bench_output;
# execute openmp + gpu benchmarks
my $runBenchOpenMP_exec =
$^O eq 'MSWin32' ? 'openmp_bit.exe' : 'openmp_bit';
$runBenchOpenMP_exec =
catfile( $binary_dest_directory, $runBenchOpenMP_exec );
print("Can't find openmp benchmark executable")
if not -e $runBenchOpenMP_exec;
print(
"\n**************** Running Bit OpenMP Benchmarks ****************\n"
);
my $bench_openmp_output = qx{$runBenchOpenMP_exec 1024 1000 1000 4};
print $bench_openmp_output;
unlink $runTests_exec;
unlink $runBench_exec;
unlink $runBenchOpenMP_exec;
# delete object files that end in .o
my @object_files = glob( catfile( $binary_dest_directory, '*.o' ) );
unlink $_ for @object_files;
};
};
=cut
( run in 2.256 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )