Use libtool instead of ar for universal static libraries

This commit is contained in:
starkos 2009-07-13 18:34:26 +00:00
parent a626ff907d
commit adcf73c757
3 changed files with 38 additions and 2 deletions

View File

@ -9,6 +9,7 @@
4.1.1 (in progress)
-------
- Use libtool instead of ar for Mac OS X Universal static libraries
- Fixed Xbox 360 linker settings in Visual Studio
- Bug 2813297: OS X universal config should be "univ" (William Burnson)
- Bug 2814179: Xbox 360 precompiled headers not working

View File

@ -213,7 +213,11 @@
_p(' LDDEPS += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "siblings", "fullpath")), " "))
if cfg.kind == "StaticLib" then
_p(' LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)')
if cfg.platform:startswith("Universal") then
_p(' LINKCMD = libtool -o $(TARGET) $(OBJECTS)')
else
_p(' LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)')
end
else
_p(' LINKCMD = $(%s) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS)', iif(cfg.language == "C", "CC", "CXX"))
end

View File

@ -132,7 +132,6 @@ endif
end
function T.gmake_cpp.PlatformSpecificBlock()
platforms { "x64" }
prepare()
@ -162,3 +161,35 @@ ifeq ($(config),debug64)
endif
]]
end
function T.gmake_cpp.UniversalStaticLibBlock()
kind "StaticLib"
platforms { "universal32" }
prepare()
local cfg = premake.getconfig(prj, "Debug", "Universal32")
premake.gmake_cpp_config(cfg, premake.gcc)
test.capture [[
ifeq ($(config),debuguniv32)
OBJDIR = obj/Universal32/Debug
TARGETDIR = .
TARGET = $(TARGETDIR)/libMyProject.a
DEFINES +=
INCLUDES +=
CPPFLAGS += $(DEFINES) $(INCLUDES)
CFLAGS += $(CPPFLAGS) $(ARCH) -arch i386 -arch ppc
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s -arch i386 -arch ppc
LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
LDDEPS +=
LINKCMD = libtool -o $(TARGET) $(OBJECTS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
endif
]]
end