LINK_EXE_CMD=${_WINE_LINK_PREFIX} ${_MSVC_LINK} LINK_LIB_CMD=${_WINE_LIB_PREFIX} ${_MSVC_LIB} _MSVC_ARCH= when ($ARCH_I386 == "yes" || $ARCH_I686 == "yes") { _MSVC_ARCH=x86 } elsewhen ($ARCH_X86_64 == "yes") { _MSVC_ARCH=x64 } elsewhen ($ARCH_ARM == "yes") { _MSVC_ARCH=arm } _FLAGS_MACHINE=/MACHINE:${toupper:_MSVC_ARCH} _FLAGS_IGNORE=/IGNORE:4221 _FLAGS_COMMON_IDE_MSVS= when ($IDE_MSVS == "yes") { _FLAGS_COMMON_IDE_MSVS=/INCREMENTAL } otherwise { _FLAGS_COMMON_IDE_MSVS=/INCREMENTAL:NO } # TODO(nslus): DEVTOOLS-1868 remove restriction. _FLAGS_DEBUG_ONLY_DEBUG= _FLAGS_RELEASE_ONLY_DEBUG= _FLAGS_COMMON_DEBUG= when (!$NO_DEBUGINFO || $NO_DEBUGINFO == "no" || $NO_DEBUGINFO == "0") { when ($IDE_MSVS == "yes") { when ($CLANG_CL == "yes") { _FLAGS_DEBUG_ONLY_DEBUG=/DEBUG } otherwise { _FLAGS_DEBUG_ONLY_DEBUG=/DEBUG:FASTLINK } _FLAGS_RELEASE_ONLY_DEBUG=/DEBUG } otherwise { _FLAGS_COMMON_DEBUG=/DEBUG } } _FLAGS_COMMON_LIBPATHS= when ($IDE_MSVS != "yes") { _FLAGS_COMMON_LIBPATHS=\ /LIBPATH:\""${_MSVC_TC_KIT_LIBS}/um/$_MSVC_ARCH"\" \ /LIBPATH:\""${_MSVC_TC_KIT_LIBS}/ucrt/$_MSVC_ARCH"\" \ /LIBPATH:\""${_MSVC_TC_VC_ROOT}/lib/$_MSVC_ARCH"\" } _FLAGS_COMMON =/NOLOGO /ERRORREPORT:PROMPT /SUBSYSTEM:CONSOLE /TLBID:1 $MSVC_DYNAMICBASE /NXCOMPAT _FLAGS_COMMON+=$_FLAGS_IGNORE _FLAGS_COMMON+=$_FLAGS_MACHINE _FLAGS_COMMON+=$_FLAGS_COMMON_IDE_MSVS _FLAGS_COMMON+=$_FLAGS_COMMON_DEBUG _FLAGS_COMMON+=$_FLAGS_COMMON_LIBPATHS _FLAGS_DEBUG_ONLY_CLANG_CL= when ($CLANG_CL == "yes") { _FLAGS_DEBUG_ONLY_CLANG_CL=/STACK:4194304 } _FLAGS_DEBUG_ONLY =$_FLAGS_DEBUG_ONLY_CLANG_CL _FLAGS_DEBUG_ONLY+=$_FLAGS_DEBUG_ONLY_DEBUG _FLAGS_RELEASE_ONLY =$_FLAGS_RELEASE_ONLY_DEBUG LINK_EXE_FLAGS_DEBUG =$_FLAGS_COMMON LINK_EXE_FLAGS_DEBUG+=$_FLAGS_DEBUG_ONLY LINK_EXE_FLAGS_RELEASE =$_FLAGS_COMMON LINK_EXE_FLAGS_RELEASE+=$_FLAGS_RELEASE_ONLY LINK_LIB_FLAGS=$_FLAGS_IGNORE $_FLAGS_MACHINE LINK_STDLIBS=\ advapi32.lib \ comdlg32.lib \ crypt32.lib \ dnsapi.lib \ gdi32.lib \ iphlpapi.lib \ kernel32.lib \ mswsock.lib \ ole32.lib \ oleaut32.lib \ psapi.lib \ rpcrt4.lib \ secur32.lib \ shell32.lib \ shlwapi.lib \ user32.lib \ userenv.lib \ uuid.lib \ version.lib \ winmm.lib \ winspool.lib \ ws2_32.lib LINK_EXE_FLAGS=$LINK_EXE_FLAGS_PER_TYPE LINK_EXE_VFS_FLAGS= when ($_UNDER_WINE_LINK != "yes" && $USE_MSVC_LINKER != "yes") { LINK_EXE_VFS_FLAGS=/vfsoverlay:${BINDIR}/vfsoverlay.yaml } LINK_EXE_FLAGS+=${LINK_EXE_VFS_FLAGS} GENERATE_COMMON_LIB_VFS_CMD=\ ${YMAKE_PYTHON3} ${input:"build/scripts/generate_win_vfs.py"} \ ${BINDIR} \ ${_FLAGS_COMMON_LIBPATHS} GENERATE_COMMON_LIB_VFS= when ($_UNDER_WINE_LINK != "yes" && $USE_MSVC_LINKER != "yes") { GENERATE_COMMON_LIB_VFS=${GENERATE_COMMON_LIB_VFS_CMD} } LINK_IMPLIB=/IMPLIB:${rootrel;output;pre=$MODULE_PREFIX;suf=.lib;noext:REALPRJNAME} _LINK_EXTRA_OUTPUT= when (!$NO_DEBUGINFO || $NO_DEBUGINFO == "no" || $NO_DEBUGINFO == "0") { _LINK_EXTRA_OUTPUT=/PDB:${rootrel;output;pre=$MODULE_PREFIX;suf=.pdb;noext:REALPRJNAME} } LINK_EXTRA_OUTPUT=$_LINK_EXTRA_OUTPUT LIB_WRAPPER=${FIX_MSVC_OUTPUT} lib LINK_WRAPPER=${FIX_MSVC_OUTPUT} link when ($_UNDER_WINE_LINK == "yes") { LINK_WRAPPER= } when ($_UNDER_WINE_LIB == "yes") { LIB_WRAPPER= } LINK_WRAPPER_DYNLIB=\ ${YMAKE_PYTHON} ${input:"build/scripts/link_dyn_lib.py"} ${hide;input:"build/scripts/fix_py2_protobuf.py"} \ --arch WINDOWS \ --target $TARGET EXPORTS_VALUE= LINK_IMPLIB_VALUE= when ($EXPORTS_FILE) { LINK_IMPLIB_VALUE=$LINK_IMPLIB EXPORTS_VALUE=/DEF:${input:EXPORTS_FILE} } GENERATE_MF_CMD=\ $YMAKE_PYTHON ${input:"build/scripts/generate_mf.py"} ${hide;input:"build/scripts/process_command_files.py"} \ --build-root $ARCADIA_BUILD_ROOT \ --module-name $REALPRJNAME \ -o ${rootrel;output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mf:REALPRJNAME} \ -t $MODULE_TYPE \ --ya-start-command-file \ -Ya,lics $LICENSE_NAMES \ -Ya,peers ${rootrel:PEERS} \ -Ya,credits ${input:CREDITS_TEXTS_FILE} $CREDITS_FLAGS \ --ya-end-command-file _EXTRA_OBJS= _GENERATE_EXTRA_OBJS= # we split srcs_global into two groups: libs and objs # # each group can be in its own command file # first group need /WHOLEARCHIVE: prefix which will be added in fix_msvc_output.py or run_msvc_wine.py # the tail of link commands will be added in the third command file _MSVC_SRCS_GLOBALS=\ --start-wa --ya-start-command-file ${qe;rootrel;ext=.lib:SRCS_GLOBAL} --ya-end-command-file --end-wa \ --ya-start-command-file ${qe;rootrel;ext=.obj:SRCS_GLOBAL} --ya-end-command-file REAL_LINK_DYN_LIB_CMDLINE=\ ${GENERATE_COMMON_LIB_VFS} && \ ${TOOLCHAIN_ENV} \ ${cwd:ARCADIA_BUILD_ROOT} \ ${LINK_WRAPPER} \ ${LINK_WRAPPER_DYNLIB} \ ${LINK_EXE_CMD} \ ${LINK_IMPLIB_VALUE} \ /DLL \ /OUT:${qe;rootrel:TARGET} \ ${LINK_EXTRA_OUTPUT} \ ${EXPORTS_VALUE} \ ${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ ${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ $_MSVC_SRCS_GLOBALS \ --ya-start-command-file \ ${VCS_C_OBJ_RR} \ ${qe;rootrel:AUTO_INPUT} \ ${qe;rootrel;ext=.lib;tags_cut:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib;tags_cut:PEERS} \ $LINK_EXE_FLAGS \ $LINK_STDLIBS $LDFLAGS \ $LDFLAGS_GLOBAL \ $OBJADDE \ --ya-end-command-file REAL_LINK_DYN_LIB=$REAL_LINK_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) SWIG_DLL_JAR_CMD=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $REAL_SWIG_DLL_JAR_CMD _MSVC_HEAD_LINK_LIB=${TOOLCHAIN_ENV} ${cwd:ARCADIA_BUILD_ROOT} ${LIB_WRAPPER} ${LINK_LIB_CMD} _MSVC_TAIL_LINK_LIB=\ --ya-start-command-file \ ${qe;rootrel:AUTO_INPUT} \ $LINK_LIB_FLAGS \ --ya-end-command-file \ ${hide;kv:"soe"} ${hide;kv:"p AR"} ${hide;kv:"pc light-red"} LINK_LIB=${GENERATE_MF} && $_MSVC_HEAD_LINK_LIB /OUT:${qe;rootrel:TARGET} $_MSVC_TAIL_LINK_LIB GLOBAL_LINK_LIB=$_MSVC_HEAD_LINK_LIB /OUT:${qe;rootrel:GLOBAL_TARGET} $_MSVC_TAIL_LINK_LIB LINK_EXE_CMDLINE=\ ${GENERATE_MF} && \ ${_GENERATE_EXTRA_OBJS} && \ $GENERATE_VCS_C_INFO_NODEP && \ ${GENERATE_COMMON_LIB_VFS} && \ ${TOOLCHAIN_ENV} \ ${cwd:ARCADIA_BUILD_ROOT} \ ${LINK_WRAPPER} \ ${LINK_EXE_CMD} \ /OUT:${qe;rootrel:TARGET} \ ${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ ${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ ${LINK_EXTRA_OUTPUT} \ $_MSVC_SRCS_GLOBALS \ --ya-start-command-file \ ${VCS_C_OBJ_RR} \ ${_EXTRA_OBJS} \ ${qe;rootrel:AUTO_INPUT} \ $LINK_EXE_FLAGS \ $LINK_STDLIBS \ $LDFLAGS \ $LDFLAGS_GLOBAL \ $OBJADDE \ ${qe;rootrel;ext=.lib;tags_cut:PEERS} ${qe;rootrel;suf=.lib;noext;ext=.dll;tags_cut:PEERS} \ --ya-end-command-file \ ${hide;kv:"soe"} ${hide;kv:"p LD"} ${hide;kv:"pc blue"} LINK_EXE=$LINK_EXE_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) LINK_DYN_LIB=${GENERATE_MF} && $GENERATE_VCS_C_INFO_NODEP && $REAL_LINK_DYN_LIB && ${hide;kv:"soe"} ${hide;kv:"p LD"} ${hide;kv:"pc blue"} LINK_EXEC_DYN_LIB_CMDLINE=\ ${GENERATE_MF} && \ $GENERATE_VCS_C_INFO_NODEP && \ ${GENERATE_COMMON_LIB_VFS} && \ ${TOOLCHAIN_ENV} \ ${cwd:ARCADIA_BUILD_ROOT} \ ${LINK_WRAPPER} \ ${LINK_WRAPPER_DYNLIB} \ ${LINK_EXE_CMD} \ /OUT:${qe;rootrel:TARGET} \ ${LINK_EXTRA_OUTPUT} \ ${EXPORTS_VALUE} \ ${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ ${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ $_MSVC_SRCS_GLOBALS \ '--ya-start-command-file \ ${VCS_C_OBJ_RR} \ ${qe;rootrel:AUTO_INPUT} \ ${qe;rootrel;ext=.lib;tags_cut:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib;tags_cut:PEERS} \ $LINK_EXE_FLAGS \ $LINK_STDLIBS \ $LDFLAGS $LDFLAGS_GLOBAL \ $OBJADDE \ --ya-end-command-file \ ${hide;kv:"soe"} ${hide;kv:"p LD"} ${hide;kv:"pc blue"} LINK_EXEC_DYN_LIB=$LINK_EXEC_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) macro PACK_GLOBALS_IN_LIBRARY() { ENABLE(UNUSED_MACRO) } LINK_GLOBAL_FAT_OBJECT=\ ${TOOLCHAIN_ENV} \ ${cwd:ARCADIA_BUILD_ROOT} \ ${LIB_WRAPPER} \ ${LINK_LIB_CMD} \ /OUT:${qe;rootrel;output;suf=.global.lib:REALPRJNAME} \ --ya-start-command-file \ ${qe;rootrel;ext=.lib:SRCS_GLOBAL} \ ${qe;rootrel;ext=.obj:SRCS_GLOBAL} \ ${qe;rootrel:AUTO_INPUT} \ $LINK_LIB_FLAGS \ --ya-end-command-file LINK_PEERS_FAT_OBJECT=\ ${TOOLCHAIN_ENV} \ ${cwd:ARCADIA_BUILD_ROOT} \ ${LIB_WRAPPER} \ ${LINK_LIB_CMD} \ /OUT:${qe;rootrel:TARGET} \ --ya-start-command-file \ ${qe;rootrel:PEERS} \ $LINK_LIB_FLAGS \ --ya-end-command-file LINK_FAT_OBJECT=\ ${GENERATE_MF} && \ $GENERATE_VCS_C_INFO_NODEP && \ $LINK_GLOBAL_FAT_OBJECT && \ $LINK_PEERS_FAT_OBJECT \ ${hide;kv:"p LD"} ${hide;kv:"pc light-blue"} ${hide;kv:"show_out"}