Contents
- Introduction
- Prerequisites
- Download and install the PTLib source code
- Open the solution file
- Install optional packages
- Build the
PTLIB Static
project
- Build the
PTLIB DLL
project
- Tailoring the
configure
search path
Introduction
This document provides instructions building PTLib with Visual Studio on Windows.
Prerequisites
You will need the following:
- Visual Studio 2019 or 2022 Community Edition. The Professional and Enterprise editions should also work.
- There are a number of optional downloads for extra features, for example OpenSSL. PTLib will automatically detect if these are installed and compile the system accordingly.
- Note that things might work for older versions of Windows, only Windows 10 or 11 is currently supported.
3. Download and install the PTLib source code
From within Visual Studio 2019/2022, you can use it's built in `git` to clone the repository git://git.code.sf.net/p/opalvoip/ptlib.
Alternatively, you can download and extract the PTLib source code. For the purposes of this document, the directory that contains PTLib will be indicated as installdir\PTLib
The PTLib source may also be downloaded as a ZIP file from the SourceForge download page.
Open the ptlib_2019.sln
or ptlib_2022.sln
solution file based on your version of Visual Studio.
The solution contains the following projects:
configure
Hello World DLL
MergeSym
PTLib DLL
PTLib Static
There is also PTLib_samples_*.sln
which contains the base library and many samples/test applications.
Both 32 and 64 builds are available in the solutions, though these days the 32 bit version is rarely tested.
Install optional packages
The PTLib build process will automatically detect many packages that are installed on the host system.
Before starting the build process, select and install the packages from the list below that are needed:
- OpenSSL - Provides support for encryption and authentication. We recommend using a pre-packaged binary distribution such as the one available from Shining Light Productions. Note only v1.x is currently supported, do not use v3.x.
- Expat - Provides support for XML. This library must be available if Voice XML (VXML) and XMPP functions are required. For 32 bit builds, we recommend using a pre-packaged binary such as the ones available from the Expat SourceForge site. For 64 bit builds you will have to build from source at https://github.com/libexpat/libexpat.git. Clone it to installdir\expat, and after creating the new x86 platform, make sure it outputs the lib to
.\..\win32\bin64\$(Configuration)\
. Note, there are a large number of places this needs to be adjusted.
- OpenLDAP - Provides support for the LDAP protocol as used by ILS and other network services. OpenLDAP requires OpenSSL to be installed. Detailed build instructions for OpenLDAP can be found here, or you can use use these precompiled binaries
- FFMPEG - Provides support for audio/video files.
- libjpeg - Provides for support for using static JPEG images as video source. Source code, and precompiled binaries for Windows are available
- Lua - Provides for support for using Lua scripting language. These are expected to be in one of several directories, e.g. ..\external\Lua-win32 and ..\external\Lua-win64. The binaries provided here are annoying in that the 32 bit and 64 bit versions are named identically. It is thus difficult to be able to use both on a development machine at the same time as you cannot simply put the DLL in your path. You need to explicitly place the correct one in the PATH via the "Debug/Evironment" Option in Visual Studio.
- V8 - Provides ECMASCRIPT (aka JavaScript) interpreter. Building this is complicated, and left as an exercise for the developer.
Build the PTLib Static
project
Build the PTLib Static
project to create a static code library containing all of the PTLib code.
In Release mode, this will build the ptlibs.lib
file. In Debug mode, this will build the ptlibsd.lib
file.
Note that the first step of the build is the execution of the configure
program which searches for optional components that may be installed on the host system.
Build the PTLib DLL
project
Build the PTLib DLL
project to create a DLL code library containing all of the PTLib code.
In Release mode, this will build the ptlib.dll
file. In Debug mode, this will build the ptlibd.dll
file.
NOTE: the Release version of the MergeSym project must be built *before* building PTLib DLL
. Generally this will happen automatically through the solution dependencies, however if this does not occur and you get an error such as:
'MergeSym' is not recognized as an internal or external command, operable program or batch file.
then right click on MergeSym project and build it manually.