Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Per-File C/C++/ObjC Compiler Settings #27

Open
DavidLudwig opened this issue Jun 10, 2016 · 3 comments
Open

Per-File C/C++/ObjC Compiler Settings #27

DavidLudwig opened this issue Jun 10, 2016 · 3 comments

Comments

@DavidLudwig
Copy link

Hi. I'm just getting started with premake. I've been able to get pretty far in having it build a large, custom library, but am having issues getting it to compile some files with Objective-C ARC, and some without.

Using either a precompiled OSX binary of premake5 alpha 9, or a custom OSX build from a 'git clone' of 1d817779dff730ca1d39e496b3f8d182f863f3a4, attempting to add per-file compiler settings (to selectively enable, or disable, Objective-C ARC), such as through the following filter, doesn't seem to work:

filter "files:src/Foo.m"
    buildoptions { "-fobjc-arc" }

I'm not sure if this is the correct, premake5.lua syntax for doing per-file compiler settings, however, I did take a look through the Xcode plugin's source, and at a glance, it doesn't look like it has support to add the .xcodeproj text, 'settings = { COMPILER_FLAGS = "whatnot"; };', for specific files (via xcode.PBXBuildFile(tr), in premake-xcode's xcode_common.lua).

Cheers!
-- David L.

@starkos
Copy link
Member

starkos commented Jun 10, 2016

I don't believe per-file settings has made it into the Xcode exporter yet. The Visual Studio exporter does support it, and could be used as a reference (though this is an area that I am actively working to simplify now, it could took a little while before I can get it done).

@DavidLudwig
Copy link
Author

Might you have any recommendations for areas within the VS exporter, such as source-files + lines, that I could look at, to get an idea of how to work with premake5.lua file-data? I'm especially curious how to get 'buildoptions' data, given a file-to-build.

I started an attempt to put a patch together to add support for Xcode, and was able to put 'settings = {}' blocks into each PBXBuildFile block, but only by hard-coding some stuff into the nodes created by 'function xcode.buildprjtree(prj)' (in xcode_project.lua).

@starkos
Copy link
Member

starkos commented Jun 14, 2016

Might you have any recommendations for areas within the VS exporter, such as source-files + lines

Sorry, off the top of my head no, but if you search for "buildoptions" in the VS exporter you should be able to find it.

That said, the structure of the Xcode exporter is very different from VS (and everything else). Seemed like a good idea at the time; wish I hadn't done it that way now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants