#!/usr/bin/env perl

use strict;
use warnings;

use SPVM::Build::Exe;
use SPVM::Build::Util;

SPVM::Build::Util::getopt
  'h|help'          => \my $help,
  'v|version'       => \my $show_version,
  'o|output=s'      => \my $output_file,
  'I|include-dir=s' => \my @include_dirs,
  'B|build-dir=s'   => \my $build_dir,
;

die SPVM::Build::Util::extract_usage if $help || !(my $package_name = shift);

push @INC, @include_dirs;

my $build_exe = SPVM::Build::Exe->new(
  build_dir => $build_dir,
  output_file => $output_file,
);
$build_exe->create_exe_file($package_name);

=encoding utf8

=head1 NAME

spvmcc - SPVM compiler to create exe file

=head1 SYNOPSIS

  Usage: spvmcc [OPTIONS] [PACKAGE]

    spvmcc -Ilib -Bspvmcc_build -o my_app My::App

  Options:
    -h, --help                     Show this message
    -v, --version                  Version
    -o, --output <file>            Output file
    -I, --include-dir <directory>  Add package search path
    -B, --build-dir <directory>    Building diretory

=head1 DESCRIPTION

spvmcc is SPVM compiler to create exe file.

Created exe file is executed by itself.
