diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-20 16:28:06 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-21 10:18:58 +0000 |
commit | 0a99b5a1b7325454fe3d1174d44354888aa22012 (patch) | |
tree | 9edc1d3cca42c07ae4767ad7ca3b150895ac5295 /solenv/gbuild | |
parent | 0649622956431e0a1955cb80d1175025401ab5e5 (diff) |
When building with clang-cl on Windows, build CLR code with MSVC
...as clang-cl doesn't support the /clr switch.
* In configure.ac, capture the MSCV version (that would be used if CC hadn't
been overridden to use clang-cl) into MSVC_CXX.
* The logic which flags to pass into gb_CObject__command_pattern is coded into
the platform-agnostic LinkTarget.mk, so it's too late to try and filter all
relevant flags in com_GCC_class.mk, depending on whether a given .cxx file is
a normal one built with the normal $CXX or a special /clr one built with
$MSVC_CXX. Thus, a new CxxClrObject class had to be introduced that captures
this information early.
* When building with clang-cl, the generated config_host/config_*.h files
contain values suitable for clang-cl, but not for MSVC. But the .cxx files
compiled with MSVC happen to include config_global.h, and would fail. Hack
around that problem for now by introducing a hard-coded, minimal
solenv/clang-cl/config_global.h that is found first when buliding such a
CxxClrObject. Needs cleaning-up properly.
Change-Id: Iff8aac51c0b4fa906b14503c692640dda0996d33
Reviewed-on: https://gerrit.libreoffice.org/34509
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'solenv/gbuild')
-rw-r--r-- | solenv/gbuild/CompilerTest.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/CppunitTest.mk | 3 | ||||
-rw-r--r-- | solenv/gbuild/Executable.mk | 3 | ||||
-rw-r--r-- | solenv/gbuild/Library.mk | 3 | ||||
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 91 | ||||
-rw-r--r-- | solenv/gbuild/StaticLibrary.mk | 3 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/extensions/post_GbuildToJson.mk | 7 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_MSC_class.mk | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | solenv/gbuild/platform/com_MSC_defs.mk | 57 |
10 files changed, 154 insertions, 27 deletions
diff --git a/solenv/gbuild/CompilerTest.mk b/solenv/gbuild/CompilerTest.mk index 4178b51a59d2..a495cf368dda 100644 --- a/solenv/gbuild/CompilerTest.mk +++ b/solenv/gbuild/CompilerTest.mk @@ -40,6 +40,8 @@ $(eval $(foreach method, \ add_objcobjects \ add_objcxxobject \ add_objcxxobjects \ + add_cxxclrobject \ + add_cxxclrobjects \ use_udk_api \ , \ $(call gb_CompilerTest__forward_to_Linktarget,$(method)) \ diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index a916e49ca76a..23ea06ad5f85 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -423,6 +423,8 @@ $(eval $(foreach method,\ add_objcobjects \ add_objcxxobject \ add_objcxxobjects \ + add_cxxclrobject \ + add_cxxclrobjects \ add_asmobject \ add_asmobjects \ use_package \ @@ -435,6 +437,7 @@ $(eval $(foreach method,\ set_yaccflags \ add_objcflags \ add_objcxxflags \ + add_cxxclrflags \ add_defs \ set_include \ add_ldflags \ diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk index cef95d554205..afe4ddf51c47 100644 --- a/solenv/gbuild/Executable.mk +++ b/solenv/gbuild/Executable.mk @@ -99,6 +99,8 @@ $(eval $(foreach method,\ add_objcobjects \ add_objcxxobject \ add_objcxxobjects \ + add_cxxclrobject \ + add_cxxclrobjects \ add_grammar \ add_grammars \ add_scanner \ @@ -111,6 +113,7 @@ $(eval $(foreach method,\ add_cxxflags \ add_objcflags \ add_objcxxflags \ + add_cxxclrflags \ add_defs \ set_include \ add_ldflags \ diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index 8042f3357010..18640d6437d4 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -175,6 +175,8 @@ $(eval $(foreach method,\ add_objcobjects \ add_objcxxobject \ add_objcxxobjects \ + add_cxxclrobject \ + add_cxxclrobjects \ add_asmobject \ add_asmobjects \ add_exception_objects \ @@ -191,6 +193,7 @@ $(eval $(foreach method,\ add_cxxflags \ add_objcxxflags \ add_objcflags \ + add_cxxclrflags \ add_defs \ set_include \ add_ldflags \ diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index ca1f5ad7c42a..5d192df299cb 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -60,6 +60,7 @@ gb_LinkTarget__get_cflags=$(if $(CFLAGS),$(CFLAGS),$(call gb_LinkTarget__get_deb gb_LinkTarget__get_objcflags=$(if $(OBJCFLAGS),$(OBJCFLAGS),$(call gb_LinkTarget__get_debugcflags,$(1))) gb_LinkTarget__get_cxxflags=$(if $(CXXFLAGS),$(CXXFLAGS),$(call gb_LinkTarget__get_debugcxxflags,$(1))) gb_LinkTarget__get_objcxxflags=$(if $(OBJCXXFLAGS),$(OBJCXXFLAGS),$(call gb_LinkTarget__get_debugcxxflags,$(1))) +gb_LinkTarget__get_cxxclrflags=$(call gb_LinkTarget__get_debugcxxflags,$(1)) # call gb_LinkTarget__get_ldflags,linktargetmakefilename gb_LinkTarget__get_ldflags=$(if $(LDFLAGS),$(LDFLAGS),$(call gb_LinkTarget__get_debugldflags,$(1))) @@ -150,14 +151,31 @@ $(call gb_Helper_abbreviate_dirs,\ $(INCLUDE) \ ) endef +define gb_CxxClrObject__tool_command +$(call gb_Output_announce,$(1).cxx,$(true),CLR,3) +$(call gb_Helper_abbreviate_dirs,\ + ICECC=no CCACHE_DISABLE=1 \ + $(gb_CXX) \ + $(DEFS) \ + $(gb_LTOFLAGS) \ + $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \ + $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \ + $(gb_COMPILER_PLUGINS) \ + $(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND) \ + $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \ + -c $(2) \ + -I$(dir $(2)) \ + $(INCLUDE) \ + ) +endef # Overview of dependencies and tasks of LinkTarget # # target task depends on -# LinkTarget linking AsmObject CObject CxxObject GenCObject GenCxxObject ObjCObject ObjCxxObject +# LinkTarget linking AsmObject CObject CxxObject GenCObject GenCxxObject ObjCObject ObjCxxObject CxxClrObject # LinkTarget/headers -# LinkTarget/dep joined dep file AsmObject/dep CObject/dep CxxObject/dep GenCObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep +# LinkTarget/dep joined dep file AsmObject/dep CObject/dep CxxObject/dep GenCObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep CxxClrObject/dep # | LinkTarget/headers # LinkTarget/headers all headers available # including own generated @@ -170,6 +188,7 @@ endef # generated source # ObjCObject objective c compile | LinkTarget/headers # ObjCxxObject objective c++ compile | LinkTarget/headers +# CxxClrObject C++ CLR compile | LinkTarget/headers # # AsmObject asm compile | LinkTarget # @@ -179,6 +198,7 @@ endef # GenCxxObject/dep dependencies # ObjCObject/dep dependencies # ObjCxxObject/dep dependencies +# CxxClrObject/dep dependencies # AsmObject/dep dependencies # LinkTarget/headers means gb_LinkTarget_get_headers_target etc. @@ -443,6 +463,33 @@ $(call gb_ObjCObject_get_dep_target,%) : endif +# CxxClrObject class +# + +gb_CxxClrObject_get_source = $(1)/$(2).cxx + +ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),) +$(call gb_CxxClrObject_get_target,%) : $(call gb_CxxClrObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET) + $(call gb_CxxClrObject__tool_command,$*,$<) +else +$(call gb_CxxClrObject_get_target,%) : $(call gb_CxxClrObject_get_source,$(SRCDIR),%) + $(call gb_Output_announce,$*.cxx,$(true),$(if $(COMPILER_TEST),C?R,CLR),3) + $(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND),$<,$(call gb_CxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS)) +endif + +ifeq ($(gb_FULLDEPS),$(true)) +$(dir $(call gb_CxxClrObject_get_dep_target,%)).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(dir $(call gb_CxxClrObject_get_dep_target,%))%/.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(call gb_CxxClrObject_get_dep_target,%) : + $(if $(wildcard $@),touch $@) + +endif + + # AsmObject class $(call gb_AsmObject_get_target,%) : $(call gb_AsmObject_get_source,$(SRCDIR),%) @@ -477,6 +524,8 @@ $(WORKDIR)/Clean/LinkTarget/% : $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object))) \ $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object))) \ + $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \ + $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_dep_target,$(object))) \ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object))) \ $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ @@ -504,6 +553,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \ $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object)))\ $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object)))\ + $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_dep_target,$(object)))\ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object)))\ $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dep_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \ @@ -520,6 +570,7 @@ TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \ $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ + $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ @@ -658,6 +709,8 @@ $(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS := $(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS := $(call gb_LinkTarget_get_clean_target,$(1)) \ +$(call gb_LinkTarget_get_target,$(1)) : CXXCLROBJECTS := +$(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : ASMOBJECTS := $(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS := @@ -672,6 +725,8 @@ $(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXX $(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS_APPEND := $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS) $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS_APPEND := +$(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS := $$(gb_LinkTarget_CXXCLRFLAGS) +$(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS_APPEND := $(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) $(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) $(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE) @@ -706,6 +761,7 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS := +$(call gb_LinkTarget_get_dep_target,$(1)) : CXXCLROBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : ASMOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS := @@ -754,6 +810,11 @@ $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS_APPEND += $(2) endef +# call gb_LinkTarget_add_cxxclrflags,linktarget,cxxclrflags +define gb_LinkTarget_add_cxxclrflags +$(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS_APPEND += $(2) +endef + # call gb_LinkTarget__add_include,linktarget,includes define gb_LinkTarget__add_include $(call gb_LinkTarget_get_target,$(1)) : INCLUDE += -I$(2) @@ -1070,6 +1131,27 @@ endif endef +# call gb_LinkTarget_add_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename +define gb_LinkTarget_add_cxxclrobject +$(if $(wildcard $(call gb_CxxClrObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_CxxClrObject_get_source,$(SRCDIR),$(2))))) +$(call gb_LinkTarget_get_target,$(1)) : CXXCLROBJECTS += $(2) +$(call gb_LinkTarget_get_clean_target,$(1)) : CXXCLROBJECTS += $(2) + +$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxClrObject_get_target,$(2)) +$(call gb_CxxClrObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) +$(call gb_CxxClrObject_get_target,$(2)) : T_CXXCLRFLAGS += $(call gb_LinkTarget__get_cxxclrflags,$(4)) $(3) +$(call gb_CxxClrObject_get_target,$(2)) : \ + OBJECTOWNER := $(call gb_Object__owner,$(2),$(1)) + +ifeq ($(gb_FULLDEPS),$(true)) +$(call gb_LinkTarget_get_dep_target,$(1)) : CXXCLROBJECTS += $(2) +$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxClrObject_get_dep_target,$(2)) +$(call gb_CxxClrObject_get_dep_target,$(2)) :| $(dir $(call gb_CxxClrObject_get_dep_target,$(2))).dir +$(call gb_CxxClrObject_get_target,$(2)) :| $(dir $(call gb_CxxClrObject_get_dep_target,$(2))).dir +endif + +endef + # call gb_LinkTarget_add_asmobject,linktarget,sourcefile define gb_LinkTarget_add_asmobject $(if $(wildcard $(call gb_AsmObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_AsmObject_get_source,$(SRCDIR),$(2))))) @@ -1230,6 +1312,11 @@ define gb_LinkTarget_add_objcxxobjects $(foreach obj,$(2),$(call gb_LinkTarget_add_objcxxobject,$(1),$(obj),$(3),$(4))) endef +# call gb_LinkTarget_add_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename +define gb_LinkTarget_add_cxxclrobjects +$(foreach obj,$(2),$(call gb_LinkTarget_add_cxxclrobject,$(1),$(obj),$(3),$(4))) +endef + # call gb_LinkTarget_add_asmobjects,linktarget,sourcefiles,asmflags,linktargetmakefilename define gb_LinkTarget_add_asmobjects $(foreach obj,$(2),$(call gb_LinkTarget_add_asmobject,$(1),$(obj),$(3))) diff --git a/solenv/gbuild/StaticLibrary.mk b/solenv/gbuild/StaticLibrary.mk index dc7778f2dd11..849c0b51a5ad 100644 --- a/solenv/gbuild/StaticLibrary.mk +++ b/solenv/gbuild/StaticLibrary.mk @@ -74,6 +74,8 @@ $(eval $(foreach method,\ add_cxxobjects \ add_objcxxobject \ add_objcxxobjects \ + add_cxxclrobject \ + add_cxxclrobjects \ add_asmobject \ add_asmobjects \ add_exception_objects \ @@ -86,6 +88,7 @@ $(eval $(foreach method,\ add_cxxflags \ add_objcflags \ add_objcxxflags \ + add_cxxclrflags \ add_defs \ set_include \ add_ldflags \ diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 78ed59c07835..394b44eae7d4 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -127,6 +127,7 @@ gb_Module_get_uicheck_target = $(WORKDIR)/Module/uicheck/$(1) gb_Module_get_target = $(WORKDIR)/Module/$(1) gb_ObjCxxObject_get_target = $(WORKDIR)/ObjCxxObject/$(1).o gb_ObjCObject_get_target = $(WORKDIR)/ObjCObject/$(1).o +gb_CxxClrObject_get_target = $(WORKDIR)/CxxClrObject/$(1).o gb_Pagein_get_target = $(WORKDIR)/Pagein/pagein-$(1) gb_Package_get_preparation_target = $(WORKDIR)/Package/prepared/$(1) gb_Package_get_target = $(WORKDIR)/Package/$(1).filelist @@ -313,6 +314,7 @@ $(eval $(call gb_Helper_make_dep_targets,\ CxxObject \ ObjCObject \ ObjCxxObject \ + CxxClrObject \ AsmObject \ GenCObject \ GenCxxObject \ diff --git a/solenv/gbuild/extensions/post_GbuildToJson.mk b/solenv/gbuild/extensions/post_GbuildToJson.mk index 345b3556cba0..29bdf8d78f8c 100644 --- a/solenv/gbuild/extensions/post_GbuildToJson.mk +++ b/solenv/gbuild/extensions/post_GbuildToJson.mk @@ -55,6 +55,7 @@ $(call gb_Executable_get_command,gbuildtojson) \ --yaccobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(YACCOBJECTS)) \ --objcobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(OBJCOBJECTS)) \ --objcxxobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(OBJCXXOBJECTS)) \ +--cxxclrobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(CXXCLROBJECTS)) \ --asmobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(ASMOBJECTS)) \ --lexobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(LEXOBJECTS)) \ --gencobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(GENCOBJECTS)) \ @@ -70,6 +71,8 @@ $(call gb_Executable_get_command,gbuildtojson) \ --objcflagsappend=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_OBJCFLAGS_APPEND)) \ --objcxxflags=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_OBJCXXFLAGS)) \ --objcxxflagsappend=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_OBJCXXFLAGS_APPEND)) \ +--cxxclrflags=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_CXXCLRFLAGS)) \ +--cxxclrflagsappend=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_CXXCLRFLAGS_APPEND)) \ --defs=$(call var2file,$(shell $(gb_MKTEMP)),100,$(DEFS)) \ --include=$(call var2file,$(shell $(gb_MKTEMP)),100,$(INCLUDE)) \ --linked_libs=$(call var2file,$(shell $(gb_MKTEMP)),100,$(LINKED_LIBS)) \ @@ -119,6 +122,10 @@ define gb_LinkTarget_add_objcxxobject $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS += $(2) endef +define gb_LinkTarget_add_cxxclrobject +$(call gb_LinkTarget_get_target,$(1)) : CXXCLROBJECTS += $(2) + +endef define gb_LinkTarget_add_scanners $(call gb_LinkTarget_get_target,$(1)) : LEXOBJECTS += $(2) diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index f55559c71e66..1aef9384d8fc 100644 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -40,11 +40,15 @@ $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $(1)) $(dir $(4)) && \ unset INCLUDE && \ $(if $(filter YES,$(CXXOBJECT_X64)), $(CXX_X64_BINARY), \ - $(if $(filter %.c,$(3)), $(gb_CC), $(gb_CXX))) \ + $(if $(filter %.c,$(3)), $(gb_CC), \ + $(if $(filter -clr,$(2)), \ + $(MSVC_CXX) -I$(SRCDIR)/solenv/clang-cl,$(gb_CXX)))) \ $(DEFS) \ $(gb_LTOFLAGS) \ $(2) \ - $(if $(EXTERNAL_CODE),$(if $(COM_IS_CLANG),-Wno-undef),$(gb_DEFS_INTERNAL)) \ + $(if $(EXTERNAL_CODE), \ + $(if $(filter -clr,$(2)),,$(if $(COM_IS_CLANG),-Wno-undef)), \ + $(gb_DEFS_INTERNAL)) \ $(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \ -Fd$(PDBFILE) \ $(PCHFLAGS) \ @@ -105,6 +109,7 @@ endef gb_LinkTarget_CFLAGS := $(gb_CFLAGS) gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) +gb_LinkTarget_CXXCLRFLAGS := $(gb_CXXCLRFLAGS) gb_LinkTarget_INCLUDE :=\ $(subst -I. , ,$(SOLARINC)) \ @@ -157,6 +162,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ + $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \ $(PCHOBJS) $(NATIVERES)) && \ diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk index 5e7c2e689438..a6b1b32d8c3d 100644..100755 --- a/solenv/gbuild/platform/com_MSC_defs.mk +++ b/solenv/gbuild/platform/com_MSC_defs.mk @@ -152,16 +152,7 @@ gb_CFLAGS := \ -wd4706 \ -wd4800 \ -ifeq ($(COM_IS_CLANG),TRUE) -gb_CFLAGS += \ - -Wdeclaration-after-statement \ - -Wendif-labels \ - -Wshadow \ - -Wstrict-prototypes \ - -Wundef \ - -Wunused-macros \ - -else +ifneq ($(COM_IS_CLANG),TRUE) gb_CFLAGS += \ $(if $(filter-out 120,$(VCVER)), -Wv:18 -wd4267) \ @@ -212,19 +203,7 @@ gb_CFLAGS += \ endif -ifeq ($(COM_IS_CLANG),TRUE) -gb_CXXFLAGS += \ - -Wendif-labels \ - -Wimplicit-fallthrough \ - -Wno-missing-braces \ - -Wno-missing-braces \ - -Wnon-virtual-dtor \ - -Woverloaded-virtual \ - -Wshadow \ - -Wundef \ - -Wunused-macros \ - -else +ifneq ($(COM_IS_CLANG),TRUE) gb_CXXFLAGS += \ $(if $(filter-out 120,$(VCVER)), -Wv:18 -wd4267) \ @@ -290,6 +269,38 @@ endif gb_LTOFLAGS := $(if $(filter TRUE,$(ENABLE_LTO)),-GL) +# When compiling for CLR, disable "warning C4339: use of undefined type detected +# in CLR meta-data - use of this type may lead to a runtime exception": +gb_CXXCLRFLAGS := $(gb_CXXFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \ + -AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \ + -EHa \ + -clr \ + -wd4339 \ + $(if $(filter-out 120,$(VCVER)), -Wv:18 -wd4267) \ + +ifeq ($(COM_IS_CLANG),TRUE) + +gb_CFLAGS += \ + -Wdeclaration-after-statement \ + -Wendif-labels \ + -Wshadow \ + -Wstrict-prototypes \ + -Wundef \ + -Wunused-macros \ + +gb_CXXFLAGS += \ + -Wendif-labels \ + -Wimplicit-fallthrough \ + -Wno-missing-braces \ + -Wno-missing-braces \ + -Wnon-virtual-dtor \ + -Woverloaded-virtual \ + -Wshadow \ + -Wundef \ + -Wunused-macros \ + +endif + # Helper class ifeq ($(GNUMAKE_WIN_NATIVE),TRUE) |