Install and Uninstall
When the compilation is complete, we can also use the xmake install
command to install the target program and libraries to the system environment.
This is usually used for installation in Linux, Unix, BSD, and other system environments.
NOTE
Although it is also supported under Windows, it is not commonly used because there is no default installation directory on Windows. It is more recommended to generate the installation package directly. For details, see: XPack packaging
Command format
$ xmake install [options] [target]
$ xmake uninstall [options] [target]
Install to the system directory
Usually, we only need to execute the following command to complete the installation. The default installation directory is /usr/local
.
$ xmake install
Install to a specified directory
We can also specify the root directory for installation, which is more useful when there is no default installation directory on Windows.
$ xmake install -o /tmp/usr
installing foo ..
installing foo to /tmp/usr ..
installing test ..
installing test to /tmp/usr ..
install ok!
ruki:test ruki$ tree /tmp/usr
/tmp/usr
├── bin
│ └── test
└── lib
└── libfoo.a
2 directories, 2 files
In addition, we can also configure the default installation path in the configuration file through the set_installdir interface. For details, please refer to the API manual.
Uninstaller
We can also perform the reverse uninstallation operation through xmake uninstall
, and specify the installation directory to be uninstalled.
$ xmake uninstall
$ xmake uninstall --installdir=/tmp/usr