Table of Contents
Windows - Building PTerm (Part 1)
Overview
This article outlines the detailed process of building PTerm 1) from sources. Use the navigation provided in the table of contents (on the right) to jump to the correct section.
Project Support
The Retro1 project supports an installer distribution for:
- Windows 11 on Intel/AMD (X86_64 Architecture)
- MacOS on Apple Silicon (ARM64 Architecture)).
About Apple
Although the project will build a self-signed installer, we will not distribute the appication through the Apple Store and therefore, will not pay for a code-signing certificate. If your system will not permit installation without a signed application, you will need to build it yourself.
These are 64-bit application binaries only.
While instructions are provided here to build PTerm on any Linux-like platform, the project will not provide support beyond the two noted above.
Preparation
Gathering and verifying all of the prerequisite tooling, libraries and setting up the Development environment will save time.
- Install Python
- Read about the installation options for wxWidgets.
- Study Build Configurations
- DO NOT use the pre-built binaries.
- Download SDL Release 2.32.4
-
- Download Libsndfile Release 1.22
- Inno Setup (Installer Tool for Windows)
- From the Download Page use the Version 6.4.2 Installer.
Environment Variables Check
It is critical that, after installation of Visual Studio 2022, the following environment variables exist. You may need to reboot in order to ensure their presence:
VS170COMCOMNTOOLS=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools VS170COMNTOOLS=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools
Repository Structure
This tutorial article relies on the the Hobbyist's prior understanding of the tools noted above. Before proceeding, understading the Development repository's structure is also a critical element in generating a successful build.
Install Python
Install Python Minimum version 3.12 using the Recommended Installer .
Ensure that you have the proper version by issuing the following command:
python --version
Python will respond with the following information
Python 3.x.y
Where: x
(minor version) is 12 or greater and y
is the patch level for that minor version
Once installation is complete, you must test the integrated build tool (a Python module called PTDevUtils) by issuing the following command:
set PYTHONUTF8=1 python -m PTDevUtils version
It is recommended that you set that environment variable PYTHONUTF8=1
in your user or system profile
That command should produce the following response if Python was correctly installed:
Package PTDevUtils Command PTDevUtils Version 1.0.1.0
Install InnoSetup
Install InnoSetup (and Studio) using the Recommended Installer .
Library Setup
All wxWidgets
libraries are built “by hand” to ensure that the binaries are all consistent with the soon-to-be-compiled Pterm.
- Referring to the diagram at the top of this article, the “build directories” are presumed to be stored in the Devlibs directory.
- The referenced library's LINK and INCLUDE targets are symlinked 4) into the green libs folder which is the expected location used by the Visual Studio Project. This folder is expected to be at the same relative directory level as (next to) the cloned PTerm7 repository directory.
Structure Matters
All Visual Studio Project references are relative to the cloned repository root, therefore, the placement of the libs
directory is important. Many engineers may not have a deterministic location for their libraries, therefore we use the lib
directory, and the junction links within it, as a means of abstracting away the specifics within the Visual Studio solution file.
wxWidgets
About This Library
This library is manually built because the respective release
and debug
versions of the libraries are linked into the respective release
and debug
executables.
Distribution of applications built on wxWidgets is a notoriously 'finicky' process so to minimize complexity in the Windows build, we use the statically-linked
versions of the libraries.
Setting up wxWidgets on windows is straightforward using the helper cmd file included below. Simply download this file, and drag/drop the wxWidgets-3.2.7
folder onto the .cmd
file and the build should proceed.
This file builds the STATIC and DYNAMIC link versions of the RELEASE and DEBUG versions of the wxWidgets libraries.
This Will Take Time
Between each phase, the test “minimal app” is displayed to ensure that everything is working properly before proceeding to the next steps. The next phase will not continue until the minimal app is closed.
Once the build is complete, create a junction in the libs
directory using MKLINK
:
mklink /j
<PathToYourLibsDirectory>\libs\wxWidgets-3.2.7
<PathToDistribution>\wxWidgets-3.2.7
The link should now be created and confirmed:
Junction created for
<PathToYourLibsDirectory>\libs\wxWidgets-3.2.7 <<===>>
<PathToDistribution>\wxWidgets-3.2.7
libsndfile
Release Libraries Only
This library is used as-supplied and the release
versions of the libraries are linked into both release
and debug
executables.
NOTE: This library's .dll
file is included in the installer.
Unpack the official release from Release 1.2.2 on Github (file libsndfile-1.2.2-win64.zip
)5) into the DevLibs
directory. In this case, we use the project-supplied versions of the files.
Make a link to the distribution in the libs
folder:
mklink /j <PathToLibs>\libs\libsndfile-1.2.2-win64 <PathToDistribution>\libsndfile-1.2.2-win64
SDL2
Release Libraries Only
This library is used as-supplied and the release
versions of the libraries are linked into both release
and debug
executables.
NOTE: This library's .dll
file is included in the installer.
Unpack the official release binaries from Release 2.32.4 on Github (file SDL2-devel-2.32.4-VC.zip
) into the Devlibs
directory. We use the project-supplied versions of the files.
Make a link to the distribution in the libs
folder:
mklink /j <PathToLibs>\libs\SDL2-2.32.4 <PathToDistribution>\SDL2-2.32.4
Next Steps
Part 1 Complete
The development environment should now be fully-functional and ready to build PTerm!