gbuild: MSVC: add support for building x64 libraries

The committer wants to state that he has no opinion on the content of
this commit due to total ignorance of the problem area.
This commit is contained in:
Peter Foley 2011-12-18 01:46:03 +01:00 committed by Michael Stahl
parent c439bc7a4a
commit eb2939e190
3 changed files with 22 additions and 7 deletions

View file

@ -120,6 +120,7 @@ $(eval $(foreach method,\
add_asmobject \
add_asmobjects \
add_exception_objects \
add_x64_generated_exception_objects \
add_noexception_objects \
add_generated_cobjects \
add_generated_cxxobjects \
@ -139,6 +140,7 @@ $(eval $(foreach method,\
set_include \
add_ldflags \
set_ldflags \
set_x64 \
add_libs \
set_library_path_flags \
add_api \

View file

@ -416,6 +416,7 @@ $(call gb_LinkTarget_get_headers_target,%) : $(call gb_LinkTarget_get_external_h
# on clean.
# - TARGETTYPE is the type of linktarget as some platforms need very different
# command to link different targettypes.
# - LIBRARY_X64 is only relevent for building a x64 library on windows.
#
# Since most variables are set on the linktarget and not on the object, the
# object learns about these setting via GNU makes scoping of target variables.
@ -465,6 +466,7 @@ $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS :=
$(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS :=
$(call gb_LinkTarget_get_target,$(1)) : LIBS :=
$(call gb_LinkTarget_get_target,$(1)) : TARGETTYPE :=
$(call gb_LinkTarget_get_target,$(1)) : LIBRARY_X64 :=
$(call gb_LinkTarget_get_headers_target,$(1)) \
$(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS :=
@ -489,6 +491,7 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE)
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL)
$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE :=
$(call gb_LinkTarget_get_dep_target,$(1)) : LIBRARY_X64 :=
$(call gb_LinkTarget_get_dep_target,$(1)) : EXTRAOBJECTLISTS :=
endif
@ -869,6 +872,12 @@ define gb_LinkTarget_add_exception_objects
$(foreach obj,$(2),$(call gb_LinkTarget_add_exception_object,$(1),$(obj)))
endef
#only useful for building x64 libraries on windows
define gb_LinkTarget_add_x64_generated_exception_objects
$(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj)))
$(foreach obj,$(2),$(eval $(call gb_GenCxxObject_get_target,$(obj)) : CXXOBJECT_X64 := YES))
endef
define gb_LinkTarget_add_generated_cobjects
$(foreach obj,$(2),$(call gb_LinkTarget_add_generated_c_object,$(1),$(obj),$(3)))
endef
@ -890,6 +899,11 @@ $(call gb_LinkTarget_get_target,$(1)) \
$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE := $(2)
endef
define gb_LinkTarget_set_x64
$(call gb_LinkTarget_get_target,$(1)) \
$(call gb_LinkTarget_get_dep_target,$(1)) : LIBRARY_X64 := $(2)
endef
define gb_LinkTarget_set_dlltarget
$(call gb_LinkTarget_get_clean_target,$(1)) \
$(call gb_LinkTarget_get_target,$(1)) : DLLTARGET := $(2)

View file

@ -75,9 +75,7 @@ gb_RCDEFS := \
gb_RCFLAGS := \
-V
# FIXME: When porting to Windows64, we should use only:
# /c /Cp
gb_AFLAGS := /c /Cp /coff /safeseh
gb_AFLAGS := /c /Cp
gb_CFLAGS := \
-Gd \
@ -207,7 +205,6 @@ gb_LinkTarget_NOEXCEPTIONFLAGS := \
-DEXCEPTIONS_OFF \
gb_LinkTarget_LDFLAGS := \
-MACHINE:IX86 \
-MANIFEST \
$(patsubst %,-LIBPATH:%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \
@ -302,13 +299,14 @@ define gb_CxxObject__command
$(call gb_Output_announce,$(2),$(true),CXX,3)
$(call gb_Helper_abbreviate_dirs_native,\
mkdir -p $(dir $(1)) $(dir $(4)) && \
$(gb_CXX) \
$(if $(filter YES,$(CXXOBJECT_X64)), $(CXX_X64_BINARY), $(gb_CXX)) \
$(DEFS) \
$(T_CXXFLAGS) \
-Fd$(PDBFILE) \
$(gb_COMPILERDEPFLAGS) \
-I$(realpath $(dir $(3))) \
$(INCLUDE_STL) $(INCLUDE) \
$(if $(filter YES,$(CXXOBJECT_X64)), -U_X86_ -D_AMD64_,) \
-c $(realpath $(3)) \
-Fo$(1)) $(call gb_create_deps,$(1),$(4),$(realpath $(3)))
endef
@ -353,11 +351,13 @@ $(call gb_Helper_abbreviate_dirs_native,\
$(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \
$(NATIVERES))) && \
$(gb_LINK) \
$(if $(filter YES,$(LIBRARY_X64)), $(LINK_X64_BINARY), $(gb_LINK)) \
$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
$(if $(filter StaticLibrary,$(TARGETTYPE)),$(gb_StaticLibrary_TARGETTYPEFLAGS)) \
$(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \
$(if $(filter YES,$(TARGETGUI)), -SUBSYSTEM:WINDOWS, -SUBSYSTEM:CONSOLE) \
$(if $(filter YES,$(LIBRARY_X64)), -MACHINE:X64, -MACHINE:IX86) \
$(if $(filter YES,$(LIBRARY_X64)), -LIBPATH:$(COMPATH)/lib/amd64 -LIBPATH:$(WINDOWS_SDK_HOME)/lib/x64,) \
$(T_LDFLAGS) \
$(if $(gb_PRODUCT),,-NODEFAULTLIB) \
@$${RESPONSEFILE} \
@ -377,7 +377,6 @@ gb_Windows_PE_TARGETTYPEFLAGS := \
-opt:noref \
-incremental:no \
-debug \
-safeseh \
-nxcompat \
-dynamicbase \