Skip to content

Commit 193a8d1

Browse files
committed
_build.sh: minor cleanup for Windows targets
1 parent a51982f commit 193a8d1

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

_build.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -678,25 +678,27 @@ build_single_target() {
678678
[ "${_CPU}" = 'a64' ] && _RCFLAGS_GLOBAL="${_RCFLAGS_GLOBAL} --target=${_TRIPLET}" # llvm-windres supports triplets here. https://github.com/llvm/llvm-project/blob/main/llvm/tools/llvm-rc/llvm-rc.cpp
679679
fi
680680

681-
if [ "${_HOSTOS}" = 'win' ] && [ "${_OS}" = 'win' ]; then
682-
# '-G MSYS Makefiles' command-line option is problematic due to spaces
683-
# and unwanted escaping/splitting. Pass it via envvar instead.
684-
export CMAKE_GENERATOR='MSYS Makefiles'
685-
# Without this, the value '/usr/local' becomes 'msys64/usr/local'
686-
export MSYS2_ARG_CONV_EXCL='-DCMAKE_INSTALL_PREFIX='
681+
if [ "${_OS}" = 'win' ]; then
682+
if [ "${_HOSTOS}" = 'win' ]; then
683+
# '-G MSYS Makefiles' command-line option is problematic due to spaces
684+
# and unwanted escaping/splitting. Pass it via envvar instead.
685+
export CMAKE_GENERATOR='MSYS Makefiles'
686+
# Without this, the value '/usr/local' becomes 'msys64/usr/local'
687+
export MSYS2_ARG_CONV_EXCL='-DCMAKE_INSTALL_PREFIX='
688+
fi
689+
690+
if [ "${_CRT}" = 'ucrt' ]; then
691+
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -D_UCRT"
692+
_LIBS_GLOBAL="${_LIBS_GLOBAL} -lucrt"
693+
if [ "${_CC}" = 'gcc' ]; then
694+
_LDFLAGS_GLOBAL="${_LDFLAGS_GLOBAL} -specs=${_GCCSPECS}"
695+
fi
696+
fi
687697
fi
688698

689699
_CMAKE_GLOBAL="${_CMAKE_GLOBAL} -DCMAKE_INSTALL_MESSAGE=NEVER"
690700
_CMAKE_GLOBAL="${_CMAKE_GLOBAL} -DCMAKE_INSTALL_PREFIX=${_PREFIX}"
691701

692-
if [ "${_CRT}" = 'ucrt' ]; then
693-
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -D_UCRT"
694-
_LIBS_GLOBAL="${_LIBS_GLOBAL} -lucrt"
695-
if [ "${_CC}" = 'gcc' ]; then
696-
_LDFLAGS_GLOBAL="${_LDFLAGS_GLOBAL} -specs=${_GCCSPECS}"
697-
fi
698-
fi
699-
700702
_CONFIGURE_GLOBAL="${_CONFIGURE_GLOBAL} --build=${_BUILD_HOST} --host=${_TRIPLET}"
701703
[ "${_CPU}" = 'x86' ] && _CFLAGS_GLOBAL="${_CFLAGS_GLOBAL} -fno-asynchronous-unwind-tables"
702704

0 commit comments

Comments
 (0)