Compare commits

...

5 Commits

Author SHA1 Message Date
milkwx3 032b38833d Обновить README.md
Build / build (push) Has been cancelled
2026-07-16 19:34:32 +00:00
milkwx3 78a2fc0b06 Обновить README.md
Build / build (push) Has been cancelled
2026-07-08 10:05:24 +00:00
literallyMilk 5e77586a8d README.md is a Markdown file, duh
Build / build (push) Has been cancelled
2026-07-08 13:03:47 +03:00
literallyMilk a8ca1edaef Added compiling for Windows
Build / build (push) Has been cancelled
2026-07-08 13:01:49 +03:00
literallyMilk 54a7662952 Added compiling for Windows 2026-07-08 13:01:32 +03:00
14 changed files with 80 additions and 17 deletions
+3 -1
View File
@@ -8,4 +8,6 @@ __UTILS__
snapshots
OUTPUT-Linux
OUTPUT-w64
OUTPUT-w32
OUTPUT-w32
makeheaders/makeheaders.exe
makeheaders/makeheaders
+33
View File
@@ -0,0 +1,33 @@
# Compiling
### NOTICE: Clone the repository with `-recursive`, e.g `git clone ... -recursive`
## Compiling on Linux
1) Install tools.
### Debian-based distros:
#### Essential stuff:
```sh
sudo apt install build-essential cmake zip unzip make libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev
```
#### If you also want to compile for Windows:
```sh
sudo apt install g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64 g++-mingw-w64-i686 gcc-mingw-w64-i686
```
### Arch-based distros:
#### Essential stuff:
```sh
sudo pacman -S --needed base-devel cmake zip unzip libxcursor libxinerama libxi libxrandr wayland-utils mesa glu libglvnd alsa-lib pulseaudio
```
#### If you also want to compile for Windows:
```sh
sudo pacman -S --needed mingw-w64-gcc
```
2) Run `compile.sh` to compile for Linux, 64-bit Windows & 32-bit Windows.
Run `compile_linux.sh` to compile for Linux only.
## Compiling on Windows
1) Install [CMake](https://cmake.org/download/), [Ninja](https://ninja-build.org/) and [MinGW](https://www.mingw-w64.org/).
Try them out in the terminal: `cmake -version`, `ninja --version`, `gcc -version`, `g++ -version`.
If some are missing, add them to PATH.
2) From the terminal, run `compile.ps1`.
+15
View File
@@ -0,0 +1,15 @@
cd makeheaders
make
cd ..
./makeheaders/makeheaders.exe -h src/helpers/vars.hpp src/helpers/chunks.cpp src/helpers/debug.cpp src/helpers/entities.cpp src/helpers/input.cpp src/helpers/menu.cpp src/helpers/mesher.cpp src/helpers/networking.cpp src/helpers/utils.cpp src/helpers/inlines.hpp src/helpers/inventory.cpp src/helpers/locale.cpp src/helpers/recipes.cpp src/helpers/particles.cpp src/helpers/player.cpp src/helpers/multisound.cpp -v > tmp.hpp
Get-Content .\additions.hpp, .\tmp.hpp | Out-File .\src\helpers\common.hpp -Encoding UTF8
rm tmp.hpp
echo Building x86-64 Windows...
rm build
cmake -DCMAKE_TOOLCHAIN_FILE='toolchains/mingw-w64-native.cmake' . -DWIN32=ON -DWIN32=true -B build -G "Ninja"
cmake --build build
mkdir OUTPUT-w64
cp build/src/RCRAFT.exe OUTPUT-w64/CubeGame.exe
cp -r data/resources OUTPUT-w64
+4
View File
@@ -1,5 +1,9 @@
#/usr/bin/bash
cd makeheaders
make
cd ..
sh compile_linux.sh
sh compile_windows_64.sh
sh compile_windows.sh
+1 -3
View File
@@ -7,9 +7,7 @@ rm tmp.hpp
echo Building x86-64 Linux...
rm -rf build
cmake -B build -DUNIX=ON -DUNIX=true -DCMAKE_BUILD_TYPE=Debug
cd build
make -j12
cd ..
cmake --build build
mkdir OUTPUT-Linux
cp build/src/RCRAFT OUTPUT-Linux/CubeGame
cp -r data/resources OUTPUT-Linux
+1 -3
View File
@@ -7,9 +7,7 @@ rm tmp.hpp
echo Building i686 Windows...
rm -rf build
cmake -DCMAKE_TOOLCHAIN_FILE=toolchains/mingw-w32.cmake -DWIN32=ON -DWIN32=true -B build
cd build
make -j12
cd ..
cmake --build build
mkdir OUTPUT-w32
cp build/src/RCRAFT.exe OUTPUT-w32/CubeGame.exe
cp -r data/resources OUTPUT-w32
+1 -3
View File
@@ -7,9 +7,7 @@ rm tmp.hpp
echo Building x86-64 Windows...
rm -rf build
cmake -DCMAKE_TOOLCHAIN_FILE=toolchains/mingw-w64.cmake -DWIN32=ON -DWIN32=true -B build
cd build
make -j12
cd ..
cmake --build build
mkdir OUTPUT-w64
cp build/src/RCRAFT.exe OUTPUT-w64/CubeGame.exe
cp -r data/resources OUTPUT-w64
Binary file not shown.
+1 -1
View File
@@ -1,4 +1,4 @@
#ifdef WIN32 // FUCK WINDOWS
#ifdef WIN32 // FUCK WINDOWS
#include "external/fix_win32_compatibility.h"
#undef PlaySound
#endif
+2 -2
View File
@@ -488,10 +488,10 @@ void DrawWorldSelect() {
DrawBackground();
int i = 0;
for(std::filesystem::path path : worldList) {
if(Button(reinterpret_cast<const char*>(path.filename().u8string().c_str()), GetScreenWidth()/2-64, i*48+8, 128, 0)) {
if(Button(reinterpret_cast<const char*>(path.filename().string().c_str()), GetScreenWidth()/2-64, i*48+8, 128, 0)) {
online = false;
SetTargetFPS(-1);
_LoadWorld(reinterpret_cast<const char*>(path.u8string().c_str()));
_LoadWorld(reinterpret_cast<const char*>(path.string().c_str()));
return;
}
i++;
+3 -2
View File
@@ -25,7 +25,7 @@ ENetHost* StartServer() {
/* Bind the server to port 1234. */
address.port = PORT;
server = enet_host_create(&address, 32, 1, 0);
server = enet_host_create(&address, 32, 1, 0, 0);
if (server == NULL)
{
fprintf (stderr,
@@ -41,7 +41,8 @@ ENetHost* StartClient() {
client = enet_host_create (NULL /* create a client host */,
1 /* 1 channel*/,
1 /* only allow 1 outgoing connection */,
0 /* assume any amount of incoming bandwidth */);
0 /* assume any amount of incoming bandwidth */,
0);
if (client == NULL)
{
+1 -1
View File
@@ -49,7 +49,7 @@ void LoadRecipes() {
try
{
Recipe _recipe;
const std::string path = dir_entry.path().u8string();
const std::string path = dir_entry.path().string();
std::cout << "loading " << path << std::endl;
YAML::Node recipe = YAML::LoadFile(path);
_recipe.requiredStation = recipe["station"].as<std::string>();
+14
View File
@@ -0,0 +1,14 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_RC_COMPILER windres)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_C_FLAGS "-static-libgcc -static-libstdc++ ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-static-libgcc -static-libstdc++ ${CMAKE_CXX_FLAGS}")