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