premake / premake-core

Premake

Home Page:https://premake.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

architecture ignored on macOS

bhundt opened this issue · comments

See below or discussion here #2123.

Discussed in #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.