_MSVC_MACRO=_WIN32_WINNT _MSVC_WINDOWS7=0x0601 _MSVC_WINDOWS8=0x0602 _MSVC_WARNS_ENABLED= # 'expression' : signed/unsigned mismatch _MSVC_WARNS_ENABLED+=/w14018 # 'class' : class has virtual functions, but destructor is not virtual _MSVC_WARNS_ENABLED+=/w14265 # 'operator' : expression is always false _MSVC_WARNS_ENABLED+=/w14296 # missing type specifier - int assumed _MSVC_WARNS_ENABLED+=/w14431 _MSVC_WARNS_AS_ERRORS= # 'function' undefined; assuming extern returning int _MSVC_WARNS_AS_ERRORS+=/we4013 _MSVC_WARNS_DISABLED= # conditional expression is constant _MSVC_WARNS_DISABLED+=/wd4127 # nonstandard extension used : zero-sized array in struct/union _MSVC_WARNS_DISABLED+=/wd4200 # nonstandard extension used : nameless struct/union _MSVC_WARNS_DISABLED+=/wd4201 # elements of array will be default initialized _MSVC_WARNS_DISABLED+=/wd4351 # 'this' : used in base member initializer list _MSVC_WARNS_DISABLED+=/wd4355 # decorated name length exceeded, name was truncated _MSVC_WARNS_DISABLED+=/wd4503 # default constructor could not be generated _MSVC_WARNS_DISABLED+=/wd4510 # copy constructor could not be generated _MSVC_WARNS_DISABLED+=/wd4511 # assignment operator could not be generated _MSVC_WARNS_DISABLED+=/wd4512 # check operator precedence for possible error; use parentheses to clarify precedence _MSVC_WARNS_DISABLED+=/wd4554 # 'object' can never be instantiated - user defined constructor required _MSVC_WARNS_DISABLED+=/wd4610 # assignment within conditional expression _MSVC_WARNS_DISABLED+=/wd4706 # forcing value to bool 'true' or 'false' (performance warning) _MSVC_WARNS_DISABLED+=/wd4800 # The POSIX name for this item is deprecated _MSVC_WARNS_DISABLED+=/wd4996 # function marked as __forceinline not inlined _MSVC_WARNS_DISABLED+=/wd4714 # 'TAtomic' : top-level volatile in cast is ignored _MSVC_WARNS_DISABLED+=/wd4197 # 'initializing' : conversion from 'int' to 'ui32', signed/unsigned mismatch _MSVC_WARNS_DISABLED+=/wd4245 # 'ystd::function': structure was padded due to alignment specifier _MSVC_WARNS_DISABLED+=/wd4324 # 'register' is no longer a supported storage class _MSVC_WARNS_DISABLED+=/wd5033 _C_WARNINGS_CLANG_CL= _CXX_WARNINGS_CLANG_CL= _CXX_WARNINGS_CLANG_CL_IDE_MSVS= when ($CLANG_CL == "yes") { _C_WARNINGS_CLANG_CL=\ -Wno-format \ -Wno-parentheses \ -Wno-unknown-warning-option _CXX_WARNINGS_CLANG_CL=\ -Wimport-preprocessor-directive-pedantic \ -Woverloaded-virtual \ -Wno-ambiguous-reversed-operator \ -Wno-defaulted-function-deleted \ -Wno-deprecated-anon-enum-enum-conversion \ -Wno-deprecated-enum-enum-conversion \ -Wno-deprecated-enum-float-conversion \ -Wno-deprecated-volatile \ -Wno-undefined-var-template when ($IDE_MSVS == "yes") { _CXX_WARNINGS_CLANG_CL_IDE_MSVS=-Wno-unused-command-line-argument } } _C_WARNINGS =$_MSVC_WARNS_AS_ERRORS _C_WARNINGS+=$_MSVC_WARNS_ENABLED _C_WARNINGS+=$_MSVC_WARNS_DISABLED _C_WARNINGS+=$_C_WARNINGS_CLANG_CL _CXX_WARNINGS = _CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL _CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL_IDE_MSVS _WINAPI_UNICODE=no _DEFINES_ARCH= when ($ARCH_X86_64 == "yes") { _DEFINES_ARCH=/D_WIN64 /DWIN64 } elsewhen ($ARCH_ARMV7 == "yes") { _DEFINES_ARCH=/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE /D__arm__ } _DEFINES_WIN32_WINNT=/D$_MSVC_MACRO=$_MSVC_WINDOWS7 when ($_WINAPI_UNICODE == "yes") { _DEFINES_UNICODE=/DUNICODE /D_UNICODE } otherwise { _DEFINES_UNICODE=/D_MBCS } _C_DEFINES=\ /DARCADIA_ROOT=${ARCADIA_ROOT} \ /DARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT} \ /DFAKEID=$CPP_FAKEID \ /DWIN32 \ /D_WIN32 \ /D_WINDOWS \ /D_CRT_SECURE_NO_WARNINGS \ /D_CRT_NONSTDC_NO_WARNINGS \ /D_USE_MATH_DEFINES \ /D__STDC_CONSTANT_MACROS \ /D__STDC_FORMAT_MACROS \ /D_USING_V110_SDK71_ \ /D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES \ /DWIN32_LEAN_AND_MEAN \ /DNOMINMAX _C_DEFINES+=$_DEFINES_ARCH _C_DEFINES+=$_DEFINES_WIN32_WINNT _C_DEFINES+=$_DEFINES_UNICODE C_DEFINES+=$_C_DEFINES _MSVC_FLAGS_CLANG= _MSVC_FLAGS_CLANG_ARCH= _MSVC_FLAGS_CLANG_EQ_2019= when ($CLANG_CL == "yes") { # -fcase-insensitive-paths # Allow to be included via in case-sensitive file-systems. # # -fms-compatibility-version # At the time clang-cl identifies itself as MSVC 19.11: # (actual value can be found in clang/lib/Driver/ToolChains/MSVC.cpp, the syntax would be like # ``` # MSVT = VersionTuple(19, 11); # ``` # # We override this value to match current value of the actual MSVC being used. # _MSVC_FLAGS_CLANG=-fcase-insensitive-paths -fms-compatibility-version=19.21 when ($ARCH_X86_64 == "yes") { _MSVC_FLAGS_CLANG_ARCH=-m64 } elsewhen ($ARCH_I386 == "yes") { _MSVC_FLAGS_CLANG_ARCH=-m32 } otherwise { _MSVC_FLAGS_CLANG_ARCH= } } _MSVC_FLAGS=/nologo /Zm500 /GR /bigobj /FC /EHs /errorReport:prompt $MSVC_INLINE_FLAG /utf-8 # enable standard conforming mode _MSVC_FLAGS+=/permissive- _MSVC_FLAGS+=$_MSVC_FLAGS_ARCH_OPT _MSVC_FLAGS+=$_MSVC_FLAGS_CLANG _MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_ARCH _MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_EQ_2019 _MSVC_FLAGS+=$_MSVC_FLAGS_INCLUDE MSVC_INLINE_OPTIMIZED=yes when ($MSVC_INLINE_OPTIMIZED == "yes") { MSVC_INLINE_FLAG=/Zc:inline } when ($MSVC_INLINE_OPTIMIZED == "no") { MSVC_INLINE_FLAG=/Zc:inline- } # Use builtin offsetof implementation # instead of a crutcy macro defined in ucrt/stddef.h. # The latter can not be used in constexpr statements. _CXX_DEFINES=/D_CRT_USE_BUILTIN_OFFSETOF _FLAGS_C_ONLY= # Provide proper __cplusplus value # https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ _CXX_FLAGS=/Zc:__cplusplus _FLAGS_MSVS_ONLY= DEBUG_INFO_FLAGS=/Z7 when ($IDE_MSVS == "yes") { when ($CLANG_CL != "yes") { _FLAGS_MSVS_ONLY=/FD /MP } DEBUG_INFO_FLAGS=/Zi /FS } C_WARNING_OPTS=$_C_WARNINGS CXX_WARNING_OPTS=$_CXX_WARNINGS # https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx when ($DLL_RUNTIME == "yes") { _FLAGS_DEBUG_RUNTIME=/MDd _FLAGS_RELEASE_RUNTIME=/MD } otherwise { _FLAGS_DEBUG_RUNTIME=/MTd _FLAGS_RELEASE_RUNTIME=/MT } CFLAGS_DEBUG=/Ob0 /Od /D_DEBUG $_FLAGS_DEBUG_RUNTIME CFLAGS_RELEASE=/Ox /Ob2 /Oi /DNDEBUG $_FLAGS_RELEASE_RUNTIME MASMFLAGS= _MASM_IO=/nologo /c /Fo${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC} when ($ARCH_ARMV7) { _MASM_IO=-o ${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC} } OBJ_CROSS_SUF=$OBJ_SUF OBJECT_SUF=$OBJ_SUF.obj CFLAGS+=$_MSVC_FLAGS $_FLAGS_MSVS_ONLY $CFLAGS_PER_TYPE $DEBUG_INFO_FLAGS $C_WARNING_OPTS $C_DEFINES $USER_CFLAGS $USER_CFLAGS_GLOBAL CXXFLAGS+=$CFLAGS $_STD_CXX $_CXX_FLAGS $_CXX_DEFINES $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL CONLYFLAGS+=$_FLAGS_C_ONLY $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL BC_CFLAGS+=$CFLAGS BC_CXXFLAGS+=$BC_CFLAGS $CXXFLAGS CFLAGS+=$_CFLAGS_UCRT_VC_INCLUDES when ($NO_WSHADOW == "yes") { C_WARNING_OPTS+=/wd4456 /wd4457 } when ($NO_COMPILER_WARNINGS == "yes") { C_WARNING_OPTS=/w when ($CLANG_CL == "yes") { # Though /w is intended to switch off all the warnings, # it does not switch at least -Wregister and -Wreserved-user-defined-literal under clang-cl. # # Use -Wno-everything to force warning suppression. CXX_WARNING_OPTS=-Wno-everything } otherwise { CXX_WARNING_OPTS= } } when ($NO_OPTIMIZE == "yes") { OPTIMIZE=/Od } SFDL_FLAG=/E /C /P /TP /Fi$SFDL_TMP_OUT WERROR_FLAG=/WX CL_WRAPPER=${FIX_MSVC_OUTPUT} cl ML_WRAPPER=${FIX_MSVC_OUTPUT} ml when ($_UNDER_WINE == "yes") { CL_WRAPPER= ML_WRAPPER= } _SRC_C_NODEPS_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo${OUTFILE} ${SRC} ${EXTRA_C_FLAGS} ${pre=/I :INC} ${CFLAGS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} _SRC_CPP_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${CXX_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CXXFLAGS} ${SRCFLAGS} ${_LANG_CFLAGS_VALUE} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} _SRC_C_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CFLAGS} ${CONLYFLAGS} ${SRCFLAGS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} _SRC_M_CMD=$_EMPTY_CMD _SRC_MASM_CMD=${cwd:ARCADIA_BUILD_ROOT} ${TOOLCHAIN_ENV} ${ML_WRAPPER} ${MASM_COMPILER} ${MASMFLAGS} ${SRCFLAGS} $_MASM_IO ${kv;hide:"p AS"} ${kv;hide:"pc yellow"}