premake-core
premake-core copied to clipboard
architecture ignored on macOS
See below or discussion here https://github.com/premake/premake-core/discussions/2123.
Discussed in https://github.com/premake/premake-core/discussions/2123
Originally posted by bhundt August 11, 2023 I am working on an M1 Mac running 13.3.1. I want to cross-compile to a target architecture of x86_64 and for that I tried the sample premake project and adapted the premake file as follows:
workspace "HelloWorld"
configurations { "Debug", "Release" }
architecture "x86_64"
project "HelloWorld"
kind "ConsoleApp"
language "C++"
cppdialect "C++20"
targetdir "bin/%{cfg.buildcfg}"
files { "**.hpp", "**.h", "**.cpp" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "Speed"
Unfortunately this creates the default architecture of arm64 which I checked using the lipo -info command.
When I add
buildoptions "-arch x86_64"
linkoptions "-arch x86_64"
then the lipo -info command shows a x86_64 build is generated.
Same happens to me!
It seems that premake is only adding -m64 on ALL_LDDFLAGS but it is also needed the -arch x86_64 on CFLAGS and LDDFLAGS
Same for me.
https://github.com/mercury233/premake-macos-arch-test/blob/main/premake5.lua
This should be resolved with #2502.