Hi Thomas,
I'm a noob when it comes to Xcode but I was able to follow similar steps to the Cirrus CI steps in your email and build an executable:
$ mkdir build-release
$ cmake -G Xcode -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_CROSSCOMPILING:BOOL=1 ..
$ cmake --build . --config Release -j$(sysctl -n hw.ncpu)
Does the Cirrus CI output any useful jobs that will give us a clue why it failed to create cpudefs.c? As far as I understand it, that should be generated by an earlier part of the build process... right?
(Unfortunately, my build fails because it can't sign my executable - I still have to figure out how to make it sign it with my Apple developer certificate. I also note that the executable that it created it an arm64 binary, not a universal binary, so I still need to figure out how to make a universal binary!)
Troed, I'll be very interested to see your scripts!
Cheers,
Chris
Am Thu, 20 Apr 2023 12:59:11 +0100
schrieb Chris Jenkins <cdpjenkins@xxxxxxxxx>:
> I still have a Mac and would be willing to help out if I can. But I think
> Thomas's suggestion of publishing artefacts from the CI build is probably
> the best option.
I now did some experiment with the Cirrus-CI to use the Monterey-Xcode
environment like this:
macos12_task:
osx_instance:
image: ghcr.io/cirruslabs/macos-monterey-xcode:latest
install_script:
- brew update
- brew install sdl2 libpng make
script:
- export PATH=/usr/local/bin:$PATH
- cmake -G Xcode -DCMAKE_BUILD_TYPE:STRING="Release"
-DCMAKE_CROSSCOMPILING:BOOL=1 .
|| { cat config.log; exit 1; }
- cmake --build . --verbose --config Release -j$(sysctl -n hw..ncpu)
However, the build is then failing with "Build input file cannot be found:
'.../cirrus-ci-build/src/cpu/cpudefs.c'. Did you forget to declare this file
as an output of a script phase or custom build rule which produces it? (in
target 'gencpu' from project 'Hatari'"
How are Apple users compiling with Xcode from the command line?
> I think we could update the macOS CI job in the Cirrus-CI to publish the
> > built binary as CI artifacts there. However, these runners are arm64 only,
> > so I guess that means "good bye" for the x86 support? Or is XCode on ARM
> > still ablte to built binaries for x86, too?
>
> My understanding is that Xcode on Apple Silicon _can_ create x86 binaries
> (or universal binaries) no problem. See for example
> https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
Ok, but then the question is how to configure this via CMake
from the command line?
> Anyway, Troed, could you please sent me the script that you used to compile
> > and create the dmg images? That would be very helpful for extending the CI
> > job...
Having some script that is known to be working already would be very
helpful for getting this running in the Cirrus-CI ... Troed, could you
please send me the list of instructions that you are using in your builds?
Thomas