#1148 closed defect (fixed)
Problem building Objective-C/C++ with Premake
Reported by: | historic_bruno | Owned by: | ben |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 9 |
Component: | Build & Packages | Keywords: | osx, objectivec, pch |
Cc: | Yves | Patch: |
Description (last modified by )
While working on #1145, I noticed there are problems building Objective-C/C++ code, used for the Cocoa API on OS X. Until now this hasn't been a problem, but I do need to write some Obj-C to solve that ticket. Premake supports Obj-C source files (*.m
, *.mm
) and GCC is capable of compiling them, so I think the problem is how we're using Premake.
The first issue is *.m
and *.mm
files are not being picked up when Premake searches for files to include in the project. That doesn't seem too difficult to fix, I just modified one line of premake4.lua
. The other problem is that the C++ precompiled headers are automatically getting included in the Objective-C source, which is bad, many of the libraries can't be compiled in Obj-C and we don't need them, so we shouldn't even try that. I don't think we'll have enough Obj-C code that we'll need precompiled headers just for them, so maybe we can leave PCH out entirely for Obj-C source files?
I manually edited the Makefile and removed the PCH bits for my one Obj-C source file, everything compiled and ran fine, so we're tantalizingly close to supporting this :)
Change History (4)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|
comment:3 by , 12 years ago
Milestone: | Backlog → Alpha 9 |
---|
Oops, ignore the bit about PCH, I just renamed my
.m
file to.mm
and it gets detected as Objective-C++ and compiles fine (also fixes the warnings about certain flags being C++ specific). So just the trivial change is left, I'll commit it soon :)