Skip to main content

UxPlay, an app that can be used for sharing you iPhone screen on PC or Mac, recently released a new version. In this article, we'll walk you through the process of compiling UxPlay for Windows and creating a standalone build. By following these steps, you'll be able to copy the build to another PC or share it with a friend. Note that in writing this article, we followed build instructions from the project's Readme file. So, let's dive into the guide!

Step 1: Installing the Bonjour Service Dev Kit

Before we begin the compilation process, ensure that the Bonjour Service Dev Kit is installed in the default location (C:\Program Files\Bonjour). If it's located elsewhere, make note of the folder as we'll need this information later. The dev kit can be downloaded from Apple's web site.

Step 2: Setting Up the Msys2 Environment 

To build the UxPlay project, we'll need the Msys2 environment. While it's being installed, you can download the UxPlay release you wish to compile and extract it to a suitable folder.

Step 3: Initial Setup in the Mingw64 Terminal

Once Msys2 installation is complete, open the Mingw64 terminal. Start by updating the packages using the command pacman -Syu. If needed, restart the terminal after this step. Next, install cmake and MinGW-64.   
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc

Step 4: Navigating to the Source Code

Copy the path where you extracted the UxPlay source code. Remember that the MSYS terminal uses forward slashes instead of backslashes for Windows paths. This step will help us navigate to the source code folder easily in the terminal.   
cd C:/path/to/project

Step 5: Obtaining UxPlay Dependencies 

Use pacman to get the dependencies:  
pacman -S mingw-w64-x86_64-libplist mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base

Step 6: Building

Create a build folder and navigate to it in the terminal. If Bonjour SDK is not installed in C:\Program Files, set the BONJOUR_SDK_HOME variable to the correct location. For example, 
$ export BONJOUR_SDK_HOME="D:\Program Files\Bonjour SDK"

We'll use cmake and ninja to generate the build files and build the project.

mkdir build 
cd build 
cmake .. 
ninja
Step 7: Installing GStreamer Plugins

To ensure UxPlay functions smoothly, we need to install some GStreamer plugins, specifically. libav, 'good,' and 'bad' plugins.   
pacman -S mingw-w64-x86_64-gst-libav mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad

Once the installation is complete, run UxPlay from the terminal to verify its functionality.

Step 8: Creating a Standalone Build

If you want to create a standalone build, follow this step. Copy the contents of the /bin and /lib folders from the Msys2 installation to the corresponding locations in your build folder. You can put the contents of the /bin folder to the same directory where uxplay.exe is located, and the contents of the /lib folder to the /lib folder in your build folder. This will ensure that all necessary files are included. You can later try deleting libraries not used by UxPlay to save disk space, but this is not required.

Step 9: Organizing the Build and Creating a Shortcut 

To make distribution easier, move the build folder to a separate location. Additionally, we like to create a shortcut that launches UxPlay from the terminal and uses parameters defined in a file called config.txt. For example, if the shortcut is going to be in the parent directory of your build folder, this can be done by creating a new Windows shortcut and setting the target to:  
%COMSPEC% /C set UXPLAYRC=config.txt & .\build\uxplay.exe   
while leaving the "start in" field empty.

Step 10: Finalizing the Build

After completing the above steps, you can safely delete the MSYS environment if you won't be using it for other projects. Your UxPlay application is now capable of running independently.

Step 11: Sharing the Build

If you plan to share the build with others, don't forget to provide them with access to the source code as well. This will allow others to explore and enjoy the software to its fullest.

Conclusion 

Congratulations! You've successfully compiled UxPlay for Windows and created a standalone build. If you encounter any issues or have further questions, don't hesitate to seek assistance and share your experiences. Happy compiling!