Jeffajam
Posts: 7
Joined: Wed Mar 18, 2015 11:08 pm
Location: Birmingham, England

Trigger RPi Build From macOS Xcode

Fri Dec 08, 2017 12:38 am

I am currently working on a C++ project on my mac and it is a bit of a pain to copy the files to the RPi and manually build it each time to test it. Would there be a way to run a build on the Raspberry Pi build after pressing build from Xcode?

W. H. Heydt
Posts: 7614
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Trigger RPi Build From macOS Xcode

Fri Dec 08, 2017 5:32 am

Only if xcode will cross-compile for ARM processors. Really...it should be trivial to copy your source code to the Pi and have a makefile ready to go to build your object code.

Heater
Posts: 8086
Joined: Tue Jul 17, 2012 3:02 pm

Re: Trigger RPi Build From macOS Xcode

Fri Dec 08, 2017 6:03 am

My approach to this is to use git as a source code repository. Then I can develop code (edit, compile, test) on any machine, when it looks about right I check in my changes to git, then I can go to the Pi and "git pull" the new version and build it, with make, cmake, qmake, whatever.

Using a service like github or bitbucket makes this very easy. Or if you don't like to use those you can always run a git repository locally. Perhaps even on a Pi itself.

This is not just about the Pi for me. It applies to code intended to run on cloud servers or other places.

Of course one cannot test code that relies on Pi features, GPIO etc, on a Mac or PC, but that is what "mocks" and "stubs" are for, you just link in dummy versions of those interfaces that simulate some of the real interface behavior. This is a good way to go as it encourages unit testing.

Using git is very easy, mostly you end up using a few simple commands:
$ git pull
$ git add somefile
$ git commit -m "Fixed bug XXX"
$ git push

Or all of that is integrated into a decent IDE. Like Microsoft Visual Studio Code. I guess Xcode as well.

Using git has many advantages, even for small one man projects. No more saving multiple old versions of file around the place. You always know what version of what is running where. You can easily revert back to an old working version if you make a mess. And so on.

If none of that appeals, which it should, you could just set up a SAMBA share on the Pi and work on the files directly from the Mac/PC.

On the the other hand, why not just develop code for the Pi on the Pi itself?

Return to “General discussion”

Who is online

Users browsing this forum: asandford, danielp14 and 49 guests