Possibility to build for M1 Mac


#1

Hello! Recently I’ve managed to cross compile demos for a M1 Mac, using this flag
cmake ..-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64. Everything seems to work just fine.

But I couldn’t edit target architecture cmake file in order to make it work out of the box…


#2

Hey @ancjothur

I don’t have a M1 mac, just intel. I assume you’re working against the package? In that case the target is probably set using one of the build scripts in tools/platform directory.

Maybe you can share the fix that works for M1 chips here: https://github.com/napframework/nap ?


#3

I’ll look into it. When I succeed I make a PR


#4

Great, thanks. I recently bumped the visual studio version to 2019 (coming NAP 0.4.3), which involved setting flags in:

dist/user_scripts/platform/regenerate_project_by_name.py
dist/user_scripts/platform/regenerate_module_by_name.py

and the check build environment script:

build_tools/check_build_environment/macos/check_build_environment


#5

Hello @ancjothur!
Great that you have been looking into this.
We just got a M1 mac mini at work. I tried your approach (passing CMAKE_OSX_ARCHITECTURES=x86_64) to cmake. I could build helloworld with as well as without the flag, however it fails to deserialize enums from the app structure somehow when trying to run.
I am using CLion as build environment.
The generate_solution.sh script does not seem to work as it can’t find the compilers.
Have you not run into any of this?
Thanks! Stijn.


#6

Hello, Stijn!

To make scripts ( ./regenerate, ./create_project, ./package_project) working you can make similar change to this one.

If you use CLion, you also should pass -DCMAKE_OSX_ARCHITECTURES=x86_64 during CMake project loading, and most importantly add additional Release build configuration with such flag (because by default CLion only generates debug configuration, and to be able to work with napkin you need release build)

About compilers, maybe it’s obvious, but you need XCode installed, because all scripts for the MacOS have dependence on xcodebuild command.


#7

Thank you for your reply @ancjothur!
Yes in CLion I managed to succesfully build the helloworld demo, exactly in the way you describe.
However when I run it it fails to deserialize helloworld.json, because all the enum properties are not recognised… Did you not run into that issue?
I guess it’s a compiler version incompatibility, and I will have to debug it.