Open main menu

Difference between revisions of "Compiling ScummVM/Visual Studio"

Use <code> for better legibility
(→‎Visual Studio: No need to mention pre-2008 MSVC since the project moved to C++11; it also appears that MSVC 2015 is our current minimum (from recent Discord talks from sluicebox))
(Use <code> for better legibility)
Line 21: Line 21:


=== Installing Libraries ===
=== Installing Libraries ===
The easiest way to make Visual Studio find the supplied libraries is by using the environment variable "SCUMMVM_LIBS". You can set it by performing the following steps:
The easiest way to make Visual Studio find the supplied libraries is by using the environment variable <code>SCUMMVM_LIBS</code>. You can set it by performing the following steps:
* Unzip the library zip to a directory of your choice, for example "C:\Users\YourUsername\Documents\scummvm_libs_2015".
* Unzip the library zip to a directory of your choice, for example <code>C:\Users\YourUsername\Documents\scummvm_libs_2015</code>.
* Go to Start Menu > Control Panel > System > Advanced Settings > Environment Variables and add 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.
* Go to Start Menu > Control Panel > System > Advanced Settings > Environment Variables and add a new variable <code>SCUMMVM_LIBS</code> 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 <code>bin\</code>, <code>include\</code>, and <code>lib\</code> directories.


== Preparing the Project Files ==
== Preparing the Project Files ==
Line 31: Line 31:
ScummVM uses a configure/Make based build system. We have a tool to generate Visual Studio project files from this build system. The first step you need to take is building this tool called "create_project".
ScummVM uses a configure/Make based build system. We have a tool to generate Visual Studio project files from this build system. The first step you need to take is building this tool called "create_project".


First, open the solution file "devtools\create_project\msvc\create_project.sln". Then simply build the solution. The project file should automatically assure that the resulting "create_project.exe" is copied to "dists\msvc".
First, open the solution file <code>devtools\create_project\msvc\create_project.sln</code>. Then simply build the solution. The project file should automatically assure that the resulting <code>create_project.exe</code> is copied to <code>dists\msvc\</code>.


=== Generating the Project Files ===
=== Generating the Project Files ===


Simply run the batch script "dists/msvc/create_msvc.bat". It will guide you through configuring ScummVM.
Simply run the batch script <code>dists/msvc/create_msvc.bat</code>. It will guide you through configuring ScummVM.


'''IMPORTANT''': You will have to 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 "module.mk" file to assure ScummVM still builds fine with the configure/Make based build system.
'''IMPORTANT''': You will have to 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 <code>module.mk</code> file to assure ScummVM still builds fine with the configure/Make based build system.


== Compiling ScummVM ==
== Compiling ScummVM ==
Line 43: Line 43:
If you followed all the steps, you are now ready to compile ScummVM with Visual Studio. Congratulations!
If you followed all the steps, you are now ready to compile ScummVM with Visual Studio. Congratulations!


Simply open the generated solution file in "dists\msvc\scummvm.sln". 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.
Simply open the generated solution file in <code>dists\msvc\scummvm.sln</code>. 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''': If you get errors about missing DLLs, you'll need to copy them to a location Windows picks up to run the resulting binary. The easiest way to do this is to place the DLL files in the directory where scummvm.exe is. There are multiple folders to choose from, depending on your build configuration. For example, if you build a Win32 Debug configuration, you will need to copy them from "SCUMMVM_LIBS\lib\x86\Debug" to "dists\msvc\Debugx86".
'''IMPORTANT''': If you get errors about missing DLLs, you'll need to copy them to a location Windows picks up to run the resulting binary. The easiest way to do this is to place the DLL files in the directory where <code>scummvm.exe</code> is. There are multiple folders to choose from, depending on your build configuration. For example, if you build a Win32 Debug configuration, you will need to copy them from <code>SCUMMVM_LIBS\lib\x86\Debug\</code> to <code>dists\msvc\Debugx86\</code>.


NOTE: Several people have had errors about structure packing under Visual Studio 2019. In such cases, you need to update [https://github.com/libsdl-org/SDL/releases SDL2] with the latest version.
NOTE: Several people have had errors about structure packing under Visual Studio 2019. In such cases, you need to update [https://github.com/libsdl-org/SDL/releases SDL2] with the latest version.
Line 53: Line 53:
By default ScummVM is compiled as a Windows subsystem application with no console output. If you need the console, you can do one of the following:
By default ScummVM is compiled as a Windows subsystem application with no console output. If you need the console, you can do one of the following:
* In the create_project command, add <code>--enable-text-console</code>.
* In the create_project command, add <code>--enable-text-console</code>.
* In the Project Options for the ScummVM project, go to the Linker | System | SubSystem line, and change the /SUBSYSTEM:WINDOWS to /SUBSYSTEM:CONSOLE
* In the Project Options for the ScummVM project, go to the Linker | System | SubSystem line, and change the <code>/SUBSYSTEM:WINDOWS</code> option to <code>/SUBSYSTEM:CONSOLE</code>
186

edits