aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/compilers/msvc_compiler.conf
blob: 9455570d59d7f41053274e8a6a26572e50a2ded3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
_STD_CXX=/std:$_STD_CXX_VERSION

MSVC_INLINE_OPTIMIZED=yes
when ($MSVC_INLINE_OPTIMIZED == "yes") {
    MSVC_INLINE_FLAG=/Zc:inline
}
when ($MSVC_INLINE_OPTIMIZED == "no") {
    MSVC_INLINE_FLAG=/Zc:inline-
}

# Provide proper __cplusplus value
# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
_CXX_FLAGS=/Zc:__cplusplus

_MSVC_ONLY_FLAGS=
DEBUG_INFO_FLAGS=/Z7
when ($IDE_MSVS == "yes") {
    when ($CLANG_CL != "yes") {
        _MSVC_ONLY_FLAGS=/FD /MP
    }
    DEBUG_INFO_FLAGS=/Zi /FS
}

# 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 $_MSVC_ONLY_FLAGS $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+=$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") {
    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.
        C_WARNING_OPTS = -Wno-everything
        CXX_WARNING_OPTS =
    }
    otherwise {
        C_WARNING_OPTS=/w
        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" && $CLANG_CL !="yes") {
    CL_WRAPPER=
    ML_WRAPPER=
}

_FORCE_CPP_FLAGS=/TP

_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"}