Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding build docs (also MingW64) #11

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "genieutils"]
path = genieutils
path = 3rd-party/genieutils
url = https://github.com/Tapsa/genieutils.git
[submodule "pcrio"]
path = pcrio
path = 3rd-party/pcrio
url = https://github.com/Tapsa/pcrio.git
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
cmake_minimum_required(VERSION 3.10)
project(create-data-mod VERSION 1.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
add_subdirectory(genieutils EXCLUDE_FROM_ALL)
add_subdirectory(3rd-party/genieutils EXCLUDE_FROM_ALL)
include_directories(
"genieutils/include"
"3rd-party/genieutils/include"
"."
)
add_executable(create-data-mod create-data-mod.cpp patches.cpp ids.h)
add_executable(
create-data-mod
create-data-mod.cpp
patches/community_games.cpp
patches/exploding_villagers.cpp
patches/flying_dutchman.cpp
patches/kidnap.cpp
patches/no_wall.cpp
patches/random_costs.cpp
patches/duplicate_techs.cpp
ids.h
)
set_property(TARGET create-data-mod PROPERTY CXX_STANDARD 17)
target_link_libraries(create-data-mod genieutils)
33 changes: 2 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,8 @@ git clone --recurse-submodules https://github.com/SiegeEngineers/auto-mods.git
cd auto-mods
```

### Installing dependencies

You'll need:
- `cmake`
- `gcc`, `g++`
- `libboost-iostreams-dev`
- `libboost-program-options`
- `zlib`

#### Dependencies on Ubuntu (e.g. WSL)

```sh
sudo apt update
sudo apt install --fix-missing gcc g++ cmake \
libboost-iostreams-dev libboost-program-options-dev \
zlib1g-dev
```

### Compiling

Inside the `repository root` use the following commands:

```sh
./patchGenieutils.sh
mkdir build
cd build
cmake ..
cmake --build .
```

You should now have an executable `create-data-mod` in the `build` folder. Hooray!
Please read the [build instructions](./docs/build-instructions.md)
for your corresponding platform.

## Usage

Expand Down
8 changes: 7 additions & 1 deletion create-data-mod.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#include "genie/dat/DatFile.h"
#include "patches.h"
#include "patches/community_games.h"
#include "patches/duplicate_techs.h"
#include "patches/exploding_villagers.h"
#include "patches/flying_dutchman.h"
#include "patches/kidnap.h"
#include "patches/no_wall.h"
#include "patches/random_costs.h"
#include <string>

using namespace std;
Expand Down
62 changes: 62 additions & 0 deletions docs/build-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Build instructions

## Dependencies

### Installing dependencies

You'll need:
- `cmake`
- `gcc`, `g++`
- `libiconv`
- `libboost-iostreams-dev`
- `libboost-program-options`
- `zlib`


### MSYS2 (MingW64) on Windows
Download and follow the install instructions for [MSYS2](https://www.msys2.org/)
- if you have [Chocolatey](chocolatey.org/) installed you can install MSYS2 as follows

`choco install msys2`

After installing start a MSYS2-shell from `<MSYS2-directory>/msys2_shell.cmd`

Update the preinstalled packages: `pacman -Syuu`

Install gcc: `pacman -Syu --needed mingw-w64-x86_64-gcc `

And these dependencies:
`pacman -Syu --needed mingw-w64-x86_64-cmake mingw-w64-x86_64-make mingw-w64-x86_64-libiconv mingw-w64-x86_64-boost mingw-w64-x86_64-zlib`

### WSL (Ubuntu) on Windows

Please [install WSL on your Windows 10 System](https://docs.microsoft.com/en-us/windows/wsl/install-win10), install the Ubuntu distribution from the Microsoft Store and continue with [Ubuntu](#ubuntu)

### Ubuntu

```sh
sudo apt update
sudo apt install --fix-missing gcc g++ cmake \
libboost-iostreams-dev libboost-program-options-dev \
zlib1g-dev
```

## Compiling

Inside the `repository root` use the following commands:

```sh
./patchGenieutils.sh
mkdir build
cd build
cmake ..
// Note: if you are using MingW64 use the following command instead
// cmake -G "CodeBlocks - MinGW Makefiles" ..
// and continue with
cmake --build .
```




You should now have an executable `create-data-mod` in the `build` folder. Hooray!
6 changes: 3 additions & 3 deletions patchGenieutils.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/bash

sed -i 's/#set(Boost_USE_STATIC_LIBS ON)/set(Boost_USE_STATIC_LIBS ON)/' genieutils/CMakeLists.txt
sed -i 's/add_library(${Genieutils_LIBRARY} SHARED/add_library(${Genieutils_LIBRARY} STATIC/' genieutils/CMakeLists.txt
sed -i 's/target_link_libraries(${Genieutils_LIBRARY} ${ZLIB_LIBRARIES} ${Boost_LIBRARIES} ${ICONV_LIBRARIES})/target_link_libraries(${Genieutils_LIBRARY} ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${ICONV_LIBRARIES})/' genieutils/CMakeLists.txt
sed -i 's/#set(Boost_USE_STATIC_LIBS ON)/set(Boost_USE_STATIC_LIBS ON)/' 3rd-party/genieutils/CMakeLists.txt
sed -i 's/add_library(${Genieutils_LIBRARY} SHARED/add_library(${Genieutils_LIBRARY} STATIC/' 3rd-party/genieutils/CMakeLists.txt
sed -i 's/target_link_libraries(${Genieutils_LIBRARY} ${ZLIB_LIBRARIES} ${Boost_LIBRARIES} ${ICONV_LIBRARIES})/target_link_libraries(${Genieutils_LIBRARY} ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${ICONV_LIBRARIES})/' 3rd-party/genieutils/CMakeLists.txt
Loading