Article Preview
Buy Now
FEATURE
The Tale of Cross-Platform Compilation in Xojo
Building Mac apps from Windows and Linux is back
Issue: 19.6 (November/December 2021)
Author: Geoff Perlman
Author Bio: Geoff Perlman is the founder and CEO of Xojo, Inc., as well as a published author and Xojo developer. Geoff has worked for companies as large as AT&T and as small as a one-man shop and has focused on finding the simplest way to solve complex problems.
Article Description: No description available.
Article Length (in bytes): 7,132
Starting Page Number: 32
Article Number: 19604
Related Link(s): None
Excerpt of article text...
We all experience points in our lives where we have to make important decisions. Sometimes these decisions are obvious and easy. Sometimes they're not. Sometimes the best decision is one that will hurt in the short run, but is going to be far better in the long run. This is the story of one such decision.
The ability to create applications on one OS and build them for another has been a part of our vision for Xojo even before we shipped the first release on July 4th, 1998. Back then, Xojo supported only macOS but we knew that one day we would support Windows and eventually Linux. Over the years, we have added the Web, iOS, and will be adding Android soon, but our roots are certainly on the desktop. Starting in 1999 when we shipped support for Windows, users could build Windows versions of their apps from macOS. Later we brought the IDE to Windows (and eventually Linux) allowing users on those operating systems to build macOS versions of their apps. This continued for many years. Then one day we shipped a new version that no longer supported building apps for macOS from Windows and Linux. What happened?
The Backstory
Before I get to that, there's a little bit of terminology that will require some explanation for some of you. If you're very comfortable with your understanding of
compilers andlinkers , skip the next few paragraphs.When you press Run or Build in the Xojo toolbar, Xojo goes through three phases to complete the process of creating your app. The first phase takes your Xojo code and converts it into something closer to what a CPU itself can understand, but is, at the same time, not specific to any particular CPU. This is called the
frontend of the compiler.Next, the backend of the compiler takes that code and translates it into the machine language for the processor your app needs (Intel or ARM). If you choose Moderate or Aggressive as your Optimization Level (click on Shared under Build Settings in the Navigator and then see Optimization Level in the Inspector—see Figure 1), the compiler backend will then do its best to make the changes to the machine language it created to produce the fastest code it can.
...End of Excerpt. Please purchase the magazine to read the full article.