Compile ZDoom on Windows: Difference between revisions
m →Compiling: The article is about compiling ZDoom. |
Graf accidentally reverted a change. |
||
| Line 5: | Line 5: | ||
* Use MinGW |
* Use MinGW |
||
Although Visual C++ 2008-2013 are supported for building, release versions of ZDoom are built with Visual C++ 2005. GZDoom releases are built with Visual C++ 2013. |
|||
''Note:'' if you have Visual C++ 2008, you can of course use it. However, this article keeps the 2005 version because the newer 2008 version requires users to register on Microsoft Live, and always produces executables that cannot be run on older versions of Windows. The steps for compiling with VC++ 2008 should be mostly the same as those listed for VC++ 2005. Versions after VC++ 2008 can cause conversion problems as well as the previously stated issues. It is recommended that Visual C++ 2005 is used over 2008, 2010, and Visual Studio 11. |
|||
If you only have Windows 98 or ME, then you ''must'' use MinGW. |
If you only have Windows 98 or ME, then you ''must'' use MinGW. |
||
{{clear}} |
{{clear}} |
||
= Required downloads for both Visual C++ and MinGW = |
== Required downloads for both Visual C++ and MinGW == |
||
{| align=right border=0 cellpadding=4 cellspacing=4 style="border: solid 1px #a3bfb1; background-color: #cef2e0; padding: 0.4em 1em; width: 50%; margin: 1em auto; text-align: center;" |
{| align=right border=0 cellpadding=4 cellspacing=4 style="border: solid 1px #a3bfb1; background-color: #cef2e0; padding: 0.4em 1em; width: 50%; margin: 1em auto; text-align: center;" |
||
|- |
|- |
||
| Line 18: | Line 16: | ||
|} |
|} |
||
* [http://nasm.sourceforge.net/ NASM] Version 2.0+ required |
* [http://nasm.sourceforge.net/ NASM] Version 2.0+ required |
||
** [http://yasm.tortall.net/ YASM] is required instead if building for Win64. |
|||
* FMOD Ex [http://www.fmod.org/download/fmodex/api/Win/fmodapi42631win32-installer.exe 32-bit] or [http://www.fmod.org/download/fmodex/api/Win/fmodapi42631win64-installer.exe 64-bit] |
* FMOD Ex [http://www.fmod.org/download/fmodex/api/Win/fmodapi42631win32-installer.exe 32-bit] or [http://www.fmod.org/download/fmodex/api/Win/fmodapi42631win64-installer.exe 64-bit] |
||
* The ZDoom source code, either from an <span class="plainlinks">[http://zdoom.org/download.html official release]</span> or from the [[Git repository]]. |
* The ZDoom source code, either from an <span class="plainlinks">[http://zdoom.org/download.html official release]</span> or from the [[Git repository]]. |
||
{{clear}} |
{{clear}} |
||
= Visual C++ 2005 = |
== Visual C++ 2005-2013 == |
||
The easiest way to compile ZDoom on Windows is to use CMake. This has the added advantage of working with newer versions of Visual C++. The instructions are the same for each, so to avoid redundancy this guide only provides instructions for the latest. |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | * [http://msdn.microsoft.com/en-us/windows/bb980924 Windows Platform SDK] -- The Express Edition of Visual C++ does not come with support for building native Windows applications out-of-the-box. As such, you must also download and install the [http://download.microsoft.com/download/2/3/f/23f86204-39ee-4cd7-9a51-db19c9a8f8c4/Setup.exe Platform SDK] before you can build ZDoom with it. |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | If the drop-down box under the label that says "Show Directories For" says "Executable Files", you have to set up NASM here (if not, select it now). Click the button that has a picture of a folder on it and select the new line it creates, and press the button that says "..." on it. In the Open Folder Dialog, select the directory where you unzipped NASM (such as, perhaps, C:\nasm-2.00), and another entry for the Subversion tools (in case you installed them). Make sure it points to the location of the executables (i.e. 'nasm.exe', 'svnversion.exe'), and not the root directory (unless the executables are there). |
||
| ⚫ | Then select drop-down box under the label that says "Show Directories For" and select "Include Files". Check to see that "$(DXSDK_DIR)Include" and "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\inc" are there. If they aren't, add them. Next, go to "Library Files" in the drop-down box and make two more new lines. Enter "$(DXSDK_DIR)Lib\x86" for one and "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\lib" for the other. |
||
| ⚫ | If you installed the FMOD SDK somewhere else, change "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32" for the include and library files lists to the appropriate directory. %DXSDK_DIR% is an environment variable that is created when you install the DirectX SDK that points to the directory where you installed it. By using this variable (you must type it in by hand; you cannot use the open folder dialog), you can easily upgrade your DirectX SDK at anytime without having to change these directories again. |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
= Visual Studio Express 2013 for Windows Desktop = |
|||
=== Required Downloads for Visual C++ 2013 === |
=== Required Downloads for Visual C++ 2013 === |
||
* [http://www. |
* [http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#d-community Visual Studio Express 2013 for Windows Desktop] (Community Edition will probably work as well.) |
||
* [http://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx Windows Software Development Kit (SDK) for Windows 8.1] |
* [http://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx Windows Software Development Kit (SDK) for Windows 8.1] |
||
* [http://www.microsoft.com/en-us/download/details.aspx?id=6812 DirectX Software Development Kit (June 2010)] |
* [http://www.microsoft.com/en-us/download/details.aspx?id=6812 DirectX Software Development Kit (June 2010)] |
||
| Line 71: | Line 38: | ||
1. Run cmake-gui.exe |
1. Run cmake-gui.exe |
||
* In "Where is the source code:" browse to the zdoom folder from above |
* In "Where is the source code:" browse to the zdoom folder from above |
||
* In "Where to build the binaries:" |
* In "Where to build the binaries:" create a build directory in the zdoom folder above |
||
* Click configure |
* Click configure |
||
* Select "Visual Studio 12" or "Visual Studio 12 Win64" |
* Select "Visual Studio 12" or "Visual Studio 12 Win64" based on the FMOD version you installed. |
||
* Click Finish |
* Click Finish |
||
2. After cmake configure finishes, it will likely fail because it couldn't find some things: |
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 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_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. |
* 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. |
||
| Line 87: | Line 54: | ||
DX_dxguid_LIBRARY C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/dxguid.lib |
DX_dxguid_LIBRARY C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/dxguid.lib |
||
4. Click 'Generate'. After this, cmake should have successfully created |
4. 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. |
||
5. Close cmake |
5. Close cmake |
||
6. Open 'zdoom.sln' file in the |
6. Open 'zdoom.sln' file in the build folder created earlier (double-clicking or within VS makes no difference) |
||
7. 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.) |
7. 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.) |
||
| Line 97: | Line 64: | ||
8. When the build successfully completes (there should be no failures): |
8. 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 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) |
||
9. 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. |
9. 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. |
||
== Visual C++ 2005 (Alternative) == |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | * [http://msdn.microsoft.com/en-us/windows/bb980924 Windows Platform SDK] -- The Express Edition of Visual C++ does not come with support for building native Windows applications out-of-the-box. As such, you must also download and install the [http://download.microsoft.com/download/2/3/f/23f86204-39ee-4cd7-9a51-db19c9a8f8c4/Setup.exe Platform SDK] before you can build ZDoom with it. |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
glew must be extracted to your general development folder where you placed the zdoom source folder. |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | If the drop-down box under the label that says "Show Directories For" says "Executable Files", you have to set up NASM here (if not, select it now). Click the button that has a picture of a folder on it and select the new line it creates, and press the button that says "..." on it. In the Open Folder Dialog, select the directory where you unzipped NASM (such as, perhaps, C:\nasm-2.00), and another entry for the Subversion tools (in case you installed them). Make sure it points to the location of the executables (i.e. 'nasm.exe', 'svnversion.exe'), and not the root directory (unless the executables are there). |
||
| ⚫ | Then select drop-down box under the label that says "Show Directories For" and select "Include Files". Check to see that "$(DXSDK_DIR)Include" and "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\inc" are there. If they aren't, add them. Next, go to "Library Files" in the drop-down box and make two more new lines. Enter "$(DXSDK_DIR)Lib\x86" for one and "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\lib" for the other. |
||
| ⚫ | If you installed the FMOD SDK somewhere else, change "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32" for the include and library files lists to the appropriate directory. %DXSDK_DIR% is an environment variable that is created when you install the DirectX SDK that points to the directory where you installed it. By using this variable (you must type it in by hand; you cannot use the open folder dialog), you can easily upgrade your DirectX SDK at anytime without having to change these directories again. |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
=== Downloads for MinGW === |
=== Downloads for MinGW === |
||
Revision as of 17:10, 2 December 2014
To build ZDoom on Windows, you have a few options:
- Use Visual C++ 2005 (Visual C++ General Information)
- Use Visual Studio Express 2013 for Windows Desktop
- Use MinGW
Although Visual C++ 2008-2013 are supported for building, release versions of ZDoom are built with Visual C++ 2005. GZDoom releases are built with Visual C++ 2013.
If you only have Windows 98 or ME, then you must use MinGW.
Required downloads for both Visual C++ and MinGW
| Note: To solve compilation problems of gl_clock.cpp with _interlockedbittestandset and _interlockedbittestandreset, see this thread. To compile GZDoom you must use CMake with a compatible compiler, it is recommended to use Visual C++ 2013, but older compilers will of course still work. The prebuilt VC++ 2005 solution is no longer provided for compiling GZDoom! |
- NASM Version 2.0+ required
- YASM is required instead if building for Win64.
- FMOD Ex 32-bit or 64-bit
- The ZDoom source code, either from an official release or from the Git repository.
Visual C++ 2005-2013
The easiest way to compile ZDoom on Windows is to use CMake. This has the added advantage of working with newer versions of Visual C++. The instructions are the same for each, so to avoid redundancy this guide only provides instructions for the latest.
Required Downloads for Visual C++ 2013
- Visual Studio Express 2013 for Windows Desktop (Community Edition will probably work as well.)
- Windows Software Development Kit (SDK) for Windows 8.1
- DirectX Software Development Kit (June 2010)
- CMake Version 2.8+ recommended
Download and install each of the above.
Compiling
Note: For compiling with VS 2013 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 12" -T "v120_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 12" or "Visual Studio 12 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. 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
4. 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.
5. Close cmake
6. Open 'zdoom.sln' file in the build folder created earlier (double-clicking or within VS makes no difference)
7. 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.)
8. 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)
9. 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.
Visual C++ 2005 (Alternative)
Compiling ZDoom on Windows is essentially easier than compiling it on Linux. All it takes is a few simple downloads and changing settings on Visual C++ 2005. Remember, this is directed to someone who never used Visual C++ 2005 before.
Downloads for Visual C++ 2005
First off, you must download some utilities to get started. These utilities are all free.
- Visual C++ 2005 Express Edition -- This is the ISO download for Visual C++ Express Edition, and offers many of the same features as the paid version.
- Windows Platform SDK -- The Express Edition of Visual C++ does not come with support for building native Windows applications out-of-the-box. As such, you must also download and install the Platform SDK before you can build ZDoom with it.
- DirectX SDK -- You will need the Feb 2010 Microsoft DirectX SDK package as well. Starting with the June 2010 package, DirectDraw is no longer supported, preventing compilation of ZDoom.
After the downloads
After you've downloaded everything, you must install all of them. You must remember the directories you've installed NASM and the Subversion tools into. CMake, DirectX and FMOD Ex install by default into the Program Files directory.
glew must be extracted to your general development folder where you placed the zdoom source folder.
Set up directories
When you're done installing, open Visual C++ 2005. (Start -> All Programs -> Visual C++ 2005 Express Edition -> Microsoft Visual C++ 2005 Express Edition)
When opened, go to Tools -> Options in the menu bar, you should get a dialog box that says "Options" in the title bar. Click the plus sign that's next to "Projects and Solutions" and click "VC++ Directories".
If the drop-down box under the label that says "Show Directories For" says "Executable Files", you have to set up NASM here (if not, select it now). Click the button that has a picture of a folder on it and select the new line it creates, and press the button that says "..." on it. In the Open Folder Dialog, select the directory where you unzipped NASM (such as, perhaps, C:\nasm-2.00), and another entry for the Subversion tools (in case you installed them). Make sure it points to the location of the executables (i.e. 'nasm.exe', 'svnversion.exe'), and not the root directory (unless the executables are there).
Then select drop-down box under the label that says "Show Directories For" and select "Include Files". Check to see that "$(DXSDK_DIR)Include" and "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\inc" are there. If they aren't, add them. Next, go to "Library Files" in the drop-down box and make two more new lines. Enter "$(DXSDK_DIR)Lib\x86" for one and "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\lib" for the other.
If you installed the FMOD SDK somewhere else, change "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32" for the include and library files lists to the appropriate directory. %DXSDK_DIR% is an environment variable that is created when you install the DirectX SDK that points to the directory where you installed it. By using this variable (you must type it in by hand; you cannot use the open folder dialog), you can easily upgrade your DirectX SDK at anytime without having to change these directories again.
Select "OK" on the dialog box, then try to compile ZDoom (Build -> Build Solution or F7). If successful, it should compile error-less.
Troubleshooting
Note: If it doesn't build correctly, try adding the Windows SDK library and include files to the directories as well.
Also, if your sound/music does not work, try putting fmodex.dll in your ZDoom directory
MinGW
Downloads for MinGW
- The MinGW installer
- TDM's updated build of MinGW with GCC
- The MSYS installer (optional for Windows 2000 or better)
- The GCC win32api files
- Minimal DirectX 8 headers from Allegro
- CMake
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
- 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.
- 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:
- 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_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 with MSYS
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
cd e:/zdoom/trunk/release
- Compile the code from inside the build directory.
make
- This will leave a zdoom.exe 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.
- 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.