Compile ZDoom on Windows: Difference between revisions
→MinGW: Unless its just my system being polluted with compilers, mingw-w64 pretty much just works. Source modifications are needed though so not removing the warning yet. Removed MSYS instructions since that path is very much untested. |
|||
| Line 110: | Line 110: | ||
=== Downloads for MinGW === |
=== Downloads for MinGW === |
||
* [http:// |
* [http://tdm-gcc.tdragon.net/ TDM-GCC] (Use [http://mingw-w64.org/doku.php mingw-w64] when prompted by the installer.) |
||
* [http://www.tdragon.net/recentgcc/ TDM's updated build of MinGW with GCC] |
|||
* [http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=24963 The MSYS installer] (optional for Windows 2000 or better) |
|||
* [http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=11550 The GCC win32api files] |
|||
| ⚫ | |||
| ⚫ | It is possible to build using vanilla MinGW, however it requires extensive hand modification to the header files as well as the [https://web.archive.org/web/20150616002909/http://alleg.sourceforge.net/files/dx80_mgw.zip Minimal DirectX 8 headers] from [https://web.archive.org/web/20150812045125/http://alleg.sourceforge.net/wip.html Allegro]. This is route one would need to take if a build targeting pre-XP is desired. |
||
=== Installing everything === |
|||
* Run the MinGW installer. When it asks which MinGW package you wish to install, you can choose either "Current" or "Candidate". "Candidate" is recommended because it is newer. When you need to choose the components, you must install at least the "MinGW base tools" and "g++ compiler." If you are not using MSYS, then you must also install "MinGW Make." Then unpack the 4.3.0 alpha binaries on top of your MinGW directory. |
|||
* If you downloaded the MSYS installer, run it now. |
|||
* Unpack the win32api files on top of your MinGW directory. If you didn't change it when you installed, this will be c:\mingw. The win32api headers are missing some definitions that ZDoom needs. Open mingw\include\commctrl.h and search for PBS_VERTICAL. Add these lines just underneath its definition: |
|||
#if (_WIN32_WINNT >= 0x0501) |
|||
#define PBS_MARQUEE 0x08 |
|||
#define PBM_SETMARQUEE (WM_USER+10) |
|||
#endif |
|||
* Unzip the DirectX 8 headers on top of your MinGW directory as well. |
|||
* You can unzip NASM anywhere you want. To keep everything in one place, a good place to put nasmw.exe and ndisasmw.exe is inside your MinGW directory at c:\mingw\bin. |
|||
=== Preparing for compiling === |
=== Preparing for compiling === |
||
| Line 135: | Line 121: | ||
** In the box labeled "Where to build the binaries:" create a subdirectory in the path to the source code to contain the build files (e.g. E:/zdoom/trunk/release). |
** In the box labeled "Where to build the binaries:" create a subdirectory in the path to the source code to contain the build files (e.g. E:/zdoom/trunk/release). |
||
** Click the Configure button at the bottom of the window. If the build directory does not exist, it will ask to create it. Let it. |
** Click the Configure button at the bottom of the window. If the build directory does not exist, it will ask to create it. Let it. |
||
** Select MinGW Makefiles as the project generator. |
|||
** You will be asked which generator to use. If you are using Windows 9x, then you ''must'' select MSYS Makefiles. If are are using Windows 2000 or later, then you may select either MSYS Makefiles or MinGW Makefiles. Make sure Use default native compilers is selected and click Finish. |
|||
** Check the configuration options to make sure they are to your liking. In particular, pay attention to: |
** Check the configuration options to make sure they are to your liking. In particular, pay attention to: |
||
*** CMAKE_BUILD_TYPE: This defaults to Debug. You probably want to change it to Release. |
*** CMAKE_BUILD_TYPE: This defaults to Debug. You probably want to change it to Release. |
||
*** DYN_FLUIDSYNTH: If you want support for fluidsynth.dll, check this. |
|||
*** FMOD_INCLUDE_DIR: Make sure this points to *Where you installed FMOD*/api/inc |
*** FMOD_INCLUDE_DIR: Make sure this points to *Where you installed FMOD*/api/inc |
||
*** FMOD_LIBRARY: Make sure this points to *Where you installed FMOD*/api/lib/libfmodex.a |
*** FMOD_LIBRARY: Make sure this points to *Where you installed FMOD*/api/lib/libfmodex.a |
||
| Line 144: | Line 129: | ||
** Now press Generate. This will create a Makefile in the build directory. |
** Now press Generate. This will create a Makefile in the build directory. |
||
=== Compiling |
=== Compiling === |
||
If you selected MSYS Makefiles as the generator above, then you must compile using MSYS. |
|||
* Run MSYS. The installer should have created a start menu shortcut for you. |
|||
* Change to the directory you chose as the build directory. e.g. For the example above <pre>cd e:/zdoom/trunk/release</pre> |
|||
* Compile the code from inside the build directory. <pre>make</pre> |
|||
* This will leave a <tt>zdoom.exe</tt> in the build directory. |
|||
=== Compiling without MSYS === |
|||
If you selected MinGW Makefiles as the generator above, the process for compiling is as essentially the same as for MSYS Makefiles, except that you use a regular command prompt window instead of MSYS. |
|||
* Open a Command Prompt window. You can either use Start -> Run... and type "cmd" or you can find it in Start -> All Programs -> Accessories -> Command Prompt. |
* Open a Command Prompt window. You can either use Start -> Run... and type "cmd" or you can find it in Start -> All Programs -> Accessories -> Command Prompt. |
||
Revision as of 06:02, 28 February 2016
To build ZDoom on Windows, you have a few options:
- Use Visual Studio Community 2015
- Use MinGW
Required downloads for both Visual C++ and MinGW
- NASM Version 2.0+ required
- YASM is required instead if building for Win64.
- CMake Version 2.8.7 or later
- FMOD Ex
- The ZDoom source code, either from an official release or from the Git repository.
Optional downloads for both Visual C++ and MinGW
Currently OpenAL is only supported when building with CMake. You only need these if you want to build ZDoom with OpenAL support. If you just want to use FMod Ex, downloading these is not necessary. In this case you can just check 'NO_OPENAL' in CMake and ignore these dependencies and the instructions to set them up.
Visual C++
The easiest way to compile ZDoom on Windows is to use CMake to generate Visual Studio projects.
| Note: Visual Studio 2015 is only required for the development versions of ZDoom. The 2.8.x stable release and maint branch can be compiled with 2005-2013. |
Required Downloads for Visual C++ 2015
- Visual Studio Community 2015
- Windows Software Development Kit (SDK) for Windows 8.1
- DirectX Software Development Kit (February 2010)
Download and install each of the above. For Visual Studio make sure that you install the Visual C++ component as it is not installed by default.
Preparing library
Note: You only need to do this step if you want to build with OpenAL support!
libmpg123 doesn't come with a library file, so you will need to build one.
1. Open the developer command prompt
- Open the start menu and browse to the "Visual Studio" folder.
- Open the "Visual Studio Tools" folder.
- Run the "Visual Studio command prompt" or "developer command prompt" depending on your Visual Studio installation.
2. Browse to libmpg123 directory
- Manually type the directory where you installed mpg123 into the command prompt. For example:
cd C:\Program Files (x86)\mpg123
3. Rename export definition file
- Due to an error in one of the file names included with mpg123, ZDoom will fail to load on startup. To fix this, rename libmpg123-0.dll.def to libmpg123-0.def
- You can do this in the command prompt or in windows explorer. For the former:
rename libmpg123-0.dll.def libmpg123-0.def
4. Build library
- 32-bit
lib /DEF:libmpg123-0.def /OUT:libmpg123-0.lib
- 64-bit
lib /MACHINE:X64 /DEF:libmpg123-0.def /OUT:libmpg123-0.lib
If done correctly, libmpg123-0.lib and libmpg123-0.exp should have been created in the directory.
Compiling
Note: For compiling with VS 2015 builds compatible with Windows XP, you need to run the following command line first (or after deleting the CMake cache), replacing <path> as appropriate:
cmake <path> -G "Visual Studio 14 2015" -T "v140_xp" |
1. Run cmake-gui.exe
- In "Where is the source code:" browse to the zdoom folder from above
- In "Where to build the binaries:" create a build directory in the zdoom folder above
- Click configure
- Select "Visual Studio 14 2015" or "Visual Studio 14 2015 Win64" based on the FMOD version you installed.
- Click Finish
2. After cmake configure finishes, it will likely fail because it couldn't find some things:
- set NASM_PATH browsing to folder where you installed nasm earlier and select 'nasm.exe' (e.g. C:\Program Files (x86)\nasm\nasm.exe)
- set FMOD_INCLUDE_DIR to 'api/inc' folder inside folder where you installed fmod earlier (e.g. C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\inc)
- set FMOD_LIBRARY to 'api/lib/fmodex_vc.lib' inside fmod folder (e.g. C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\lib\fmodex_vc.lib). If you are compiling for 64-bit systems set FMOD_LIBRARY to fmodex64_vc.lib instead.
3. Add the OpenAL requirements. The following is an example:
OPENAL_INCLUDE_DIR C:/Program Files (x86)/OpenAL 1.1 SDK/include OPENAL_LIBRARY C:/Program Files (x86)/OpenAL 1.1 SDK/libs/Win64/OpenAL32.lib SNDFILE_INCLUDE_DIR C:/Program Files/Mega-Nerd/libsndfile/include SNDFILE_LIBRARY C:/Program Files/Mega-Nerd/libsndfile/lib/libsndfile-1.lib MPG123_INCLUDE_DIR C:/Program Files (x86)/mpg123 MPG123_LIBRARIES C:/Program Files (x86)/mpg123/libmpg123-0.lib
Be sure to use the right library from the OpenAL SDK.
4. Click 'Configure'
- If this fails with the message 'Could not find DirectX 9 libraries', you likely have an older DirectX SDK or installed the SDK into a non-standard location. To workaround this, you'll likely have to set the following cmake variables manually in the cmake GUI dialog (following is only an example):
D3D_INCLUDE_DIR C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include DX_dinput8_LIBRARY C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/dinput8.lib DX_dxguid_LIBRARY C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/dxguid.lib
5. Click 'Generate'. After this, cmake should have successfully created 'zdoom.sln', and 'ALL_BUILD.vcxproj.user' files in the directory given for "Where to build the binaries:" (look at timestamp on the files as a sanity check). If not, something's gone wrong.
6. Close cmake
7. Open 'zdoom.sln' file in the build folder created earlier (double-clicking or within VS makes no difference)
8. Click Build -> Build Solution (NOTE: The build will fail if you have the Debug or Release folder inside the zdoom folder open due to one of the post-build steps.)
9. When the build successfully completes (there should be no failures):
- copy the 'fmodex.dll' or 'fmodex64.dll' to the zdoom/Debug folder (e.g. cp C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\fmodex.dll C:\Users\Shawn\Devel\zdoom\Debug)
- copy 'libmpg123-0.dll' to zdoom/Debug folder.
- copy 'libsndfile-1.dll' to zdoom/Debug folder.
10. Now zdoom.exe can be opened from the zdoom/Debug folder, or from within Visual Studio using Debug -> Start Debugging (F5) when the solution is selected. Assuming it found your copy of installed Doom (which if you've installed The Ultimate Doom from Steam, it will automatically), the game should launch after a few moments and go to the main menu.
MinGW
| Warning: The following information is severely outdated and will probably no longer work! Help in updating this section would be appreciated. |
Downloads for MinGW
It is possible to build using vanilla MinGW, however it requires extensive hand modification to the header files as well as the Minimal DirectX 8 headers from Allegro. This is route one would need to take if a build targeting pre-XP is desired.
Preparing for compiling
- Unpack the ZDoom source code wherever you like.
- Run cmake-gui. You can find it in the start menu after installing CMake.
- In the box labeled "Where is the source code:" point it to the directory where you put the source code. (e.g. E:/zdoom/trunk)
- In the box labeled "Where to build the binaries:" create a subdirectory in the path to the source code to contain the build files (e.g. E:/zdoom/trunk/release).
- Click the Configure button at the bottom of the window. If the build directory does not exist, it will ask to create it. Let it.
- Select MinGW Makefiles as the project generator.
- Check the configuration options to make sure they are to your liking. In particular, pay attention to:
- CMAKE_BUILD_TYPE: This defaults to Debug. You probably want to change it to Release.
- FMOD_INCLUDE_DIR: Make sure this points to *Where you installed FMOD*/api/inc
- FMOD_LIBRARY: Make sure this points to *Where you installed FMOD*/api/lib/libfmodex.a
- If you made any changes, press Configure again.
- Now press Generate. This will create a Makefile in the build directory.
Compiling
- Open a Command Prompt window. You can either use Start -> Run... and type "cmd" or you can find it in Start -> All Programs -> Accessories -> Command Prompt.
- C:\mingw\bin should be in your path. To set this for just the current command prompt, use the command
set PATH=c:\mingw\bin;%PATH%
To make this automatic for all command prompts, you need to edit the Environment Variables on the Advanced tab of the System Properties control panel. - Change to the directory you chose as the build directory. e.g. For the example above
cd e:\zdoom\trunk\release
- Compile the code from inside the build directory
mingw32-make
You can also use a multithreaded make to speed up compilation:mingw32-make -j2
Just replace the 2 with however many threads you want to use. - This will leave a zdoom.exe in the build directory.
