aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/compilers/msvc_compiler.conf
blob: c6cf77de2f0ad197352df181f99839e39d60e39d (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
94
95
96
_STD_CXX=/std:$_STD_CXX_VERSION

C_COMPILER=${_WINE_C_PREFIX} ${C_COMPILER_UNQUOTED}
C_COMPILER_OLD=${_WINE_C_PREFIX} ${quo:C_COMPILER_OLD_UNQUOTED}
CXX_COMPILER=${_WINE_CXX_PREFIX} ${CXX_COMPILER_UNQUOTED}
CXX_COMPILER_OLD=${_WINE_CXX_PREFIX} ${quo:CXX_COMPILER_OLD_UNQUOTED}
MASM_COMPILER=${_WINE_MASM_PREFIX} ${MASM_COMPILER_UNQUOTED}
MASM_COMPILER_OLD=${_WINE_MASM_PREFIX} ${quo:MASM_COMPILER_OLD_UNQUOTED}

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
}

CFLAGS_DEBUG   = /Od /Ob0 /Oi
CFLAGS_RELEASE = /O2 /Ob2 /Oi

MASMFLAGS=
_MASM_IO=/nologo /c /Fo${output;suf=${OBJECT_SUF}:SRC} ${input:SRC}
when ($ARCH_ARMV7) {
    _MASM_IO=-o ${output;suf=${OBJECT_SUF}:SRC} ${input: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
when ($_UNDER_WINE_COMPILER == "yes" || $CLANG_CL == "yes") {
    CL_WRAPPER=
}
ML_WRAPPER=${FIX_MSVC_OUTPUT} ml
when ($_UNDER_WINE_TOOLS == "yes") {
    ML_WRAPPER=
}

_FORCE_CPP_FLAGS=/TP

_C_CPP_KV_STYLE_P=p CC
_C_CPP_KV_STYLE_PC=pc yellow

_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_NEW=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${CXX_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CXXFLAGS} ${SRCFLAGS} ${_LANG_CFLAGS_VALUE_NEW} ${hide;kv:"soe"} ${hide;kv:_C_CPP_KV_STYLE_P} ${hide;kv:_C_CPP_KV_STYLE_PC}
_SRC_C_CMD_NEW=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CFLAGS} ${CONLYFLAGS} ${SRCFLAGS} ${hide;kv:"soe"} ${hide;kv:_C_CPP_KV_STYLE_P} ${hide;kv:_C_CPP_KV_STYLE_PC}
_SRC_M_CMD=$_EMPTY_CMD
_SRC_MASM_CMD=${cwd:ARCADIA_BUILD_ROOT} ${TOOLCHAIN_ENV} ${ML_WRAPPER} ${MASM_COMPILER_OLD} ${MASMFLAGS} ${SRCFLAGS} $_MASM_IO ${hide;kv:"p AS"} ${hide;kv:"pc yellow"}