User Tools

Site Tools


plato:pterm7:windows.part.1

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.

  1. Install Visual Studio 2022 2)
  2. Install Python
  3. Read about the installation options for wxWidgets.
    1. Study Build Configurations
    2. DO NOT use the pre-built binaries.
    3. Download the Latest Stable Release3)
  4. Download SDL Release 2.32.4
  5. Inno Setup (Installer Tool for Windows)

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.

Folder PATH diagram for Development Environment ?:\MyDevelopmentRoot +---libs (Build Libraries) ¦ +---libsndfile-1.2.2-win64 ¦ +---SDL2-2.32.4 ¦ +---wxWidgets-3.2.7 +---Pterm7 +---.idea (PyCharm Directory) +---.venv (Python Virtual Environment) ¦ +---Lib ¦ +---Scripts +---assets (PTerm Assets) +---bin ¦ +---pterm (Linux App Binary) ¦ +---Pterm.app (MacOS Application) +---docs (Application Documentation) +---i18n (Unused) ¦ +---nl +---installers (Windows Installers) +---IST-loadfiles (PyCharm Directory) +---microTUTOR (Disk Images and Documentation) +---obj (Compiler Objects Directory non-windows) +---prototypes (Templates for various builds) +---PTDevUtils (Application Build Utilities) +---pterm.codeblocks +---Pterm.pmdoc (Pterm[6] Package Management MacOS) +---Pterm7.MacOS (Pterm[7] Package Management MacOS) +---redist (Application Redistributables) ¦ +---MtutorFloppys +---setools (Software Engineering Tools) +---src (Application Source) +---tests (Automated Tests) +---Win32 (Windows 32-bit Binaries) ¦ +---Debug ¦ ¦ +---PTerm7 ¦ +---Release ¦ +---PTerm7 +---wxFormBuilder (Designer Files) +---x64 (Windows 64-bit Binaries) +---Debug ¦ +---PTerm7 +---Release +---PTerm7

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

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.

Build_wxWidgets_vc_X64

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!

Windows - Building PTerm (Part 2)

1)
Currently Version 7
2)
As of this writing.
3)
Version 3.2.7 as of this writing.
4)
Using the mklink command
5)
Build date 2023-08-13
plato/pterm7/windows.part.1.txt · Last modified: 2025/04/13 13:31 by Site Administrator