Goal: build a project in Eclipse, on Windows, that builds binaries for Windows Intel and Linux Arm.

When you create a project, you tell Eclipse what toolchain to use.

In our case, we'll want 2 chains:

GCC compiler for Windows (I'm using Cygwin + GCC)

GCC cross-compiler for Linux Arm (I'm using the Linaro chain)

 

When we use the wizard, we can select only one, so let's:

 

1: start with an Arm Linux project

 

Create the project.

 

Now let's do the first exercises that affects multiple build configurations:

Rename the two configurations to reflect that they represent our Linux builds

 

Then, Go to project properties, and select Internal builder for All configurations

 

 

 

We end up with two executables built: the Debug and Release version for Linux Arm

 

2: Add Windows configurations

Easiest is to import the configurations of an existing Windows project.

Let's create a temporary one, called "deleteme"

Do the same as we did in the previous project. Rename the configurations to show we're making Windows configs.

 

If you want, you can build this one too. Just to check if it works.

 

Then, go back to the Linux project, Manage Configurations

Press the New... button

Name the Windows Debug configuration, and create it from the deleteme > Windows Debug config

Do the same for a new Windows Release config.

 

You'll end like this:

 

That's it for this part: we have a multi-target project now.

Build all configurations:

 

 

Recognise the 4 build directories. Linux debug + release and Windows debug + release.

You can execute the binaries if you want. The windows ones on your development machine. The arm ones on a Pi.

And you can delete the deleteme project now.

 

If you prefer to work with MinGW, this works exactly the same. Select the mingw GCC toolchain.

For both styles, you'll need to distribute some DLLs with your project*.

*MinGW has the possible advantage, if you link your project with the -static flag, that you don't need to distribute GCC DLLs (at the cost of extra 2.52 MB added to the executable file).

 

In the next session, I'll show how to debug both platforms, from that same Eclipse project.

I'll use this project for that exercise. It's attached to this post.

 

related blog
Part 1: preview
Part 2: start multi-target project
Part 3: debug on both platforms
Part 4a: link 3rd party library on Linux ARM
Part 4b: link 3rd party library on Windows