2022-04-13 05:31:38 +08:00
# Cubiomes Viewer Build Instructions
2022-04-14 03:24:54 +08:00
Cubiomes Viewer is a Qt5 application and requires:
2024-02-10 23:23:01 +08:00
* Qt5.9 or newer
2022-04-14 03:24:54 +08:00
* GNU C++ compiler (GCC or Clang).
2022-04-13 05:31:38 +08:00
2022-04-14 03:24:54 +08:00
The cubiomes library is included as a submodule to this repository.
2022-04-13 05:31:38 +08:00
2022-04-14 03:24:54 +08:00
## The Compiler
2022-04-13 05:31:38 +08:00
2022-04-13 05:42:40 +08:00
You should have either GCC or Clang installed.
2022-04-14 03:24:54 +08:00
Windows users can use MinGW, which can be installed together with Qt, using the Qt Installer.
2022-04-13 05:31:38 +08:00
2022-04-13 05:42:40 +08:00
## Get Qt5
2022-04-13 05:31:38 +08:00
Depending on your operating system you may have several options for installing Qt5,
2022-04-14 03:24:54 +08:00
but [Using the Qt Installer ](buildguide.md#using-the-qt-installer ) should be the most general method.
Many Linux distros already provide Qt in their repositories and you can also
[Get Qt With Your Package Manager ](buildguide.md#get-qt-with-your-package-manager ) instead if you wish.
2022-04-13 05:31:38 +08:00
2024-02-10 23:23:01 +08:00
For a static build you will have to [Compile Qt from Source ](buildguide.md#compile-qt-from-source ).
2022-04-13 05:31:38 +08:00
### Using the Qt Installer
2022-04-14 03:24:54 +08:00
You can use the [Qt Online Installer ](https://www.qt.io/download-qt-installer ) if you have a Qt account or don't mind creating one.
2022-04-13 05:31:38 +08:00
It is also possible to use the [Qt Offline Installer ](https://www.qt.io/offline-installers ) without an account,
but you have to disconnect from the internet when you launch the installer, otherwise it will require a Qt account again, which is a little irritating.
Choose an installation path without spaces.
2022-04-13 05:57:36 +08:00
The only required component is the Qt5 base install for your compiler.
2022-04-13 05:31:38 +08:00
(Make sure to select a compiler which supports GNU extensions, such as MinGW.)
2022-04-13 05:57:36 +08:00
I would also recommend installing QtCreator, as well as MinGW on Windows from the Developer Tools.
2022-04-13 05:31:38 +08:00
2022-04-14 03:24:54 +08:00
### Get Qt With Your Package Manager
2022-04-13 05:31:38 +08:00
##### Debian
```
$ sudo apt install build-essential qt5-default
```
##### Fedora
```
2022-06-12 08:54:07 +08:00
$ sudo dnf install qt5-qtbase-devel qt5-linguist
2022-04-13 05:31:38 +08:00
```
##### macOS
```
$ xcode-select --install
$ brew install qt@5
$ brew link qt@5
```
2024-02-10 23:23:01 +08:00
### Compile Qt from Source
2022-04-13 05:31:38 +08:00
2024-02-10 23:23:01 +08:00
You can get the Qt sources from the [Qt download archive ](https://download.qt.io/archive/qt ).
For cubiomes-viewer it is sufficient to get the qtbase submodule.
Check the system requirements on the [Qt Wiki ](https://wiki.qt.io/Building_Qt_5_from_Git ),
which will depend on the platform and Qt version.
A possible configuration for a static build may be:
```
$ mkdir qt5; cd qt5
$ wget https://download.qt.io/archive/qt/5.15/5.15.12/submodules/qtbase-everywhere-opensource-src-5.15.12.tar.xz
$ tar xf qtbase-everywhere-opensource-src-5.15.12.tar.xz
2024-02-11 03:30:48 +08:00
$ ./qtbase-everywhere-src-5.15.12/configure -release -static -opensource -confirm-license -nomake examples -opengl -fontconfig -system-freetype -qt-zlib -qt-libjpeg -qt-libpng -qt-pcre -qt-harfbuzz -prefix .
2024-02-10 23:23:01 +08:00
$ make -s -j 4
```
## Get the Cubiomes Sources
2022-04-13 05:31:38 +08:00
The cubiomes-viewer repository includes the cubiomes library as a submodule and requires a recursive clone:
```
$ git clone --recursive https://github.com/Cubitect/cubiomes-viewer.git
```
2022-04-14 03:24:54 +08:00
If you have QtCreator you can now just open the `cubiome-viewer.pro` file and configure the project.
2022-04-13 05:31:38 +08:00
Alternatively you can manually prepare a build directory:
```
$ cd cubiomes-viewer
$ mkdir build
$ cd build
```
and build cubiomes-viewer:
```
$ qmake ..
$ make
```
#### Notes:
With some Qt installs it is `qmake-qt5` instead.
2022-04-13 06:00:57 +08:00
With MinGW the make command is something like `minwgw32-make` instead.
2022-04-13 05:57:36 +08:00
If the commands are not found, make sure that the Qt `bin` directory is in the `PATH` variable.
(The same applies to `C:/Qt/Qt15.12.12/Tools/mingw730_64/bin` or wherever your compiler is installed.)
2022-04-13 05:31:38 +08:00