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>
This commit is contained in:
parent
0649622956
commit
0a99b5a1b7
17 changed files with 198 additions and 57 deletions
|
@ -13,11 +13,8 @@ $(eval $(call gb_Executable_use_package,climaker,\
|
|||
cli_basetypes_copy \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Executable_add_cxxflags,climaker,\
|
||||
-AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \
|
||||
-EHa -clr \
|
||||
$(eval $(call gb_Executable_add_cxxclrflags,climaker,\
|
||||
-LN \
|
||||
-wd4339 \
|
||||
-wd4715 \
|
||||
))
|
||||
|
||||
|
@ -43,7 +40,7 @@ $(eval $(call gb_Executable_use_system_win32_libs,climaker,\
|
|||
msvcmrt \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Executable_add_exception_objects,climaker,\
|
||||
$(eval $(call gb_Executable_add_cxxclrobjects,climaker,\
|
||||
cli_ure/source/climaker/climaker_app \
|
||||
cli_ure/source/climaker/climaker_emit \
|
||||
))
|
||||
|
|
|
@ -11,15 +11,6 @@ include $(SRCDIR)/cli_ure/version/version.txt
|
|||
|
||||
$(eval $(call gb_Library_Assembly,cli_cppuhelper))
|
||||
|
||||
# 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":
|
||||
$(eval $(call gb_Library_add_cxxflags,cli_cppuhelper,\
|
||||
-AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \
|
||||
-EHa \
|
||||
-clr \
|
||||
-wd4339 \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_ldflags,cli_cppuhelper,\
|
||||
-ignore:4248 \
|
||||
-keyfile:$(SRCDIR)/cli_ure/source/cliuno.snk \
|
||||
|
@ -48,12 +39,12 @@ $(eval $(call gb_Library_use_system_win32_libs,cli_cppuhelper,\
|
|||
msvcmrt \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,cli_cppuhelper,\
|
||||
$(eval $(call gb_Library_add_cxxclrobjects,cli_cppuhelper,\
|
||||
cli_ure/source/native/native_bootstrap \
|
||||
cli_ure/source/native/path \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_generated_exception_objects,cli_cppuhelper,\
|
||||
$(eval $(call gb_Library_add_generated_cxxclrobjects,cli_cppuhelper,\
|
||||
CustomTarget/cli_ure/source/native/assembly \
|
||||
))
|
||||
|
||||
|
|
|
@ -9,13 +9,6 @@
|
|||
|
||||
$(eval $(call gb_Library_Library,cli_uno))
|
||||
|
||||
$(eval $(call gb_Library_add_cxxflags,cli_uno,\
|
||||
-AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \
|
||||
-EHa \
|
||||
-clr \
|
||||
-wd4339 \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_ldflags,cli_uno,\
|
||||
-ignore:4248 \
|
||||
))
|
||||
|
@ -32,7 +25,7 @@ $(eval $(call gb_Library_use_system_win32_libs,cli_uno,\
|
|||
msvcmrt \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,cli_uno,\
|
||||
$(eval $(call gb_Library_add_cxxclrobjects,cli_uno,\
|
||||
cli_ure/source/uno_bridge/cli_bridge \
|
||||
cli_ure/source/uno_bridge/cli_data \
|
||||
cli_ure/source/uno_bridge/cli_environment \
|
||||
|
|
|
@ -392,6 +392,7 @@ export MPL_SUBSET=@MPL_SUBSET@
|
|||
export MSM_PATH=@MSM_PATH@
|
||||
export MSPUB_CFLAGS=$(gb_SPACE)@MSPUB_CFLAGS@
|
||||
export MSPUB_LIBS=$(gb_SPACE)@MSPUB_LIBS@
|
||||
export MSVC_CXX=@MSVC_CXX@
|
||||
export MSVC_DLLS=@MSVC_DLLS@
|
||||
export MSVC_DLL_PATH=@MSVC_DLL_PATH@
|
||||
export MSVC_USE_DEBUG_RUNTIME=@MSVC_USE_DEBUG_RUNTIME@
|
||||
|
|
21
configure.ac
21
configure.ac
|
@ -3558,25 +3558,35 @@ if test "$_os" = "WINNT"; then
|
|||
# location, isn't it likely that lots of other things needs changes, too, and just setting CC
|
||||
# is not enough?
|
||||
|
||||
if test -z "$CC"; then
|
||||
dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
|
||||
dnl needed when building CLR code:
|
||||
if test -z "$MSVC_CXX"; then
|
||||
if test "$BITNESS_OVERRIDE" = ""; then
|
||||
if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
|
||||
CC="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
|
||||
MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
|
||||
fi
|
||||
else
|
||||
if test "$vcexpress" = "Express"; then
|
||||
if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
|
||||
CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
|
||||
MSVC_CXX="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
|
||||
fi
|
||||
else
|
||||
if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
|
||||
CC="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
|
||||
MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# This gives us a posix path with 8.3 filename restrictions
|
||||
CC=`win_short_path_for_make "$CC"`
|
||||
MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
|
||||
fi
|
||||
|
||||
if test -z "$CC"; then
|
||||
CC=$MSVC_CXX
|
||||
fi
|
||||
if test "$BITNESS_OVERRIDE" = ""; then
|
||||
dnl since MSVC 2012, default for x86 is -arch:SSE2:
|
||||
MSVC_CXX="$MSVC_CXX -arch:SSE"
|
||||
fi
|
||||
|
||||
if test -n "$CC"; then
|
||||
|
@ -3720,6 +3730,7 @@ AC_SUBST(VCVER)
|
|||
AC_SUBST(DEVENV)
|
||||
PathFormat "$MSPDB_PATH"
|
||||
MSPDB_PATH="$formatted_path"
|
||||
AC_SUBST(MSVC_CXX)
|
||||
AC_SUBST(SHOWINCLUDES_PREFIX)
|
||||
|
||||
if test "$_os" = "WINNT"; then
|
||||
|
|
21
solenv/clang-cl/config_global.h
Executable file
21
solenv/clang-cl/config_global.h
Executable file
|
@ -0,0 +1,21 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
/* A partial copy of config_host/config_global.h.in, with hardcoded values that
|
||||
suffice to compile CxxClr code in cli_ure/ with MSVC when building the rest
|
||||
with clang-cl. A bad hack, should be replaced with a better copy that is
|
||||
actually filled in by configure.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_GLOBAL_H
|
||||
#define CONFIG_GLOBAL_H
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
|
@ -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)) \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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)) \
|
||||
|
@ -118,6 +121,10 @@ endef
|
|||
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)
|
||||
|
|
|
@ -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)) && \
|
||||
|
|
57
solenv/gbuild/platform/com_MSC_defs.mk
Normal file → Executable file
57
solenv/gbuild/platform/com_MSC_defs.mk
Normal file → Executable file
|
@ -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)
|
||||
|
|
|
@ -62,7 +62,7 @@ class CheckGbuildToJson(unittest.TestCase):
|
|||
gbuildlibs.append(json.load(f))
|
||||
foundlibs = set()
|
||||
for lib in gbuildlibs:
|
||||
self.assertEqual(set(lib.keys()), set(['MAKEFILE', 'ASMOBJECTS', 'CFLAGS', 'CFLAGSAPPEND', 'COBJECTS', 'CXXFLAGS', 'CXXFLAGSAPPEND', 'CXXOBJECTS', 'DEFS', 'LEXOBJECTS', 'GENCOBJECTS', 'GENCXXOBJECTS', 'ILIBTARGET', 'INCLUDE', 'JAVAOBJECTS', 'LINKED_LIBS', 'LINKED_STATIC_LIBS', 'LINKTARGET', 'OBJCFLAGS', 'OBJCFLAGSAPPEND', 'OBJCOBJECTS', 'OBJCXXFLAGS', 'OBJCXXFLAGSAPPEND', 'OBJCXXOBJECTS', 'PYTHONOBJECTS', 'YACCOBJECTS']))
|
||||
self.assertEqual(set(lib.keys()), set(['MAKEFILE', 'ASMOBJECTS', 'CFLAGS', 'CFLAGSAPPEND', 'COBJECTS', 'CXXCLRFLAGS', 'CXXCLRFLAGSAPPEND', 'CXXCLROBJECTS', 'CXXFLAGS', 'CXXFLAGSAPPEND', 'CXXOBJECTS', 'DEFS', 'LEXOBJECTS', 'GENCOBJECTS', 'GENCXXOBJECTS', 'ILIBTARGET', 'INCLUDE', 'JAVAOBJECTS', 'LINKED_LIBS', 'LINKED_STATIC_LIBS', 'LINKTARGET', 'OBJCFLAGS', 'OBJCFLAGSAPPEND', 'OBJCOBJECTS', 'OBJCXXFLAGS', 'OBJCXXFLAGSAPPEND', 'OBJCXXOBJECTS', 'PYTHONOBJECTS', 'YACCOBJECTS']))
|
||||
if lib['LINKTARGET'].find('gbuildselftestdep') != -1:
|
||||
foundlibs.add('gbuildselftestdep')
|
||||
elif lib['LINKTARGET'].find('gbuildselftest') != -1:
|
||||
|
|
Loading…
Reference in a new issue