Difference between revisions of "Compiling ScummVM/Visual Studio"

From ScummVM :: Wiki
Jump to navigation Jump to search
(Update MSVC compilation instructions.)
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:
  
 
== Things needed ==
 
== Things needed ==
 +
Visual Studio 2008-2019
  
 
=== Visual Studio ===
 
=== Visual Studio ===
There exists a free Community version of Visual Studio 2015 [https://www.visualstudio.com/en-US/products/visual-studio-express-vs here] that can be used.
+
There exists a free Community version of Visual Studio [https://visualstudio.microsoft.com/ here] that can be used.
Professional Visual Studio 2015 versions are working fine too.
+
Professional Visual Studioversions are working fine too.
  
We do support older versions of Visual Studio too. However, on this page we focus on building ScummVM with Visual Studio 2015. Building ScummVM with older Visual Studio versions can require additional work not described on this page.
+
We do support older versions of Visual Studio too. However, on this page we focus on building ScummVM with Visual Studio. Building ScummVM with older Visual Studio 2008 can require additional work not described on this page.
  
 
=== Needed Libraries ===
 
=== Needed Libraries ===
Line 27: Line 28:
 
=== Building create_project ===
 
=== Building create_project ===
  
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".
+
ScummVM uses a configure/Make based build system. We have 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 the solution file "devtools\create_project\msvc14\create_project.sln". Then simply build the solution. The project file should automatically assure that the resulting "create_project.exe" is copied to "dists\msvc14". If not, you will have to copy it yourself.
+
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". If not, you will have to copy it yourself.
  
 
=== Generating the Project Files ===
 
=== Generating the Project Files ===
  
Simply run the batch script "dists/msvc14/create_msvc14.bat". It will guide you through configuring ScummVM.
+
Simply run the batch script "dists/msvc/create_msvc.bat". 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 "module.mk" file to assure ScummVM still builds fine with the configure/Make based build system.
Line 41: Line 42:
 
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\msvc14\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 "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.
  
 
'''IMPORTANT''': You'll need to copy the matching SDL.dll file to a location Windows picks up to run the resulting binary. The easiest way to do this is to place the SDL.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".
 
'''IMPORTANT''': You'll need to copy the matching SDL.dll file to a location Windows picks up to run the resulting binary. The easiest way to do this is to place the SDL.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".
 +
 +
== Compiling without Console/Status Window ==
 +
 +
If you want to run ScummVM without the console Window being present by default, there are two things you need to do:
 +
* In the Project Options for the scummvm project, go to the Linker | System | SubSystem line, and change the /SUBSYSTEM:CONSOLE to /SUBSYSTEM:WINDOWS
 +
* In the file backends/platform/sdl/win32/win32.cpp, change the parameter from true to false in the first line of OSystem_Win32::initBackend:
 +
ConfMan.registerDefault("console", false);

Latest revision as of 11:51, 20 April 2019

Compiling ScummVM with Visual Studio under Windows

Compiling ScummVM with Visual Studio is not an awfully hard task. It is however slightly more complicated than using MinGW. We guide you through the steps to make ScummVM compile with Visual Studio on this page.

Things needed

Visual Studio 2008-2019

Visual Studio

There exists a free Community version of Visual Studio here that can be used. Professional Visual Studioversions are working fine too.

We do support older versions of Visual Studio too. However, on this page we focus on building ScummVM with Visual Studio. Building ScummVM with older Visual Studio 2008 can require additional work not described on this page.

Needed Libraries

ScummVM relies on third-party libraries to implement certain functionality. Some of these libraries are required, like for example SDL, others are optional, like for example libtheora. We supply a set of prebuilt libraries for Visual Studio 2015. These have been build on Windows 8.1 using the Visual Studio 2015 Community Edition. The libraries can be found here.

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.

Manually Building Libraries

If you want to build libraries for use with Visual Studio yourself, please refer to the instructions for compiling the libraries yourself.

Preparing the Project Files

Building 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 steep 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". If not, you will have to copy it yourself.

Generating the Project Files

Simply run the batch script "dists/msvc/create_msvc.bat". 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.

Compiling ScummVM

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.

IMPORTANT: You'll need to copy the matching SDL.dll file to a location Windows picks up to run the resulting binary. The easiest way to do this is to place the SDL.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".

Compiling without Console/Status Window

If you want to run ScummVM without the console Window being present by default, there are two things you need to do:

  • In the Project Options for the scummvm project, go to the Linker | System | SubSystem line, and change the /SUBSYSTEM:CONSOLE to /SUBSYSTEM:WINDOWS
  • In the file backends/platform/sdl/win32/win32.cpp, change the parameter from true to false in the first line of OSystem_Win32::initBackend:
ConfMan.registerDefault("console", false);