Jump to navigation Jump to search
Update MSVC compilation instructions.
== Compiling ScummVM with Visual Studio under Windows ==
Compiling ScummVM under Windows with Visual Studio is not an awfully hard task, . It is however there are some things that don't just work out of slightly more complicated than using MinGW. We guide you through the box Support for MS steps to make ScummVM compile with Visual Studio 2005 (MSVC8) was removed on 2014-06-21. Use a newer version of Visual Studiothis page.
== Things needed ==
=== Visual Studio 2015 ===
There exists a free Community version of Visual Studio 2015 [ here] that can be used.
Professional Visual Studio 2015 versions are working fine too.
Visual Studio 2015 or 2013 is preferred for compiling ScummVM, but old We do support older versions of Visual Studio may work so long as you have them updated to their latest Service Pack revisionstoo. In factHowever, on this page we suggest making sure that you always have the latest Service Packs and patches applied for these tool sets. In some cases, fixes were put into the free-to-download "Processor Pack" add-focus on for Visual C++. So, download the latest Service Pack and the latest Processor Pack for whatever version of Visual C++ you are using to make sure you won't run into compiler bugs that prevent the compilation of building ScummVM.  The one exception is the later service packs for with Visual Studio 20132015. At least Service Pack 5, and maybe earlier packs will, if installed, cause Building ScummVM to give errors about duplicate 'snprintf' definitions. This is specially handled for with older Visual Studio 2015 with a special check in common/scummsys.h. If you're experiencing the problem in 2013, you versions can always manually comment out the method from scummsys.hrequire additional work not described on this page.
=== Needed Libraries ===
In order to compile ScummVM, you will need to install some relies on third -party libraries that it needsto implement certain functionality. To make things simpleSome of these libraries are required, we've created a zip containing all the necessary library fileslike for example SDL, includesothers are optional, DLLs, and executableslike for example libtheora. There are two versions available; download the correct one for the version We supply a set of MSVC you're using:* Download prebuilt libraries for Visual Studio [ 2015]* Download for Visual Studio [ have been build/ 2013] and earlier. === Installing Libraries &amp; Compiling ===Follow these steps to install the libraries on your system:* Unzip the library zip file you downloaded into a folder on your system where it can permanently stayWindows 8. For example, you could use "c:\Program Files (x86)\scummvm_libs".* Go to Control Panel | Environment Variables and set up a new variable "SCUMMVM_LIBS" with a value of the path you extracted the zip in* In 1 using the extracted folder's bin subfolder you'll find some DLL files. Copy all of them to Window's system folder, which is usually c:\windows\SysWow64* Checkout a copy of the ScummVM source if you haven't already done so* Under the ScummVM root folder, open the create_project Visual Studio 2015 project in devtools/create_project/msvc14 * Compile create_projectCommunity Edition. That should automatically copy the resulting create_project.exe to ScummVM's dists/msvc14 folder.* Run the dists/msvc14/create_msvc14.bat batch file to create the Visual Studio 2015 project for ScummVM. You The libraries can choose to either only include projects for Stable engines (which are officially supported), or all engines, which includes experimental and incomplete game engines.* Open up the created Visual Studio project for ScummVM in dists/msvc14, compile, and run ScummVM. That should be all that's required. The rest of this document has various instructions that may be helpful if you want to compile your own versions of the libraries, or if you really want to use an older version of Visual Studio. == Manually Installing Libraries ==If you feel like getting the various packages separately and compiling them yourself; following is some older instructions on getting the libraries individually: * Download found [http://www.nasmscummvm.usorg/ nasm] which is used for assembler versions of our scalers.* Download the [ some of precompiled libraries for 2013 and earlier].* Download the [ latest SDL runtime library] - latest version is 1.2.15 at the time this was written, you can find the latest version [ here].* Download the [ FreeType library]. You'll need the [ complete package] and the [ developer libraries]. You'll need to copy the .lib files to your Visual Studio vc/lib folder, and the freetype6.dll and zlib1.dll files from the Freetype bin folder (default c:\Program Files (x86)\GnuWin32\bin) to your Windows folder.* Download the [ libjpeg-turbo library] and copy the library files to your Visual Studio VC/lib folder,* Unzip the precompiled libraries archive maintaining directory structure* Run install.bat (Visual Studio 2008 only) or [[Compiling_ScummVM/Visual_Studio#Adding_all_libraries_to_Visual_Studio_2010|add the libraries by hand]] (Visual Studio 2010)* You don't need to add the libraries to Visual Studio, as the installer automatically copies the necessary files in the appropriate directories of Visual Studio. Please note that this installer has only been tested with Visual Studio 2005 and 2008. If you get errors with earlier versions of Visual Studio, simply copy the directories ''bin'', ''lib'' and ''include'' inside the directory where Visual C++ is installed. If you're not sure how to do that, check the section "[[Compiling_ScummVM/Visual_Studio#Adding_all_libraries_to_Visual_Studio_2008|Adding all libraries to Visual Studio 2008]]" further on* Unzip sdl.dll from the SDL runtime in the same directory where the scummvm executable will be created (under dists\<msvc_dir>\scummvm_Release) where <msvc_dir> is:** msvc9 for Visual Studio 2008** msvc10 for Visual Studio 2010** msvc11 for Visual Studio 2012** msvc12 for Visual Studio 2013* Skip to step "[[Compiling_ScummVM/Visual_Studio#Ready to compile ScummVM|Ready to compile ScummVM]]" === Building the libraries yourself ===Refer to the [[Compiling_ScummVM/Visual_Studio/Compiling_Libraries|instructions for compiling the libraries yourself]]  == Adding all libraries to Visual Studio 2010 and newer== The way libraries are added has been changed in Visual Studio 2010, compared to earlier versions. Copy all of the precompiled libraries in a separate folder (e.g. c:\scummvm_libs). Then, there are two different ways of adding this directory to Visual Studio:* Right click My Computer->Properties->Advanced (Win 2000/XP) or Advanced System Settings->Advanced (Vista/Win 7/Win 8)->Environment Variables->New (System Variable), with a variable name of "SCUMMVM_LIBS" and a value of the folder where you unpacked your precompiled libraries (e.g. "C:\scummvm_vs_libs"). You need to restart Visual Studio, if it's already running, for the change to take effect.* If the above method doesn't work, open the ScummVM solution in Visual Studio, and go to View->Property Manager or View->Other Views->Property Manager (depending on your layout configuration). From there, open the ScummVM project, and go to the configuration you want to build (e.g. Debug|Win32) and click on "Microsoft.Cpp.Win32.user". From there, go to "VC++ directories" and add the 3 library directories in the appropriate places, i.e.:  Executable Directories: add "C:\scummvm_vs_libs\bin;" at the beginning Include Directories: add "C:\scummvm_vs_libs\include;" at the beginning Library Directories: add "C:\scummvm_vs_libs\lib\x86" (or x64, if you're building a 64-bit version) at the beginning If if still fails to build, saying it can't find a lib file, go to the project properties of the ScummVM project, Configuration Properties->Linker->General->Additional Library Directories and add your lib folder in there  == Adding all libraries to Visual Studio 2008 == There are two ways of adding the libraries to Visual Studio. You can either copy all the header and library files inside the appropriate directories of Visual C++ or tell Visual C++ where to look for them.<br><br> === First method: Copy the files inside VC++'s folders ===The '''first method''' of adding the required libraries is to go to each individual compiled library and copy the header and library files.  You'll need the following:<br><br>'''Libraries'''<br> '''libFLAC_static.lib''' - static build of libFLAC (from folder obj\release\lib where you unzipped libFLAC) '''libmad.lib''' - static build of libMAD (from folder msvc++\Release where you unzipped libmad) '''libmpeg2.lib''' - static build of libMPEG2 (from folder vc++\Release where you unzipped mpeg2dec) '''libpng.lib''' - static build of libpng (from folder projects\visualc71\Win32_LIB_Release where you unzipped libpng) '''ogg_static.lib''' - static build of libOGG (from folder win32\Static_Release where you unzipped libogg) '''sdl.lib''' - static build of SDL (from folder lib where you unzipped SDL) '''vorbisfile_static.lib''' - static build of vorbisfile (from folder win32\VorbisFile_Static_Release where you unzipped libvorbis) '''vorbis_static.lib''' - static build of libvorbis (from folder win32\Vorbis_Static_Release where you unzipped libvorbis) '''vorbisenc_static.lib''' - static build of libvorbis (from folder win32\Vorbisenc_Static_Release where you unzipped libvorbis) '''zlib.lib''' - static build of zlib (from folder projects\visualc6\Win32_LIB_Release where you unzipped zlib) Copy those inside VC's lib folder (e.g. C:\Program Files\Microsoft Visual Studio 8\VC\lib)<br><br>'''Header files'''<br> [TODO] Copy those inside VC's include folder (e.g. C:\Program Files\Microsoft Visual Studio 8\VC\include)<br><br>'''Executable files'''<br> '''nasmw.exe''' - from the NASM zip Copy this as nasmw.exe AND as nasm.exe inside VC's bin folder (e.g. C:\Program Files\Microsoft Visual Studio 8\VC\bin)<br><br> === Second method: Tell VC++ where to look ===The '''second method''' is to tell VC++ where to look for the required libraries and header files Go to Tools->Options->Projects and solutions->VC++ directories.  In the executable files section, make sure that the path to nasm is included and that nasmw.exe in that folder has been copied to nasm.exe. Failure to do that will give you an error in VS (a custom building step has returned an error)  In the include files section, make sure that the include folders for libogg, libvorbis, libmad, zlib, mpeg2dec and SDL are in the list. If you need FLAC, include the FLAC include folder in the list too  In the library files section, make sure that the static libraries for vorbis, vorbisfile, libogg, zlib, mpeg2dec, libmad and SDL are included. If you're building 0.8.0 final or earlier, include the release folder of zlibdll too (in the zlib source folder, contrib\vstudio\vc8\x86\zlibdllrelease). If you need FLAC, include the FLAC libraries folder too  Finally, if you need to compile ScummVM with FLAC support, go to Configuration Properties->C/C++->Preprocessor and add "USE_FLAC" in the Preprocessor Definitions field. Also, go to linker->input and add "libflac_static.lib" in the Additional Dependencies field.
=== Installing Libraries ===
The easiest way to make Visual Studio find the supplied libraries is by using the environment variable "SCUMMVM_LIBS". We describe this method now.
To make it work you have to follow these steps:
* Unzip the library zip to a directory of your choice. For example, you can unzip them into "C:\Users\YourUsername\Documents\scummvm_libs_2015".
* Go to Control Panel -> Environment Variables and set up a new variable "SCUMMVM_LIBS" with a value of the path you extracted the zip in. It is important that you do point the variable to the folder containing the "bin", "include", and "lib" directories.
== Enabling the console = Manually Building Libraries ===If you want to build libraries for use with Visual Studio yourself, please refer to the [[Compiling_ScummVM/Visual_Studio/Compiling_Libraries|instructions for compiling the libraries yourself]].
Since information on doing this is not that easy to find, here's how to enable == Preparing the console in the resulting ScummVM executable.The default project subsystem is "Windows" instead of "Console", which means that the console will not be shown. Project Files ==
To show the console, right-click on the "scummvm" project and go to Properties. There, go to Configuration Properties->Linker->System and change the "Subsystem" property from "Windows (/SUBSYSTEM:WINDOWS)" to "'''Console (/SUBSYSTEM:CONSOLE)'''". Then, go to Linker->Advanced and set the entry point to be "'''WinMainCRTStartup'''" (special thanks to [[User:Jubanka|Jubanka/knakos]] for his tip on entrypoint).=== Building create_project ===
== Creating the ScummVM uses a configure/Make based build system. We feature a tool to generate Visual Studio project files ==from this build system. The first steep you need to take is building this tool called "create_project".
First, open relevant the solution file in "devtools/\create_project/msvc<your-version>, and \msvc14\create_project.sln". Then simply build the solution. The project file should automatically assure that the resulting "create_project.exe file" is copied to "dists\msvc14". If not, you will have to copy it yourself.
Then put === Generating the resulting create_project.exe file in dists/msvc<your-version> and run create_msvc<your-version>.bat in that directory.Project Files ===
The program Simply run the batch script "dists/msvc14/create_msvc14.bat". It will generate whole solution projects for building guide you through configuring ScummVM.
== Ready '''IMPORTANT''': You will have to compile re-generate the project files whenever new source files have been added to or removed from the configure/Make based build system. When you add new files to ScummVM, you will ''have'' to add them to the respective "" file to assure ScummVM ==still builds fine with the configure/Make based build system.
If you got all the libraries compiled, you're ready to compile the latest version of == Compiling ScummVM!==
Open If you followed all the solution file in dists\msvcXXsteps, select the "Release" configuration from the configuration manager pulldown menu and then go to Build->Build solution, or just press Control-F7 you are now ready to compile itScummVM with Visual Studio.Congratulations!
The ScummVM executable should be Simply open the generated solution file in the folder "dists\msvcXXmsvc14\scummvm_Release as "scummvm.exesln". Now you can ask it to build the desired configuration. By default it will build a debug configuration which is ideal to hack on ScummVM.
'''IMPORTANT''': You'll need to copy sdlthe matching SDL.dll from file to a location Windows picks up to run the resulting binary. The easiest way to do this is to place the SDL runtime archive (or the latest devel archive) .dll file in the directory where scummvm.exe is. There are multiple SDL.dll files to choose from, depending on your build configuration. Simply pick the right one from the prebuilt libraries. For example, if you build a Win32 Debug configuration, you will need to use "libs/x86/Debug/SDL.dll".


Navigation menu