Difference between revisions of "Compiling ScummVM/Visual Studio/Compiling Libraries"
Jump to navigation
Jump to search
(→libmpeg2: Update instructions on libmpeg2) |
(Update library instructions.) |
||
Line 1: | Line 1: | ||
== Instructions for compiling the needed libraries for Visual Studio yourself == | == Instructions for 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 invidiual library. | |||
* | We used the following settings when compiling the libraries: | ||
* Run-Time Library: We use the "Multi-Threaded DLL" run-time library. For Debug configurations we use the "Multi-Threaded Debug DLL" (option "/MDd"). For Release configurations we use the "Multi-Threaded DLL" (option "/MD"). | |||
* Link-time Code Generation: We disable LTCG for all configurations (option "/LTCG:OFF"). | |||
* Whole Program Optimization: We disable WPO for all configurations (option "/GL-"). | |||
Please assure that any libraries you build use exactly the same configuration settings. | |||
== Special Instructions for Libraries == | |||
Here, we will take a look at libraries which need special handling when built with Visual Studio. | |||
=== SDL 1.2 === | |||
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"> | <source lang="diff"> | ||
Line 118: | Line 62: | ||
=== zlib === | === zlib === | ||
We used a custom project file when building zlib to get the old standard library name "zlib.lib". It can be found inside a zip file in the "patches/" directory of our pre-built library package. The project file was created for zlib 1.2.8. | |||
=== libogg === | === libogg === | ||
We use the "libogg_static" solution to create a library for static linking. | |||
=== libvorbis === | === libvorbis === | ||
Line 128: | Line 72: | ||
You will need to use the "vorbis_static" solution. It should feature working x86 (Win32) and x64 (x64) targets by default. | You will need to use the "vorbis_static" solution. It should feature working x86 (Win32) and x64 (x64) targets by default. | ||
'''Note''': | '''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''': You'll need vorbis, vorbisfile and also vorbisenc for ScummVM tools. | |||
=== libmad === | === libmad === | ||
You can use the "libmad" solution. | |||
'''Note for x64:''' When you want to build a x64 library for libmad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libmad solution files for x86. For Release mode you will also need to edit the preprocessor definitons via: Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions: there you will need to replace "FPM_INTEL" with "FPM_64BIT". | '''Note for x64:''' When you want to build a x64 library for libmad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libmad solution files for x86. For Release mode you will also need to edit the preprocessor definitons via: Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions: there you will need to replace "FPM_INTEL" with "FPM_64BIT". | ||
Line 154: | Line 102: | ||
=== FLAC === | === FLAC === | ||
Open | Open the FLAC solution and build "libFLAC_static" and "win_utf8_io_static". | ||
=== libfaad === | |||
We used the following patch when compiling libfaad to adjust for changes in the MSVC runtime: | |||
<source lang="diff"> | <source lang="diff"> | ||
--- | 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/faad2-2.7/libfaad/common.h 2016-03-09 20:27:08.851178000 +0100 | ||
@@ -315,7 +315,7 @@ | |||
#if defined(_WIN32) && !defined(__MINGW32__) | |||
#define HAS_LRINTF | |||
- static INLINE int lrintf(float f) | |||
+ /*static INLINE int lrintf(float f) | |||
{ | |||
int i; | |||
__asm | |||
@@ -324,7 +324,7 @@ | |||
fistp i | |||
} | |||
return i; | |||
- } | |||
+ }*/ | |||
#elif (defined(__i386__) && defined(__GNUC__) && \ | |||
!defined(__CYGWIN__) && !defined(__MINGW32__)) | |||
#ifndef HAVE_LRINTF | |||
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/mp4.c sources/faad2-2.7/libfaad/mp4.c | |||
--- sources.orig/faad2-2.7/libfaad/mp4.c 2009-02-06 04:39:58.000000000 +0100 | |||
+++ sources/faad2-2.7/libfaad/mp4.c 2016-03-09 20:27:09.200404900 +0100 | |||
@@ -32,6 +32,7 @@ | |||
#include "structs.h" | |||
#include <stdlib.h> | |||
+#include <string.h> | |||
#include "bits.h" | |||
#include "mp4.h" | |||
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/ps_dec.c sources/faad2-2.7/libfaad/ps_dec.c | |||
--- sources.orig/faad2-2.7/libfaad/ps_dec.c 2009-01-26 23:32:31.000000000 +0100 | |||
+++ sources/faad2-2.7/libfaad/ps_dec.c 2016-03-09 20:27:09.233469100 +0100 | |||
@@ -33,6 +33,7 @@ | |||
#ifdef PS_DEC | |||
#include <stdlib.h> | |||
+#include <string.h> | |||
#include "ps_dec.h" | |||
#include "ps_tables.h" | |||
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/sbr_hfadj.c sources/faad2-2.7/libfaad/sbr_hfadj.c | |||
--- sources.orig/faad2-2.7/libfaad/sbr_hfadj.c 2008-09-20 00:50:20.000000000 +0200 | |||
+++ sources/faad2-2.7/libfaad/sbr_hfadj.c 2016-03-09 20:27:09.400963200 +0100 | |||
@@ -40,6 +40,8 @@ | |||
#include "sbr_noise.h" | |||
+#include <string.h> | |||
+# | |||
+ | + | ||
/* static function declarations */ | |||
static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, | |||
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/sbr_syntax.c sources/faad2-2.7/libfaad/sbr_syntax.c | |||
--- sources.orig/faad2-2.7/libfaad/sbr_syntax.c 2009-01-26 23:32:31.000000000 +0100 | |||
+ | +++ sources/faad2-2.7/libfaad/sbr_syntax.c 2016-03-09 20:27:09.458518400 +0100 | ||
+ | @@ -48,6 +48,8 @@ | ||
+ | |||
@@ - | |||
#endif | #endif | ||
#include "analysis.h" | |||
static | +#include <string.h> | ||
+ | |||
/* static function declarations */ | |||
/* static function declarations */ | |||
static void sbr_header(bitfile *ld, sbr_info *sbr); | |||
</source> | </source> | ||
'''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. | ||
=== libmpeg2 === | === libmpeg2 === | ||
We used a custom solution to build libmpeg2. It can be found inside a zip file in the "patches/" directory of our pre-built library package. The project file was created for libmpeg 0.5.1. | |||