Skip to content

Commit

Permalink
Update docs for compiling w/ CMake and MSYS2
Browse files Browse the repository at this point in the history
  • Loading branch information
alef committed Jan 23, 2024
1 parent 03a7e46 commit 9b5706c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 57 deletions.
25 changes: 2 additions & 23 deletions doc/COMPILING/COMPILING-CMAKE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For the official way to build CataclysmDDA, see:
You'll need to have these libraries and their development headers installed in order to build CataclysmDDA:

* General
* `cmake` >= 3.0.0
* `cmake` >= 3.20.0
* `gcc-libs`
* `glibc`
* `zlib`
Expand Down Expand Up @@ -72,28 +72,7 @@ Obtain the packages listed above with your system package manager.

## Windows Environment (MSYS2)

1. Follow steps from here: <https://msys2.github.io/>
2. Install CataclysmDDA build deps:

```
pacman -S mingw-w64-i686-toolchain msys/git \
mingw-w64-i686-cmake \
mingw-w64-i686-SDL2_{image,mixer,ttf} \
ncurses-devel \
gettext-devel
```

This should get your environment set up to build both the console and tiles versions for Windows.

**NOTE**: This is only for 32bit builds. 64bit builds require the x86_64 instead of the i686 packages listed above:

```
pacman -S mingw-w64-x86_64-toolchain msys/git \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-SDL2_{image,mixer,ttf} \
ncurses-devel \
gettext-devel
```
Please refer to `COMPILING-MSYS.md`

**NOTE**: If you're trying to test with Jetbrains CLion, point to the CMake version in the msys32/mingw32 path instead of using the built in. This will let CMake detect the installed packages.

Expand Down
54 changes: 20 additions & 34 deletions doc/COMPILING/COMPILING-MSYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

This guide contains instructions for compiling Cataclysm-DDA on Windows under MSYS2. **PLEASE NOTE:** These instructions *are not intended* to produce a redistributable copy of CDDA. Please download the official builds from the website or [cross-compile from Linux](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/COMPILING/COMPILING.md#cross-compile-to-windows-from-linux) if that is your intention.

These instructions were written using 64-bit Windows 7 and the 64-bit version of MSYS2; the steps should be the same for other versions of Windows.

## Prerequisites:

* Windows 7, 8, 8.1, or 10
**Note:** Windows XP is unsupported!

### MINGW64
* Windows 7, 8, 8.1
* NTFS partition with ~10 Gb free space (~2 Gb for MSYS2 installation, ~3 Gb for repository and ~5 Gb for ccache)
* 64-bit version of MSYS2

**Note:** Windows XP is unsupported!
### UCRT64
* Windows 10 and later


## Installation:

Expand All @@ -24,6 +28,10 @@ When working from Microsoft Terminal default MSYS2 profile, run:
```
MSYSTEM=MINGW64 bash -l
```
or
```
MSYSTEM=UCRT64 bash -l
```

## Configuration:

Expand All @@ -43,41 +51,17 @@ pacman -Su

4. Install packages required for compilation:

-> Windows 7, 8, 8.1
```bash
pacman -S git make mingw-w64-x86_64-{astyle,ccache,cmake,gcc,libmad,libwebp,pkgconf,SDL2,libzip,libavif} mingw-w64-x86_64-SDL2_{image,mixer,ttf}
```

5. Close MSYS2.

6. Update path variables in the system-wide profile file (e.g. `C:\dev\msys64\etc\profile`) as following:

- find lines:

```
MSYS2_PATH="/usr/local/bin:/usr/bin:/bin"
MANPATH='/usr/local/man:/usr/share/man:/usr/man:/share/man'
INFOPATH='/usr/local/info:/usr/share/info:/usr/info:/share/info'
pacman -S git make ncurses-devel gettext-devel mingw-w64-x86_64-{astyle,ccache,cmake,gcc,libmad,libwebp,pkgconf,SDL2,libzip,libavif} mingw-w64-x86_64-SDL2_{image,mixer,ttf}
```

and

```
PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig"
```

- and replace them with:

```
MSYS2_PATH="/usr/local/bin:/usr/bin:/bin:/mingw64/bin"
MANPATH='/usr/local/man:/usr/share/man:/usr/man:/share/man:/mingw64/share/man'
INFOPATH='/usr/local/info:/usr/share/info:/usr/info:/share/info:/mingw64/share/info'
-> Windows 10 and later
```bash
pacman -S git make ncurses-devel gettext-devel mingw-w64-ucrt-x86_64-{astyle,ccache,cmake,gcc,libmad,libwebp,pkgconf,SDL2,libzip,libavif} mingw-w64-ucrt-x86_64-SDL2_{image,mixer,ttf}
```

and

```
PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig:/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig"
```
5. Close MSYS2.

## Cloning and compilation:

Expand All @@ -90,6 +74,8 @@ git clone https://github.com/CleverRaven/Cataclysm-DDA.git ./Cataclysm-DDA

**Note:** This will download the entire CDDA repository and all of its history (3GB). If you're just testing, you should probably add `--depth=1` (~350MB).

**Note:** See `COMPILING-CMAKE.md` section `CMake Build for MSYS2 (MinGW)` for using the CMake build system.

2. Compile with following command line:

```bash
Expand All @@ -101,7 +87,7 @@ You will receive warnings about unterminated character constants; they do not im

**Note**: This will compile a release version with Sound and Tiles support and all localization languages, skipping checks and tests, and using ccache for build acceleration. You can use other switches, but `MSYS2=1`, `DYNAMIC_LINKING=1` and probably `RELEASE=1` are required to compile without issues.

See `COMPILING-CMAKE.md` section `CMake Build for MSYS2 (MinGW)` for using the CMake build system here.
See `COMPILING-CMAKE.md` section `CMake Build for MSYS2 (MinGW)` for using the CMake build system.

## Running:

Expand Down

0 comments on commit 9b5706c

Please sign in to comment.