Added support for Objective-C and Objective-C++ in xcode and gmake2
- Added unit tests for Objective-C and Objective-C++
This commit is contained in:
parent
c4f36032cc
commit
a4bba42013
@ -164,9 +164,9 @@
|
|||||||
function cpp.compileas(prj, node)
|
function cpp.compileas(prj, node)
|
||||||
local result
|
local result
|
||||||
if node["compileas"] then
|
if node["compileas"] then
|
||||||
if p.languages.isc(node.compileas) then
|
if p.languages.isc(node.compileas) or node.compileas == p.OBJECTIVEC then
|
||||||
result = '$(CC) $(ALL_CFLAGS)'
|
result = '$(CC) $(ALL_CFLAGS)'
|
||||||
elseif p.languages.iscpp(node.compileas) then
|
elseif p.languages.iscpp(node.compileas) or node.compileas == p.OBJECTIVECPP then
|
||||||
result = '$(CXX) $(ALL_CXXFLAGS)'
|
result = '$(CXX) $(ALL_CXXFLAGS)'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -90,3 +90,21 @@ PERFILE_FLAGS_2 = $(ALL_CFLAGS) -msse -msse2 -mfpmath=sse,387 -msse3 -mssse3 -ms
|
|||||||
PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -fvisibility=protected
|
PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -fvisibility=protected
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function suite.perfile_compileas()
|
||||||
|
files { 'a.c', 'b.cpp' }
|
||||||
|
|
||||||
|
filter { 'files:a.c' }
|
||||||
|
compileas "Objective-C"
|
||||||
|
filter { 'files:b.cpp' }
|
||||||
|
compileas "Objective-C++"
|
||||||
|
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
# Per File Configurations
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
PERFILE_FLAGS_0 = $(ALL_CFLAGS) -x objective-c
|
||||||
|
PERFILE_FLAGS_1 = $(ALL_CXXFLAGS) -x objective-c++
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
@ -298,15 +298,21 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
function suite.PBXFileReference_ListsSourceFilesCompileAs()
|
function suite.PBXFileReference_ListsSourceFilesCompileAs()
|
||||||
files { "source.c" }
|
files { "source.c", "objsource.c", "objsource.cpp" }
|
||||||
filter { "files:source.c" }
|
filter { "files:source.c" }
|
||||||
compileas "C++"
|
compileas "C++"
|
||||||
|
filter { "files:objsource.c" }
|
||||||
|
compileas "Objective-C"
|
||||||
|
filter { "files:objsource.cpp" }
|
||||||
|
compileas "Objective-C++"
|
||||||
prepare()
|
prepare()
|
||||||
xcode.PBXFileReference(tr)
|
xcode.PBXFileReference(tr)
|
||||||
test.capture [[
|
test.capture [[
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
19A5C4E61D1697189E833B26 /* MyProject */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = MyProject; path = MyProject; sourceTree = BUILT_PRODUCTS_DIR; };
|
19A5C4E61D1697189E833B26 /* MyProject */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = MyProject; path = MyProject; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
7DC6D30C8137A53E02A4494C /* source.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = source.c; path = source.c; sourceTree = "<group>"; };
|
7DC6D30C8137A53E02A4494C /* source.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = source.c; path = source.c; sourceTree = "<group>"; };
|
||||||
|
C8C6CC62F1018514D89D12A2 /* objsource.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; name = objsource.cpp; path = objsource.cpp; sourceTree = "<group>"; };
|
||||||
|
E4BF12E20AE5429471EC3922 /* objsource.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; name = objsource.c; path = objsource.c; sourceTree = "<group>"; };
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,9 +106,9 @@
|
|||||||
return "sourcecode.c.c"
|
return "sourcecode.c.c"
|
||||||
elseif p.languages.iscpp(filecfg.compileas) then
|
elseif p.languages.iscpp(filecfg.compileas) then
|
||||||
return "sourcecode.cpp.cpp"
|
return "sourcecode.cpp.cpp"
|
||||||
elseif filecfg.language == "ObjC" then
|
elseif filecfg.compileas == p.OBJECTIVEC then
|
||||||
return "sourcecode.c.objc"
|
return "sourcecode.c.objc"
|
||||||
elseif filecfg.language == "ObjCpp" then
|
elseif filecfg.compileas == p.OBJECTIVECPP then
|
||||||
return "sourcecode.cpp.objcpp"
|
return "sourcecode.cpp.objcpp"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -182,6 +182,8 @@
|
|||||||
"Default",
|
"Default",
|
||||||
"C",
|
"C",
|
||||||
"C++",
|
"C++",
|
||||||
|
"Objective-C",
|
||||||
|
"Objective-C++",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
premake.MBCS = "MBCS"
|
premake.MBCS = "MBCS"
|
||||||
premake.NONE = "None"
|
premake.NONE = "None"
|
||||||
premake.DEFAULT = "Default"
|
premake.DEFAULT = "Default"
|
||||||
|
premake.OBJECTIVEC = "Objective-C"
|
||||||
|
premake.OBJECTIVECPP = "Objective-C++"
|
||||||
premake.ON = "On"
|
premake.ON = "On"
|
||||||
premake.OFF = "Off"
|
premake.OFF = "Off"
|
||||||
premake.POSIX = "posix"
|
premake.POSIX = "posix"
|
||||||
|
@ -63,7 +63,8 @@
|
|||||||
warnings = gcc.shared.warnings,
|
warnings = gcc.shared.warnings,
|
||||||
symbols = gcc.shared.symbols,
|
symbols = gcc.shared.symbols,
|
||||||
unsignedchar = gcc.shared.unsignedchar,
|
unsignedchar = gcc.shared.unsignedchar,
|
||||||
omitframepointer = gcc.shared.omitframepointer
|
omitframepointer = gcc.shared.omitframepointer,
|
||||||
|
compileas = gcc.shared.compileas
|
||||||
}
|
}
|
||||||
|
|
||||||
clang.cflags = table.merge(gcc.cflags, {
|
clang.cflags = table.merge(gcc.cflags, {
|
||||||
|
@ -121,6 +121,10 @@
|
|||||||
omitframepointer = {
|
omitframepointer = {
|
||||||
On = "-fomit-frame-pointer",
|
On = "-fomit-frame-pointer",
|
||||||
Off = "-fno-omit-frame-pointer"
|
Off = "-fno-omit-frame-pointer"
|
||||||
|
},
|
||||||
|
compileas = {
|
||||||
|
["Objective-C"] = "-x objective-c",
|
||||||
|
["Objective-C++"] = "-x objective-c++",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user