Alien-Xmake
view release on metacpan or search on metacpan
<p align="center"><img width="916" height="236" src="https://xmake.io/assets/img/index/xmake-basic-render.gif"></p>
</div>
# Methods
Not many are required or provided.
## `install_type()`
Returns 'system' or 'shared'.
## `exe()`
```
system Alien::Xmake->exe;
```
Returns the full path to the Xmake executable.
## `xrepo()`
```
system Alien::Xmake->xrepo;
```
Returns the full path to the [xrepo](https://github.com/xmake-io/xmake-repo) executable.
## `bin_dir()`
```perl
use Env qw[@PATH];
unshift @PATH, Alien::Xmake->bin_dir;
```
Returns a list of directories you should push onto your PATH.
For a 'system' install this step will not be required.
## `version()`
```perl
my $ver = Alien::Xmake->version;
```
Returns the version of Xmake installed.
Under a 'system' install, `xmake --version` is run once and the version number is cached.
# Alien::Base Helper
To use Xmake in your `alienfile`s, require this module and use `%{xmake}` and `%{xrepo}`.
```perl
use alienfile;
# ...
[ '%{xmake}', 'install' ],
[ '%{xrepo}', 'install ...' ]
# ...
```
# Xmake Cookbook
Xmake is severely underrated so I'll add more nifty things here but for now just a quick example.
You're free to create your own projects, of course, but Xmake comes with the ability to generate an entire project for
you:
```
$ xmake create -P hi # generates a basic console project in C++ and xmake.lua build script
$ cd hi
$ xmake -y # builds the project if required, installing defined prerequisite libs, etc.
$ xmake run # runs the target binary which prints 'hello, world!'
```
`xmake create` is a lot like `minil new` in that it generates a new project for you that's ready to build even before
you change anything. It even tosses a `.gitignore` file in. You can generate projects in C++, Go, Objective C, Rust,
Swift, D, Zig, Vale, Pascal, Nim, Fortran, and more. You can also generate boilerplate projects for simple console
apps, static and shared libraries, macOS bundles, GUI apps based on Qt or wxWidgets, IOS apps, and more.
See `xmake create --help` for a full list.
# Prerequisites
Windows simply downloads an installer but elsewhere, you gotta have git, make, and a C compiler installed to build and
install Xmake. If you'd like Alien::Xmake to use a pre-built or system install of Xmake, install it yourself first with
one of the following:
- Built from source
```
$ curl -fsSL https://xmake.io/shget.text | bash
```
...or on Windows with Powershell...
```
> Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
```
...or if you want to do it all by hand, try...
```
$ git clone --recursive https://github.com/xmake-io/xmake.git
# Xmake maintains dependencies via git submodule so --recursive is required
$ cd ./xmake
# On macOS, you may need to run: export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
$ ./configure
$ make
$ ./scripts/get.sh __local__ __install_only__
$ source ~/.xmake/profile
```
...or building from source on Windows...
```
> git clone --recursive https://github.com/xmake-io/xmake.git
> cd ./xmake/core
> xmake
```
- Windows
( run in 1.584 second using v1.01-cache-2.11-cpan-22024b96cdf )