premake-core icon indicating copy to clipboard operation
premake-core copied to clipboard

Create MacOS and iOS configurations in one project

Open redorav opened this issue 6 years ago • 2 comments

What's your question? I'm trying to create an xcodeworkspace that contains both a project for macos, and for ios. I'm using Alpha14 for this purpose.

Anything else we should know? The way I typically do it on Windows is e.g.

configurations { "Debug", "Release" }
platforms { "MSVC32", "MSVC64" }

and then I can filter based on that. What I'm trying at the moment and failing is

configurations { "Debug", "Release" }
platforms { "MacOS64", "IOS64" }

filter { "platforms:MacOS64" }
    system("macosx")

filter { "platforms:IOS64" }
    system("ios")

However this doesn't create two distinct configurations, so I'm clearly doing something wrong. I have got the MacOS working though, it's just ios that I'm struggling with.

Thanks!

UPDATE: I recompiled premake with latest code and I still can't get it working. I also tried the --os=ios flag and this does show the multiple ios devices so it's clearly doing something different. I still cannot get it to work in the way I'd like though.

Through further experimentation I've been able to figure out that setting _TARGET_OS="ios" seems to make it tick. I don't think this is the right solution, correct me if I'm wrong but that sets it regardless of the filter? I can see that _OPTIONS.os also doesn't accept "ios" as a value but does accept macosx. At this point I'm quite lost as to what to do.

redorav avatar Nov 30 '19 12:11 redorav

Unfortunately I do not have an answer to solve your problem. The best solution we have come up with here at work is to keep different workspaces for the two platforms. If you or someone else has been able to manage both systems in one workspace I would be quite interested to know how that is done.

We use the --os=ios command line flag when running premake, and the following overrides to append _ios on all generated files:

	premake.override(_G, "project", function(base, ...)
		local rval = base(...)
		local args = {...}
		filter "system:ios"
			filename(args[1] .. "_ios")
		filter {}
		return rval
	end)

	premake.override(_G, "workspace", function(base, ...)
		local rval = base(...)
		local args = {...}
		filter "system:ios"
			filename(args[1] .. "_ios")
		filter {}
		return rval
	end)

ratzlaff avatar Dec 11 '19 14:12 ratzlaff

I'm currently banging my head against this particular brick wall at the moment. I only have macOS working right now, and even that's a bit sketchy - all outputs have iOS in their names (some coming from cfg.platform in my script) for some unfathomable reason. Is it because I'm running on an Arm based Mac and Premake is hardcoded to assume MacOS + Arm = iOS?

crazydef avatar Apr 24 '23 18:04 crazydef