Here are some field notes for building playd
with Microsoft Visual Studio.
Visual Studio builds used to be much harder to pull off, but nowadays all of the dependencies are nicely packaged for both x86 and x64.
Note: The x64 build currently has a few warnings, but it appears to work!
At time of writing, playd
has been tested with Visual Studio 2015 Update 3.
As playd
needs a C++14 compiler, earlier versions will likely fail;
newer versions may work, but this is not guaranteed.
Now you can sit back and relax whilst this script downloads the binary versions of all the libraries.
- CMake, for generating the MSVC project;
- Python 2.7, for building libuv;
- PowerShell (compatibility unknown, but works on 5.0)
- 7-Zip command-line
- Git
All of these are available through Chocolatey.
Set the PYTHON environment variable to the path to python.exe, or add the path to the PATH environment vairable.
C:\>$env:PYTHON = "C:\Python27\python.exe"
.\WindowsBuilder.ps1 [-deps] [-playd] -arch x86|x64 [<CommonParameters>]
Full help text: Get-Help .\Windows-Builder.ps1
The build will be in a directory like: x86\build\Release\
along with all the necessary DLLs.
Note: Only the Release configuration is currently supported. Debug will eventually be supported, but until then, you're on your own. Use Linux or something.
Create a directory structure like this. build\
and cbuild\
can be named however you like.
build\
├── cbuild\
├── include\
└── lib\
The following instructions assume you are building an x86 Release build. If you are building a Debug build, or for x64, you will probably have to compile the following yourself, or do other weird hoop-jumping to get things to work.
You will need:
- The 32-bit MSVC distribution of SDL2 (only if you are building a Release build; for Debug builds, you will need to compile SDL2 yourself);
- The 32-bit MSVC distribution of
libsndfile
; - The 32-bit MSVC distribution of
libuv
; - The includes, and a self-generated import library, from the
libmpg123
32-bit binary distribution. See below for tips.
The lib
directory should include:
libmpg123-0.lib
, see below;libsndfile-1.lib
, from thelibsndfile
Windows distribution;libuv.lib
, from the libuvWindows
distribution;SDL2.lib
andSDLmain.lib
from SDL2 (if you are building aDebug
version of playd, you will need to build SDL2 from source--the Visual Studio pre-packaged lib is built forRelease
only and will give you linker errors!)
The include
directory should include:
mpg123.h
andfmt123.h
from libmpg123;- The contents of SDL2's
include
directory (better safe than sorry); sndfile.h
andsndfile.hh
from libsndfile;- These headers from
libuv
'sinclude
directory:tree.h
uv.h
uv-errno.h
uv-threadpool.h
uv-version.h
uv-win.h
The MSVC 2010 port of libmpg123 is in need of updating to make it work, but you can use the binary distribution. You need to make an import library for the DLL, using the included DEF file.
- Get into a Visual Studio Command Prompt;
- Change to the
mpg123
distribution directory; - Rename
libmpg123-0.dll.def
tolibmpg123-0.def
; - Run
lib /def:libmpg123-0.def /OUT:libmpg123-0.lib
; - Copy to
\lib
as above.
To get the files from the binary distribution, you can install the exe, or extract it with 7-Zip.
To compile libuv
from source instead, see the official readme.
You will need Python 2.7.
To compile the shared x86 release binary: vcbuild.bat shared x86 release
You must install the exe. Extracting it doesn't work at the time of writing, on libsndfile v1.0.27
.
In the cbuild\
directory:
cmake ..\..\ -G "Visual Studio 15 2015" -DCMAKE_PREFIX_PATH="absolute\path\to\build\"
Open build\cbuild\playd.sln
, ensure that the Release Win32 configuration is selected, and have fun building!