Difference between revisions of "Compiling ScummVM/Visual Studio/Compiling Libraries"

Jump to navigation Jump to search
m
(Update library instructions.)
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Instructions for compiling the needed libraries for Visual Studio yourself ==
== Using vcpkg package manager ==


Building libraries for use with Visual Studio is a complicated process. Many libraries only feature out-dated project files or have incompatible configurations for their project files. On this page we give a general introduction of the settings we used for building the libraries with Visual Studio 2015 Community Edition. Afterwards, we give a more detailed view on the process of building each invidiual library.
If you're using Visual Studio 2015 or later, [https://github.com/Microsoft/vcpkg vcpkg] is the simplest way to get the libraries compiled. It works similar to Linux package managers, but everything is locally compiled from source, so you always get binaries for the specific compiler and architecture you're using.
 
After following their installation instructions, just run the following command from the vcpkg folder to build the libraries:
 
<pre>
vcpkg install curl faad2 fluidsynth freetype fribidi giflib libflac libjpeg-turbo libmad libmikmod libmpeg2 libogg libpng libtheora libvorbis libvpx sdl2 sdl2-net zlib discord-rpc
</pre>
 
Any missing libraries are optional and currently not available in vcpkg, so you will have to build them yourself if you want to enable them.
 
By default this will create x86 DLLs. If you want a different target, you can add "--triplet <triplet>" to the command, for example:
 
* '''x64-windows:''' x64 DLLs
* '''x86-windows-static-md:''' x86 static LIBs
 
Note not every library is compatible with every target, but they should all work as x86/x64 DLLs.
 
== Manually compiling the needed libraries for Visual Studio yourself ==
 
Building libraries for use with Visual Studio is a complicated process. Many libraries only feature out-dated project files or have incompatible configurations for their project files. On this page we give a general introduction of the settings we used for building the libraries with Visual Studio 2015 Community Edition. Afterwards, we give a more detailed view on the process of building each individual library.


We used the following settings when compiling the libraries:
We used the following settings when compiling the libraries:
Line 17: Line 36:
We used the following patch when compiling SDL 1.2, which is required for x64 support. The patch was gladly taken from the SDL mailing list.
We used the following patch when compiling SDL 1.2, which is required for x64 support. The patch was gladly taken from the SDL mailing list.


<source lang="diff">
<syntaxhighlight lang="diff">
--- src/video/windx5/SDL_dx5video.c Tue Oct 13 00:07:16 2009
--- src/video/windx5/SDL_dx5video.c Tue Oct 13 00:07:16 2009
+++ src/video/windx5/SDL_dx5video.c Tue Nov 03 21:14:38 2009
+++ src/video/windx5/SDL_dx5video.c Tue Nov 03 21:14:38 2009
Line 56: Line 75:
   
   
  /* Initialization/Query functions */
  /* Initialization/Query functions */
</source>
</syntaxhighlight>


After adding a new x64 configuration option in the project files, you may also need to remove "/MACHINE:I386" as additional linker command in Project->Properties, Configuration Properties->Linker->Command Line.
After adding a new x64 configuration option in the project files, you may also need to remove "/MACHINE:I386" as additional linker command in Project->Properties, Configuration Properties->Linker->Command Line.
Line 74: Line 93:
'''Note''': You need to assure that the headers (and libraries in case you build a dynamically linked libvorbis) of libogg are in the paths MSVC searches.
'''Note''': You need to assure that the headers (and libraries in case you build a dynamically linked libvorbis) of libogg are in the paths MSVC searches.


'''Note''': The static solution can be bugged and produce a library named "libvorbisfile.lib" instead of "libvorbisfile_static.lib". You will need to fix the target name in the project file settings.
'''Note''': The static solution can be bugged and produce a library named "libvorbisfile.lib" instead of "libvorbisfile_static.lib". You will need to fix the target name in the project settings.


'''Note''': You'll need vorbis, vorbisfile and also vorbisenc for ScummVM tools.
'''Note''': You'll need vorbis, vorbisfile and also vorbisenc for ScummVM tools.
=== libtheora ===
You will need to use the "libtheora_static" solution.
'''Note''': The static solution can be bugged and produce a library named "libtheora.lib" instead of "libtheora_static.lib". You will need to fix the target name in the project settings.


=== libmad ===
=== libmad ===
Line 86: Line 111:
You will also need to apply the following patch to mad.h:
You will also need to apply the following patch to mad.h:


<source lang="diff">
<syntaxhighlight lang="diff">
--- mad.h Tue Nov 03 18:29:06 2009
--- mad.h Tue Nov 03 18:29:06 2009
+++ mad.h Tue Nov 03 18:29:14 2009
+++ mad.h Tue Nov 03 18:29:14 2009
Line 98: Line 123:
  # define FPM_INTEL
  # define FPM_INTEL
+#endif
+#endif
</source>
</syntaxhighlight>


=== FLAC ===
=== FLAC ===
Line 108: Line 133:
We used the following patch when compiling libfaad to adjust for changes in the MSVC runtime:
We used the following patch when compiling libfaad to adjust for changes in the MSVC runtime:


<source lang="diff">
<syntaxhighlight lang="diff">
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/common.h sources/faad2-2.7/libfaad/common.h
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/common.h sources/faad2-2.7/libfaad/common.h
--- sources.orig/faad2-2.7/libfaad/common.h 2009-02-05 01:51:03.000000000 +0100
--- sources.orig/faad2-2.7/libfaad/common.h 2009-02-05 01:51:03.000000000 +0100
Line 177: Line 202:
  static void sbr_header(bitfile *ld, sbr_info *sbr);
  static void sbr_header(bitfile *ld, sbr_info *sbr);


</source>
</syntaxhighlight>


'''Note for x64:''' When you want to build a x64 library for libfaad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libfaad solution files for x86.
'''Note for x64:''' When you want to build a x64 library for libfaad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libfaad solution files for x86.
329

edits

Navigation menu