Alien-Xmake-Project

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

              add_links("pthread", "m", "dl")
          end
          if is_arch("arm.*") then
              add_defines("ARM")
          end
        ```

        `when` is also available at the project (root/global) scope to guard `add_rules`/`add_requires`/`includes` and any
        root statement.

    - **raw hooks and escape hatch**

        Hooks take raw Lua function bodies: `on_load` `on_config` `on_build` `on_build_file` `before_build` `after_build`
        `on_link` `on_clean` `on_install` `on_uninstall` `on_run`. Strings that begin with `function` are emitted
        unquoted; other strings are quoted and joined as arguments:

        ```js
        ...->on_build( 'function (target) print(target:name()) end' )
        ...->on_install( 'windows', 'function (target) end' )
        ```

        `lua( @lines )` pushes raw Lua lines straight into the target body (escape hatch).

## Option builder

An `option(...)` block describes a configurable build option. Every method is chainable. A trailing hashref becomes an
options table; `true`/`false` emit bare Lua booleans. Note that an option created with the inline table form (`option('name', { ... })`) cannot be extended with these setters.

- `set_default( $value )`

    ```
    ...->set_default( true )

lib/Alien/Xmake/Project.pm  view on Meta::CPAN

    method on_prepare           (@a) { $self->_hook( 'on_prepare',           @a ); }
    method on_prepare_file      (@a) { $self->_hook( 'on_prepare_file',      @a ); }
    method on_prepare_files     (@a) { $self->_hook( 'on_prepare_files',     @a ); }
    method before_prepare       (@a) { $self->_hook( 'before_prepare',       @a ); }
    method after_prepare        (@a) { $self->_hook( 'after_prepare',        @a ); }
    method before_prepare_file  (@a) { $self->_hook( 'before_prepare_file',  @a ); }
    method after_prepare_file   (@a) { $self->_hook( 'after_prepare_file',   @a ); }
    method before_prepare_files (@a) { $self->_hook( 'before_prepare_files', @a ); }
    method after_prepare_files  (@a) { $self->_hook( 'after_prepare_files',  @a ); }

    # raw Lua escape hatch
    method lua (@lines) {
        push @$lines, map { ref($_) eq 'ARRAY' ? @$_ : $_ } @lines;
        $self;
    }
};
#
class Alien::Xmake::Project::Namespace v1.0.0 {
    field $_project : param;
    field $_name    : param : reader(name);
    field $_body    : param = [];

lib/Alien/Xmake/Project.pod  view on Meta::CPAN

    if is_plat("windows", "linux") then
        add_links("pthread", "m", "dl")
    end
    if is_arch("arm.*") then
        add_defines("ARM")
    end

C<when> is also available at the project (root/global) scope to guard C<add_rules>/C<add_requires>/C<includes> and any
root statement.

=item B<raw hooks and escape hatch>

Hooks take raw Lua function bodies: C<on_load> C<on_config> C<on_build> C<on_build_file> C<before_build> C<after_build>
C<on_link> C<on_clean> C<on_install> C<on_uninstall> C<on_run>. Strings that begin with C<function> are emitted
unquoted; other strings are quoted and joined as arguments:

    ...->on_build( 'function (target) print(target:name()) end' )
    ...->on_install( 'windows', 'function (target) end' )

C<lua( @lines )> pushes raw Lua lines straight into the target body (escape hatch).

=back

=back

=head2 Option builder

An C<option(...)> block describes a configurable build option. Every method is chainable. A trailing hashref becomes an
options table; C<true>/C<false> emit bare Lua booleans. Note that an option created with the inline table form (C<<
option('name', { ... }) >>) cannot be extended with these setters.



( run in 1.617 second using v1.01-cache-2.11-cpan-54e63673c56 )