-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Build Windows Dependencies
This page is outdated. Today we use VCPKG to build our Windows and macOS dependencies: https://github.com/mixxxdj/vcpkg
We assume you've installed and configured Visual Studio Express and the Microsoft Platform/Windows SDK as described in steps 1 & 2 on this page, and if you want to build x64 versions with the free Visual Studio Express 2008, that you've done this hack (or this one if you're using VS 2005.) VS 2010 Express supports x64 projects out of the box (but it uses alot more resources than earlier versions due at least in part to its (needless) dependence on .NET 4.)
To see the supported version of each library for a given Mixxx version, see dependencies.
Qt now provides pre-built binaries for 32-bit Windows for the MSVC 2008 compiler (and the minGW one.) But if you want to build it from source yourself for whatever reason (like for x64,) here are the steps:
- First, check [[https://github.com/sandym/qt-patches/tree/master/windows|This GitHub repo]] for patches and instructions that may apply to the version of Qt you're using.
- Tweak the Qt configuration:
- **Full-text search:** Edit ''C:\qt-everywhere-opensource-src-4.6.1\src\plugins\sqldrivers\sqlite\sqlite.pro''
- Add this, after the first DEFINES += :<code>DEFINES += SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS</code>
- **Speed** (optional): Edit ''C:\qt-everywhere-opensource-src-4.6.1\mkspecs\win32-msvc2008\qmake.conf'':
- If you have more than one processor/core, add ''/MP'' to ''QMAKE_CFLAGS''.
- Add ''-Ox'' to ''QMAKE_CFLAGS_RELEASE'' for "full optimization" (Though ''-O2'' is preferred.)
- Add ''/arch:SSE'' to ''QMAKE_CFLAGS_RELEASE'' for SSE support (use SSE2 if your CPU supports it)
- Add ''/LTCG'' to ''QMAKE_LIB'' to improve linker performance if using ''-ltcg'' in the configure command below.
- Change ''QMAKE_LFLAGS_LTCG'' to ''/LTCG:STATUS'' so it tells you how long it will take to generate each executable (Some of them take a loooong time (WebKit and QtScript) so it's nice to know.)
- You can do the same in ''C:\qt-everywhere-opensource-src-4.6.1\qmake\makefile.win32'' but **don't** add ''-GL'' to CFLAGS on x86 or qmake won't work. Otherwise, you can add any options suitable for your particular system since qmake is just going to run there. (e.g. /arch:SSE2)
- **Static libraries** (no msvcrtXX.dll dependence, optional): Edit ''C:\qt-everywhere-opensource-src-4.6.1\mkspecs\win32-msvc2008\qmake.conf'':
- Change the ''QMAKE_CFLAGS_RELEASE'' from ''-MD'' to ''-MT''
- Add ''/NODEFAULTLIB:"MSVCRT"'' to ''QMAKE_LFLAGS_RELEASE''.
If you want to link Qt against Agner Fog's optimized ASMLIB, do the following:
- Download the latest copy of the library from here
- Unzip it to a directory of your choice, say
C:\asmlib
- Edit
qt-everywhere-opensource-src-4.6.1\mkspecs\win32-msvc2005\qmake.conf:
- Add
-Oi-
toQMAKE_CFLAGS
- Add
/LIBPATH:"C:\\asmlib"
toQMAKE_LFLAGS
- Add
alibcof32o.lib
(oralibcof64o.lib
for 64-bit) toQMAKE_LFLAGS
(this ensures it's linked into every module)
- Add
- Tweak the Qt configuration:
- Edit
qt-everywhere-opensource-src-4.6.1\mkspecs\win32-msvc2008\qmake.conf:
- Add to
QMAKE_CFLAGS
:/favor:AMD64
(or useblend
orEM64T
if appropriate), also add/MP
if you have more than one processor/core - Add to
QMAKE_LFLAGS
:/MACHINE:X64
(orIA64
) - (optional) Add -Ox to
QMAKE_CFLAGS_RELEASE
for extra optimizations
- Add to
- Edit qt-everywhere-opensource-src-4.6.1\qmake\makefile.win32:
- add to
CFLAGS
:/favor:AMD64
(or useblend
orEM64T
if appropriate,) and -Ox for more optimizations if you want - add to
LFLAGS
:/MACHINE:X64
(orIA64
)
- add to
- Edit
qt-everywhere-opensource-src-4.6.1\mkspecs\win32-msvc2008\qmake.conf:
If building with VS2015, read this thread for patches to the Qt code base to get it to build.
- 32-bit:
- Start the Visual Studio command prompt (Start->Microsoft C++ Visual Studio->Visual Studio Tools->Visual Studio Command Prompt)
- Type ''setenv /xp /x86 /release'' and hit Enter. (The /x86 is for those on x64 OSs to make sure it targets 32-bit platforms.)
* 64-bit:
- Start the Visual Studio command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type ''setenv /xp /x64 /release'' (or ''/ia64'') and hit Enter.
- Type ''cd C:\qt-everywhere-opensource-src-4.6.1'' (or wherever you unpacked Qt) and hit Enter.
- Type ''SET QT_BUILD_PARTS=LIBS'' (and add whatever other parts you want) and hit Enter.
- Type ''configure -opensource -platform win32-msvc2005 -qt-sql-sqlite'' and press Enter.
- For more optimized code, also add ''-ltcg''.
- To configure faster, also add ''-fast -no-vcproj -no-dsp''.
- When it finishes (about 5-10 minutes,) just type ''nmake'' and press Enter and you should be good (takes 1~3 hours.)
* If you get ''<sdkdir>\winnt.h(1831) : error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed'' then edit <sdkdir>\VC\INCLUDE\intrin.h and change the definition of ''_interlockedbittestandset'' and ''_interlockedbittestandreset'' to ''long **volatile** *'' like so:<code>__MACHINEI(unsigned char _interlockedbittestandset(long volatile *a, long b))
__MACHINEI(unsigned char _interlockedbittestandreset(long volatile
*a, long b))</code> Do nmake
again and it should finish fine.
* If on x64 and you get the similar ''<sdkdir>\winnt.h(1831) : error C2733: second C linkage of overloaded function '_interlockedbittestandset64' not allowed'' then edit <sdkdir>\VC\INCLUDE\intrin.h and change the definition of ''_interlockedbittestandset64'' and ''_interlockedbittestandreset64'' to to ''_ _int64 **volatile** *'' like so:<code>__MACHINEX64(unsigned char _interlockedbittestandset64(__int64 volatile *a, __int64 b))
MACHINEX64(unsigned char
_interlockedbittestandreset64(int64 volatile *a, __int64
b))</code> Do nmake
again and it should finish fine.
libsndfile fortunately provides binaries for Win32 and Win64, so all you need to do is:
- Download & run the appropriate installer
- Copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:libsndfile\libsndfile-1.dll libsndfile\libsndfile-1.lib (rename to sndfile.lib)
- Copy the
.h
files fromlibsndfile\include
tomixxx-win[32|64]lib-msvc
- If you get a crapload of
sndfile.h
errors when Mixxx'senginesidechain.cpp
is compiling, editmixxx-win[32|64]lib-msvc\sndfile.h
and change the linetypedef __int64_t sf_count_t ;
to:typedef __int64 sf_count_t ;
PortAudio provides MSVC project files, which makes things nice. Just have the DirectX SDK installed and open and build. (Step-by-step is given below.)
Follow these instructions for the following files:
portaudio\build\msvc\portaudio.sln
portaudio\build\msvc\portaudio.vcproj
- Download and unpack the latest ASIO SDK (requires login and license agreement)
- Follow the instructions in the files
portaudio\build\msvc\readme.txt
andportaudio\src\hostapi\asio\ASIO-README.txt
to prepare to build PA with ASIO support. - Download and install the latest DirectX SDK: http://msdn.microsoft.com/en-us/directx/aa937788.aspx
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run
dx_setenv.cmd
, the DirectX SDK environment variable setup script here to add the DirectX paths. (e.g.C:\Program Files\Microsoft DirectX SDK (March 2009)\Utilities\Bin\dx_setenv.cmd
) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
portaudio\build\msvc\portaudio.vcproj
file via File->Open->Project/Solution. After doing the upgrade, you'll only see "Win32" targets if you're using VS Express. (If you've made the changes to the project files given above, building these will actually give you x64 versions. We had to do it this way otherwise VS Express would see the x64 targets in the file and refuse to make them available to you, since that's a premium feature of non-free versions of VS.) - Choose the Release configuration and the Win32 platform
- Right-click the
portaudio
project and click Properties - Navigate to Configuration Properties->C/C++->Preprocessor, then
under Preprocessor Definitions, change
PA_USE_ASIO=1
andPA_USE_DS=1
- Press F7 to build
- When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:portaudio\include\portaudio.h portaudio\build\msvc\Win32\Release\portaudio_x86.dll (or portaudio_x64.dll) portaudio\build\msvc\Win32\Release\portaudio_x86.lib (or portaudio_x64.lib. Rename either to portaudio.lib)
PortMidi provides MSVC project files, which makes things nice. Just open and build. (Step-by-step is given below.)
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
portmidi\ALL_BUILD.vcproj
file via File->Open->Project/Solution. - Choose the Release configuration and the Win32 platform
- If building for x64
- Edit the portmidi-dynamic and portmidi-static projects and
change Linker->Advanced->Target Machine to
/MACHINE:X64
- Edit the portmidi-dynamic and portmidi-static projects and
change Linker->Advanced->Target Machine to
- Right-click portmidi-dynamic and click Build
- When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:portmidi\pm_common\portmidi.h portmidi\Release\portmidi.lib portmidi\Release\portmidi.dll
PortMidi provides MSVC project files, which makes things nice. Just open and build. (Step-by-step is given below.)
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
portmidi\porttime\porttime.vcproj
file via File->Open->Project/Solution. (If on VS2005, use theporttime-VC8.vcproj
file.) - Choose the Release configuration and the Win32 platform
- Press F7 to build
- If you get
portmidi\porttime\porttime.h(20) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
then edit the project properties and addmixxx-win32lib-msvc
(or 64) to Additional Include Directories
- When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:portmidi\porttime\porttime.h portmidi\porttime\Release\porttime.lib
Xiph.org provides MSVC project files, which makes things nice. Just open and build. (Step-by-step is given below.)
Follow these instructions for the following files:
libogg-1.1.4\win32\VS2008\libogg_dynamic.sln
libogg-1.1.4\win32\VS2008\libogg_dynamic.vcproj
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
libogg-1.1.4\win32\VS2008\libogg_dynamic.vcproj
file via File->Open->Project/Solution. You'll only see "Win32" targets if you're using VS Express. (If you've made the changes to the project files given above, building these will actually give you x64 versions. We had to do it this way otherwise VS Express would see the x64 targets in the file and refuse to make them available to you, since that's a premium feature of non-free versions of VS.) - Choose the Release configuration and the Win32 platform
- Press F7 to build
- When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:libogg-1.1.4\win32\VS2008\Win32\Release_SSE2\libogg.dll libogg-1.1.4\win32\VS2008\Win32\Release_SSE2\libogg.lib (rename to ogg.lib)
- Copy the
.h
files fromlibogg-1.1.4\include\ogg
intomixxx-win[32|64]lib-msvc\ogg
Xiph.org provides MSVC project files, which makes things nice. Just open and build. (Step-by-step is given below.) Libvorbis depends on libogg, so build that first.
Follow these instructions for the following files:
libvorbis-1.2.3\win32\VS2008\vorbis_dynamic.sln
libvorbis-1.2.3\win32\VS2008\libvorbis\libvorbis_dynamic.vcproj
libvorbis-1.2.3\win32\VS2008\libvorbisfile\libvorbisfile_dynamic.vcproj
- Edit
libvorbis-1.2.3\win32\VS2008\libogg.vsprops
and make sure the LIBOGG_VERSION at the bottom matches the version of libogg you built above. - Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
libvorbis-1.2.3\win32\VS2008\vorbis_dynamic.sln
file via File->Open->Project/Solution. You'll only see "Win32" targets if you're using VS Express. (If you've made the changes to the project files given above, building these will actually give you x64 versions. We had to do it this way otherwise VS Express would see the x64 targets in the file and refuse to make them available to you, since that's a premium feature of non-free versions of VS.) - Choose the Release_SSE2 configuration and the Win32 platform
- Right-click
libvorbis
and click Build - Right-click
libvorbisfile
and click Build - When finished, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:libvorbis-1.2.3\win32\VS2008\Win32\Release_SSE2\libvorbis.dll libvorbis-1.2.3\win32\VS2008\Win32\Release_SSE2\libvorbis.lib libvorbis-1.2.3\win32\VS2008\Win32\Release_SSE2\libvorbisfile.dll libvorbis-1.2.3\win32\VS2008\Win32\Release_SSE2\libvorbisfile.lib
- Copy the
libvorbis-1.2.3\include\vorbis
folder from intomixxx-win[32|64]lib-msvc
. You can delete the Makefiles inside, as we just need the .h files.
- If you get the error
vorbis.def : error LNK2001: unresolved external symbol _analysis_output_always
comment the line_analysis_output_always
inlibvorbis-1.2.3\win32\vorbis.def
(line 51 in my copy.) Press F7 again and it should build fine.
MAD provides MSVC project files, which makes things nice. Just open and build. (Step-by-step is given below.)
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
libmad-0.15.1b\msvc++\libmad.dsp
file via File->Open->Project/Solution. - Answer 'Yes' to convert & open the project
- Choose the Release configuration and the Win32 platform
- If building for x64
- Right-click
libmad
and click Properties - Go to Configuration Properties->C/C++->Preprocessor and under
Preprocessor Definitions, change
FPM_INTEL
toFPM_64BIT
- Right-click
- Press F7 to build. (You can cancel the .sln save dialog if you want and it will still build.)
- When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:libmad-0.15.1b\mad.h libmad-0.15.1b\msvc++\Release\libmad.lib
MAD provides MSVC project files, which makes things nice. Just open and build. (Step-by-step is given below.)
LibID3Tag needs ZLib headers, so we have to get them too (detailed below.)
- Download & unpack the latest zlib source
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
libid3tag-0.15.1b\msvc++\libid3tag.dsp
file via File->Open->Project/Solution. - Answer 'Yes' to convert & open the project
- Choose the Release configuration and the Win32 platform
- Add the ZLib paths to the compiler:
- Right-click
libid3tag
and click Properties - Go to Configuration Properties->C/C++->General and under
Additional Include Directories, add the path to the directory
into which you unpacked the ZLib source, e.g.
c:\temp\zlib123
- Click OK.
- Right-click
- Press F7 to build. (You can cancel the .sln save dialog if you want and it will still build.)
- When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:libid3tag-0.15.1b\id3tag.h libid3tag-0.15.1b\msvc++\Release\libid3tag.lib (rename to id3tag.lib)
- If you get the error
..\file.c(33) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
then edit the filelibid3tag-0.15.1b-patched\file.c
and change the line# include "config.h"
to# include "msvc++/config.h"
Save that and press F7 to rebuild.
FAAD2 provides MSVC project files, which makes things nice. Just open and build. (Step-by-step is given below.)
- Edit
faad2-2.7\libfaad\common.h
:- Delete line 315,
#if defined(_WIN32) && !defined(__MINGW32__)
and replace it with <code> #if defined(_WIN64) && !defined(MINGW64)
- Delete line 315,
// No LRINTF until someone writes an .asm file
#elif defined(_WIN32) && !defined(__MINGW32__)</code>
- Save the file.
- Edit the
faad2-2.7\libfaad\libfaad2.def
file and add the following lines to the bottom:NeAACDecPostSeekReset @10 NeAACDecDecode2 @11
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, specifying the
/useenv
switch to have it use the Platform SDK compile tools, libs and includes. (e.g.C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
faad2-2.7\libfaad\libfaad2_dll.vcproj
file via File->Open->Project/Solution. - Answer 'Yes' to convert & open the project
- Choose the Release configuration and the Win32 platform
- Add the FAAD path to the compiler:
- Right-click the
libfaad2_dll
project and go to Properties - Go to Configuration Properites->C/C++->General
- Choose "Additional Include Directories" on the right and add
FAAD's 'include' directory, e.g.
c:\temp\faad2-2.7\include
- Click OK.
- Right-click the
- Press F7 to build. (You can cancel the .sln save dialog if you want and it will still build.)
- If you get
faad2-2.7\libfaad\common.h(42) : fatal error C1083: Cannot open include file: 'neaacdec.h': No such file or directory
then under project Configuration properties->C/C++->General:
* Add to Additional Include Directories: ''..\include''
- When it finishes, copy the following files into ''mixxx-win32lib-msvc'' or ''mixxx-win64lib-msvc'': <code>faad2-2.7\libfaad\include\faad.h
faad2-2.7\libfaad\include\neaacdec.h faad2-2.7\libfaad\include\libfaad\ReleaseDLL\libfaad2.dll faad2-2.7\libfaad\include\libfaad\ReleaseDLL\libfaad2.lib (rename to libfaad.lib) </code>
MP4V2 provides MSVC solution files, which makes things nice. Just open and build. (Step-by-step is given below.)
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
mp4v2-1.9.1\vstudio9.0\libmp4v2\libmp4v2.vcproj
file via File->Open->Project/Solution. - Choose the Release configuration and the Win32 platform
- If building for x64
- Go to Build->Configuration manager
- Drop down Active Solution Platform and choose New...
- Type x64 and choose copy settings from Win32. Click OK.
- Choose Release on the left, x64 on the right and click Close.
- Tune the project settings to your liking
- Right-click the libmp4v2 project and click Properties.
- Under Configuration Properties, Linker, Debugging, set Generate Debug Info to No.
- Right click
libmp4v2
and click Build. - When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:mp4v2-1.9.1\vstudio9.0\Release\libmp4v2.dll mp4v2-1.9.1\vstudio9.0\Release\libmp4v2.lib mp4v2-1.9.1\include\mp4v2 (the whole directory)
libFLAC provides MSVC solution files, which makes things nice.
libFLAC requires The Netwide Assembler to build.
- Download the ZIP file from here and extract it.
- Rename/copy the file
nasm.exe
tonasmw.exe
since that's what the FLAC sources look for
Note: For x64 as of FLAC v1.2.1, we have been unable to get it to
build. It gives the following errors:bitreader_asm.obj : error LNK2001: unresolved external symbol _FLAC__crc16_table bitreader_asm.obj : error LNK2001: unresolved external symbol _bitreader_read_from_client_
The only solutions currently found are to
build the static version, or to download the OpenCodecs
source
and use the
opencodecs\src\lib\codecs\flac\libs\libflac\src\libFLAC\libFLAC_dynamic.vcproj
as-is and skip the rest of this section since that source seems to
include the below patches.
- Copy
libogg-1.1.4\win32\VS2008\Win32\Release_SSE\libogg_static.lib
toflac-1.2.1\obj\release\lib
and rename it toogg_static.lib
-
For x64:
-
For each of the following files, search & replace all instances of
-f win32
with-f win64
:flac-1.2.1\src\libFLAC\libflac_dynamic.dsp flac-1.2.1\src\libFLAC\libflac_dynamic.vcproj flac-1.2.1\src\libFLAC\libflac_static.dsp flac-1.2.1\src\libFLAC\libflac_static.vcproj
-
Apply the following patch to
flac-1.2.1\src\libFLAC\bitreader.c
:`--- flac-1.2.1-original\src\libFLAC\bitreader.c Tue Sep 11 06:48:56 2007 +++ flac-1.2.1\src\libFLAC\bitreader.c Tue May 20 12:30:08 2008 @@ -149,15 +149,37 @@ FLAC__CPUInfo cpu_info; };-#ifdef MSC_VER -/* OPT: an MSVC built-in would be better / + +/ local_swap32() / +/ Swaps the byte order of a 32 bits integer, converting between big-endian and little-endian */ +#if defined(_MSC_VER) + +#include <stdlib.h> // Contains _byteswap_ulong() for MSVC according to MSDN static inline FLAC__uint32 local_swap32(FLAC__uint32 x) {
- /* This is an intrinsic and will expanded to minimal asm by the compiler */
- return _byteswap_ulong(x); +}
+#else /* defined(_MSC_VER) */ + +static inline FLAC__uint32 local_swap32(FLAC__uint32 x) +{
- /* Manual version, a bit slower but works everywhere */ x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); return (x>>16) | (x<<16); }
+#endif /* defined(MSC_VER) / + + +/ local_swap32_block() / +/ Swaps the byte order of an array of 32 bits integers */ +#if defined(_MSC_VER) && !defined(FLAC__NO_ASM) || !defined(M_X64) + static void local_swap32_block(FLAC__uint32 *start, FLAC__uint32 len) {
- /* MSVC specific 32 bit asm version */ __asm { mov edx, start mov ecx, len @@ -173,7 +195,22 @@ done1: } } -#endif
+#else /* defined(_MSC_VER) && !defined(FLAC__NO_ASM) || !defined(M_X64) */ + +static void local_swap32_block(FLAC__uint32 *start, FLAC__uint32 len) +{
- /* MSVC specific intrinsic version */
- while(len > 0)
- {
- *start = local_swap32_(*start);
- ++start;
- --len;
- } +}
+#endif /* defined(_MSC_VER) && !defined(FLAC__NO_ASM) || !defined(_M_X64) */ +
static FLaC__INLINE void crc16_update_word_(FLAC__BitReader *br,
brword word) {
`
-
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Add paths to the environment:
- Go to Tools->Options->Projects and Solutions->VC++ Directories
- Choose "Executable files" on the right and add the path to the
NASM directory you extracted to above, e.g.
C:\nasm-2.09.03
- Choose "Include files" on the right and add the path to the
libOGG include directory, e.g.
C:\libogg-1.1.4\include
- Open the
flac-1.2.1\FLAC.sln
file and agree to upgrade if asked - Rename the
libFLAC_dynamic
project to justlibFLAC
- Choose the Release configuration and the Win32 platform
- If building for x64, for both the
libFLAC_dynamic
andlibFLAC_static
projects:- Right-click it and choose Properties...
- Go to Configuration Properties->C/C++->Preprocessor and enter
FLAC__NO_ASM;
at the front of the Preprocessor Definitions list - For the dynamic one only, go to Configuration
Properties->Linker->Advanced and choose
/MACHINE:X64
for Target Machine - For the dynamic one only, go to Configuration
Properties->Linker->Debugging and ensure Generate Debug Info
is set to
No
- If you're going to use the static library, edit
mixxx\src\soundsourceflac.h
and add:#define FLAC__NO_DLL
above the#include <FLAC/stream_decoder.h>
line.
- Right click
libFLAC_dynamic
and click Build. - When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:flac-1.2.1\obj\release\lib\libFLAC.lib flac-1.2.1\obj\release\lib\libFLAC.dll flac-1.2.1\include\FLAC (the whole directory)
Stanton's HSS1394 provides MSVC solution files (that we've updated) which makes things nice.
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
HSS1394\code\builds\win32\libHSS1394_dll_VC90.vcproj
file via File->Open->Project/Solution. - Choose the Release configuration and the Win32 platform
- If building for x64,
- Right-click the libHSS1394 project and click Properties.
- Under Configuration Properties->C/C++->Preprocessor, for
Preprocessor Definitions, add
;_WIN64_
- Tune the project settings
- Right-click the libHSS1394 project and click Properties.
- Under Configuration Properties->Linker->General, set Output
File to
$(OutDir)\HSS1394.dll
- Under Configuration Properties->Linker->Advanced, set Import
Library to
$(OutDir)\HSS1394.lib
- Right click
libHSS1394
and click Build. - When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:HSS1394\lib\HSS1394.lib HSS1394\lib\HSS1394.dll HSS1394\inc (the whole directory, and rename it to HSS1394)
- Edit the
mixxx-win[32|64]lib-msvc\HSS1394\HSS1394Types.h
source file and change line 65 to:<code> #ifdef WINDOWS</code> - Save the file
Libshout is a library for live audio broadcasting over the Internet. It is developed by the icecast.org project.
libshout requires libogg, libvorbis, and PThreads.
You must have first built libogg and libvorbis (see above.)
libshout requires POSIX threads for Windows. It's a piece of cake to build:
-
Download the source tree
(look for files named like
pthreads-w32-2-8-0-release.tar.gz
and pick the latest one.) - Unpack the directory to the same folder you unpacked libshout's (so
that the
pthreads
andlibshout
folders are at the same level) - For x64,
- Edit the file
pthread_cancel.c
- Change line 195 to
ptw32_register_cancelation ((PAPCFUNC)ptw32_cancel_callback, threadH, 0);
- Edit the file
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) -
cd
to the directory you unpacked it to - Type
nmake clean VC
and hit Enter. - When it finishes, type
mt.exe -manifest pthreadVC2.dll.manifest -outputresource:pthreadVC2.dll;2
and hit Enter. - Copy the following file into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:pthreads\pthreadVC2.dll
- Download the Icecast server source
- Extract the file
icecast-2.3.2\src\compat.h
tolibshout-2.3.1\include
- Rename/copy
libshout-2.2.2\include\shout\shout.h.in
toshout.h
- Copy
libshout-2.2.2\include\shout\shout.h
tomixxx-win[32|64]lib-msvc\shout
- Copy
libshout-2.2.2\include\os.h
tomixxx-win[32|64]lib-msvc\shout
- Edit
mixxx-win[32|64]lib-msvc\shout\shout.h
:- Change
#include <os.h>
to#include "os.h"
- Change line 25 to
#ifdef __WINDOWS__
- Change
-
Edit the file
libshout-2.4.1\src\proto_http.c
. Find the line#include <strings.h>
and wrap it in an#ifndef _WIN32
:#ifndef _WIN32 #include <strings.h> #endif
-
Edit the file
libshout-2.4.1\src\proto_roaraudio.c
. Find the line#include <arpa/inet.h>
and replace it with:#ifdef _WIN32 #include <Winsock2.h> #else #include <arpa/inet.h> #endif
-
Edit the file
libshout-2.4.1\include\os.h
. Add the following lines inside the#ifdef _MSC_VER
block:` #define strncasecmp _strnicmp #define strcasecmp _stricmptypedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t;
`
-
Edit the file
libshout-2.4.1\src\httpp\httpp.h
. Find the line#define __HTTPP_H
and add underneath it:#ifdef _MSC_VER #define strcasecmp _stricmp #endif
- Edit the file
libshout-2.3.1\src\timing\timing.h
and add near the top:#if defined(_WIN32) #define HAVE_FTIME 1 #include <sys/timeb.h> #endif
- Edit
libshout-2.3.1\src\timing\timing.c
and replace the struct definition and ftime call at line 57 with the following:#if defined(_WIN32) struct _timeb t; _ftime(&t); #else struct timeb t; ftime(&t); #endif
- Edit
libshout-2.3.1\include\os.h
and add the following line under theint32
one:typedef unsigned __int16 uint16_t;
Thanks to Prokoba's blog for guidance!
- Edit the file
libshout-2.2.2\src\timing\timing.h
:- Remove the
#ifdef _mangle
block - Before the first
#ifdef _WIN32
line, add#undef int64_t #undef uint64_t
- Remove the
- Edit the file
libshout-2.2.2\src\shout.c
:- Search and replace all instances of the word
inline
with__inline
- Change line 1016 to
ret = sock_write_bytes (self->socket, (char*)data + pos, len - pos);
- Add the following at the top:
#ifndef __MINGW32__ #define va_copy(ap1, ap2) memcpy(&ap1, &ap2, sizeof(va_list)) #endif
- Search and replace all instances of the word
- Edit
libshout-2.2.2\include\shout\shout.h
and place__declspec(dllexport)
in front of every function definition
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
libshout-2.2.2\win32\libshout.dsp
file via File->Open->Project/Solution and upgrade if needed. - Choose the Release configuration and the Win32 platform
- If building for x64
- Go to Build->Configuration manager
- Drop down Active Solution Platform and choose New...
- Type x64 and choose copy settings from Win32. Click OK.
- Choose Release on the left, x64 on the right and click Close.
- Change the project to a DLL:
- Go to Configuration Properties->General, and change Configuration Type to "Dynamic Library (.dll)"
- Change Whole Program Optimization to "Use Link Time Code Generation"
- Click OK
- Fix missing source files:
- Find
libshout-2.2.2\src\vorbis.c
and drag it to theSource Files
folder in the project - For v2.3.1, drag the following additional files to the
Source Files
folder in the project:libshout-2.3.1\src\webm.c libshout-2.3.1\src\opus.c
- Find
- Add the paths to the dependencies:
- Right-click
libshout
and choose Properties. - If you're using a static build of pthreads, under Configuration
Properties->C/C++->Preprocessor, add
PTW32_STATIC_LIB
to Preprocessor Definitions - Under Configuration Properties->C/C++->General, add the
following paths under
Additional Include Directories
:..\..\pthreads-w32-2-8-0-release,..\..\libvorbis-1.2.3\include,..\..\libogg-1.1.4\include
- If you didn't copy
compat.h
, add the path to the Icecast server source as well,..\..\icecast-2.3.2\src
- If you didn't copy
- Go to Configuration Properties->Linker
- Under General, for Additional Library Directories, enter the
semicolon-separated paths:
- to the pthreads path you created above (e.g.
..\..\pthreads
) - to ogg.lib and vorbis.lib (which should be in
mixxx-win[32|64]lib-msvc
at this point, so you can just enter the path to that.)
- to the pthreads path you created above (e.g.
- Under Linker, for Additional Dependencies, enter
pthreadVC2.lib Ws2_32.lib winmm.lib ogg.lib vorbis.lib
(If building Mixxx statically, you only needpthreadVC2.lib
here since Mixxx links the others for Qt.)
- Under General, for Additional Library Directories, enter the
semicolon-separated paths:
- Click OK.
- Right-click
- Right click
libshout
and click Build. (If you get a bunch of "already defined" errors, go to Configuration Properties->Linker and under Linker, for Ignore Specific Library, enterLIBCMT.lib
.) - When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:libshout-2.2.2\win32\Release\libshout.lib libshout-2.2.2\win32\Release\libshout.dll
TagLib uses the CMake build system to build on Windows.
You downloaded the zlib source above for libid3tag, but we actually need to build it for taglib.
Follow these instructions for the following files:
zlib-1.2.5\contrib\vstudio\vc9\zlibvc.sln
zlib-1.2.5\contrib\vstudio\vc9\zlibvc.vcproj
- If you don't have MASM installed, just download the MASM object files from here and unpack into your zlib source tree. (Or choose the ReleaseWithoutASM configuration.)
- If you do:
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Type
cd zlib-1.2.5\contrib\masmx64
orcd zlib-1.2.5\contrib\masmx86
depending on your platform. - Type
bld_ml64
orbld_ml32
depending on your platform.
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
zlib-1.2.5\contrib\vstudio\vc9\zlibvc.vcproj
file via File->Open->Project/Solution. - Choose the Release configuration and the Win32 platform.
- Right-click the
zlibvc
project and choose Properties - Under Configuration Properties->C/C++->Preprocessor, add
ZLIB_DLL
to the list of Preprocessor Definitions - Under Code Generation, ensure that Runtime Library is set to
Multi-threaded DLL (/MD)
- Click OK
- Right-click the
zlibvc
project again and click Build - When it's done, copy the following file to
mixxx-win[32|64]lib-msvc
:zlib-1.2.5\contrib\vstudio\vc9\x86\ZlibDllRelease\zlibwapi.dll
(We don't need .h or .lib files for this since Mixxx itself doesn't use it.)
- Download CMake (the binary installer is all you need)
- Install it (The 32-bit version is fine for 64-bit systems)
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) -
cd
to where taglib is extracted, e.g.C:\sources\taglib-1.6.3
- Enter the command
cmake -DWITH_ASF=ON -DWITH_MP4=ON -DZLIB_LIBRARY="C:\path\to\zlib123\projects\visualc6\Win32_DLL_Release\zlib1.lib" -DZLIB_INCLUDE_DIR="C:\path\to\zlib123" -G "Visual Studio 9 2008"
(for x64 use"Visual Studio 9 2008 Win64"
) - For VS Express 2005 on x64:
- The above command will return a failure. Run it again but hit CTRL-C before it finishes.
- Run it a third time and it will generate the x64 project files. ^_^
- Run it a fourth time to ensure the generated files are coherent.
-
Follow these instructions for
the following files:
taglib-1.6.3\taglib.sln taglib-1.6.3\taglib\tag.vcproj
- Run the Visual Studio GUI from this command line, telling it to use
the environment variables, to have it use the Platform SDK compile
tools, libs and includes. (e.g.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
taglib-1.6.3\taglib\tag.vcproj
file via File->Open->Project/Solution. (If on x64, ignore the platform warnings. The "tag" project should appear build-able.) - Choose the Release configuration and the Win32 platform
- If building as a static library, ensure that Runtime Library under
Configuration Properties->C/C++->Code generation is set to
Multi-threaded DLL (/MD)
to prevent duplicate symbol errors when linking Mixxx. - Right click
tag
and click Build. - When it finishes, copy the following files into
mixxx-win32lib-msvc
ormixxx-win64lib-msvc
:taglib-1.6.3\taglib\Release\tag.lib taglib-1.6.3\taglib\Release\tag.dll
- If you get an error about unresolved external symbols, do the
following:
- Re-open the zlib project above
- Right-click zlibvc and click Properties
- Go to Configuration
Properties->C/C++->Preprocessor->Preprocessor Definitions and
remove
ZLIB_WINAPI
from the list. (You may also need to addZLIB_DLL
.) - Rebuild zlib & copy the dll file as above to the Mixxx lib folder
- Re-open taglib and rebuild
Copy the following files into ataglib
folder inmixxx-win[32|64]lib-msvc
:taglib-1.6.3\taglib\toolkit\tfile.h taglib-1.6.3\taglib\toolkit\taglib.h taglib-1.6.3\taglib\toolkit\tbytevector.h taglib-1.6.3\taglib\taglib_export.h taglib-1.6.3\taglib_config.h taglib-1.6.3\taglib\ape\apetag.h taglib-1.6.3\taglib\tag.h taglib-1.6.3\taglib\toolkit\tstring.h taglib-1.6.3\taglib\toolkit\tmap.h taglib-1.6.3\taglib\toolkit\tmap.tcc
- Just copy every
.h
file from the taglib source tree intomixxx-win[32|64]lib-msvc\taglib
. Some of the files just #include their counterparts in other directories with the actual content, so be careful to get the actual content ones. (Do a directory search for*.h
, then sort by size. Copy everything that's over 2K, then copy everything 2K and under, rejecting conflicts.) - Also copy the following files to
mixxx-win[32|64]lib-msvc
:taglib-1.6.3\taglib\toolkit\tmap.tcc taglib-1.6.3\taglib\toolkit\tlist.tcc taglib-1.6.3\taglib_config.h
Google's protobuf provides MSVC project files, which makes things nice. Just open and build. (Step-by-step is given below.)
- Start the platform SDK command prompt (Start->Microsoft Windows SDK->CMD Shell)
- Type
setenv /xp /x64 /release
and hit Enter. (Orsetenv /xp /x86 /release
for 32-bit.) - Run the Visual Studio GUI from this command line, specifying the
/useenv
switch to have it use the Platform SDK compile tools, libs and includes. (e.g.C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /useenv
) - Open the
protobuf-2.4.1\vsprojects\protobuf.sln
file via File->Open->Project/Solution. - Answer 'Yes' to convert & open the project
- Choose the Release configuration and the Win32 platform
- Right-click
libprotobuf-lite
and click Build. - When it finishes, right-click
protoc
and click Build. - When that finishes, run the batch file
protobuf-2.4.1\vsprojects\extract_includes.bat
- Copy the following files into
mixxx-win[32|64]lib-msvc
:protobuf-2.4.1\vsprojects\Release\libprotobuf-lite.lib protobuf-2.4.1\vsprojects\Release\protoc.exe protobuf-2.4.1\vsprojects\include\google (the entire directory)
- Your
mixxx-win[32|64]lib-msvc
now needs to be in your PATH when you build Mixxx so it can findprotoc.exe
.
If you're doing an x64 build with VS Express 2005, you'll first need to
change some things in the vcproj
and sln
files in a text editor
before you open them in VS:
- For the
sln
files:- Replace all instances of "Win32" (case-sensitive) with "DontWantThis" or something similar
- Then replace all instances of "x64" with "Win32"
- Save the files
- For the
vcproj
files:- Replace all instances of "|Win32" (case-sensitive) with "|DontWantThis" or something similar
- Replace all instances of "|x64" with "|Win32"
- In the <Platforms> section at the top of the file, change
Name="Win32"
toName="DontWantThis"
andName="x64"
toName="Win32"
- Save the files
- Continue with the Build instructions above for the dependency in question. (Press your browser's Back button.)
Mixxx can benefit from various code optimizations. If you right-click each MSVC project and click Properties, you can set many optimization options. You can do any or all of the following:
- Configuration Properties->C/C++->Optimization
- Optimization: Maximize Speed (/O2) or Full Optimization (/Ox)
- Favor Size or Speed: Favor Fast Code (/Ot) (unless building for memory-constrained systems)
- Whole Program Optimization: Enable link-time code generation (/GL)
- Configuration Properties->C/C++->Code Generation
- Enable Enhanced Instruction Set: Streaming SIMD Extensions (/arch:SSE) or Streaming SIMD Extensions 2 (/arch:SSE2) if your CPU supports either
- On x64, Configuration Properties->C/C++->Command Line
- Add
/favor:AMD64
,/favor:EM64T
(Intel64,) or/favor:blend
(about the same on both) - Configuration Properties->Linker->Optimization
- Eliminate Unreferenced Data (/OPT:REF)
- Remove Redundant COMDATs (/OPT:ICF)
- Use Link Time Code Generation (/ltcg)
- Configuration Properties->Librarian->Command line
- Add
/LTCG
If you want to link any of the VC++ projects against Agner Fog's optimized ASMLIB, do the following:
- Download the latest copy of the library from here
- Unzip it to a directory of your choice, say
C:\asmlib
- Once you've started the VC++ IDE, Go to Tools->Options->Projects
and Solutions->VC++ Directories
- Choose "Include files" on the right and add the path to the
ASMLIB directory you set above, e.g.
C:\asmlib
- Choose "Library files" on the right and add the path to the
ASMLIB directory you set above, e.g.
C:\asmlib
- Click OK.
- Choose "Include files" on the right and add the path to the
ASMLIB directory you set above, e.g.
- After opening the project/solution file, right-click each project,
Choose Properties and do:
- Configuration Properties->C/C++->Optimization: Set Enable Intrinsic Functions to No.
- Configuration Properties->C/C++->Command Line: Add
/Oi-
to Additional Options. - Configuration Properties->Linker->Input: Add
alibcof64o.lib
(oralibcof32o.lib
for 32-bit) to "Additional Dependencies"
Note: Don't link libid3tag, libmad, taglib, or libshout with ASMLIB if you want to be able to link Mixxx itself with it.
Mixxx is a free and open-source DJ software.
Manual
Hardware Compatibility
Reporting Bugs
Getting Involved
Contribution Guidelines
Coding Guidelines
Using Git
Developer Guide
Creating Skins
Contributing Mappings
Mixxx Controls
MIDI Scripting
Components JS
HID Scripting