Compilation on Windows (MSYS2 MinGW) - OpenFusionProject/OpenFusion Wiki
The basic thing
OpenFusion includes a Makefile for easy compilation. On most Linux distributions and other Unix/Unix-like operating systems, the system will either include the
make command or make it easy to install build tools which include the
make command. As Windows doesn't come with these tools, we'll be using MSYS2 to build.
Here's what you should do if you don't know how to get everything working yourself. Please make sure you read the entire guide.
- Grab the latest version of MSYS2 available on the MSYS2 website. The installation will take a while - just let it do its work.
- Open up a MSYS2 shell using the "MSYS2 MinGW 64-bit" shortcut.
- Update MSYS2 using the command
pacman -Syu. Type
yand press enter to confirm the installation. It'll probably ask you to close the shell. If your shell closes, reopen it using the same shortcut.
- Now that your install of MSYS2 is up to date, you can install
mingw-w64and its distribution of GCC. Run the command
pacman -S base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-sqlite3. The defaults are somewhat heavy, but the safest bet. Press enter to accept the all of the packages
pacmanhas found. After that, you'll be asked to confirm the installation. Again, type
yand press enter. The installation will take a while.
cdto your OpenFusion source folder. Note: To access your Windows drive,
/(drive letter name). For example, my drive is at
C:\and the source files are on my desktop, so I'll do
cd /c/Users/Raymonf/Desktop/OpenFusion. Notice that the paths follow Unix naming conventions, so a forward slash is used instead of a backwards slash.
- Create a folder called
binfor your binaries: the command
mkdir binshould do. If you miss this step, you'll have a linker error.
- Run the command
make windowsto build the
- If there are no errors (warnings are fine), your compiled binary should be in the
binfolder you made.
Doing Git the right way
As OpenFusion is hosted on Github, it uses Git as its version control system. The above guide somewhat assumes that you have already cloned the Git repository using the
git clone command, or have downloaded an archive (zip file) of the source.
If you used
git clone, the following guide is not for you. You're all set to go in that case. Otherwise, we might as well install
git within MSYS2.
You can use Git for Windows if you'd like. Simply skip to step 3 on a "Git Bash" shell.
- In your MSYS2 shell, run
pacman -S git. It'll ask you to confirm the installation by typing
yand hitting enter.
- After Git is done installing, you should be able to run the command
gitand have it give you a long list of commands you can run. Confirm that it works.
cdto the folder you want to clone the project to. Git will clone the repository to a new folder, so just
cdto where you want that folder to be made. For example, if I'm at my desktop, a new folder called
OpenFusionwill be created with the source files in it.
- Clone the repository. Use the command
git clone --recurse-submodules https://github.com/OpenFusionProject/OpenFusion.gitto clone the upstream OpenFusion repository - or, if you have a personal fork, you can clone that using the full URL.
At this point, you should have a properly initialized Git repository. You can run
git pull to grab any of the latest changes and then compile the latest changes using
make windows at any time.
Protocol Version Selection
OpenFusion supports multiple packet versions (
20111013 at the time of writing). To build with these versions, you can define
PROTOCOL_VERSION. For example:
make windows PROTOCOL_VERSION=728
Notice that the protocol versions are month and day, without the leading zero. Therefore,
20100104 would be