Building from Source
Relevant source files
The following files were used as context for generating this wiki page:
Building mcpi-recompiled from source allows developers to reconstruct and port Minecraft: Pi Edition 0.1.1 alpha natively for modern Linux and Windows x86-64 systems. The project utilizes a portable C++20 build system designed to facilitate incremental reconstruction of game systems while maintaining compatibility with the original TCP port 4711 programming API.
Sources: README.md:3-12, README.md:35-43, CMakeLists.txt:1-13
Build Requirements and Environment
The project relies on modern C++ standards and platform-specific networking libraries. The build system is managed via CMake, requiring version 3.20 or higher.
Toolchain Specifications
- Language Standard: C++20 (Required).
- Compiler Options:
- MSVC (Windows):
/W4 /permissive-flags are applied. - GCC/Clang (Linux):
-Wall -Wextra -Wpedanticflags are applied.
- MSVC (Windows):
- Dependencies:
Threads(Cross-platform).ws2_32(Required for Windows/Winsock support).
Sources: CMakeLists.txt:1-10, CMakeLists.txt:26-34
Build Process Workflow
The build process is standardized using CMake commands to configure, compile, and verify the project.
The build flow ensures that the core library and test suites are synchronized.
Sources: README.md:28-32, CMakeLists.txt:36-54
Project Structure and Build Targets
The mcpi-recompiled project is divided into a core library and several executable targets.
Primary Targets
| Target Name | Type | Description |
|---|---|---|
mcpi_core | Static Library | Contains the core API server and command parsing logic. |
mcpi-recompiled | Executable | The main bootstrap application for the game port. |
mcpi_protocol_tests | Executable | Validates the MCPI command string parser. |
mcpi_api_server_tests | Executable | Tests TCP socket handling and server-client communication. |
Sources: CMakeLists.txt:15-50
Library Architecture
The following diagram illustrates the relationship between the core library and the resulting executables:
Class/Target relationship showing mcpi_core as the central dependency.
Sources: CMakeLists.txt:15-50, src/main.cpp:1-10
Configuration Options
Building can be customized using CMake definitions to include or exclude specific modules.
| Option | Default | Description |
|---|---|---|
MCPI_BUILD_TESTS | ON | Enables the compilation of the test suite and enable_testing() macro. |
Sources: CMakeLists.txt:10, CMakeLists.txt:40-42
Testing and Verification
Upon completion of the build, the ctest utility executes the test suite to ensure the reconstructed components meet the protocol requirements of Minecraft: Pi Edition.
Protocol Verification
The mcpi_protocol_tests target verifies that the command parser accurately interprets Minecraft Pi API strings, such as world.setBlock(1,2,3,1).
Sources: tests/protocol_tests.cpp:20-40
Integration Verification
The mcpi_api_server_tests target performs a loopback connection test to verify:
- Winsock/Socket Initialization: Proper setup on Windows and Linux.
- TCP Binding: Successful binding to port 4711 (or an available port if 0 is provided).
- Command Handling: The exchange of command strings and responses over the network.
Sources: tests/api_server_tests.cpp:110-125, src/api/ApiServer.cpp:215-240
Summary
Building from source provides the necessary environment to develop and verify the native port of Minecraft: Pi Edition. By utilizing CMake and C++20, the project ensures a portable foundation that supports the original game's network protocol while maintaining a clean separation from original proprietary assets.
Sources: README.md:14-26, README.md:46-52