Skip to content

Commit d694d14

Browse files
committed
_build.sh: minor cleanup for windows targets
1 parent e1e7f20 commit d694d14

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
@@ -670,25 +670,27 @@ build_single_target() {
670670
[ "${_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
671671
fi
672672

673-
if [ "${_HOSTOS}" = 'win' ] && [ "${_OS}" = 'win' ]; then
674-
# '-G MSYS Makefiles' command-line option is problematic due to spaces
675-
# and unwanted escaping/splitting. Pass it via envvar instead.
676-
export CMAKE_GENERATOR='MSYS Makefiles'
677-
# Without this, the value '/usr/local' becomes 'msys64/usr/local'
678-
export MSYS2_ARG_CONV_EXCL='-DCMAKE_INSTALL_PREFIX='
673+
if [ "${_OS}" = 'win' ]; then
674+
if [ "${_HOSTOS}" = 'win' ]; then
675+
# '-G MSYS Makefiles' command-line option is problematic due to spaces
676+
# and unwanted escaping/splitting. Pass it via envvar instead.
677+
export CMAKE_GENERATOR='MSYS Makefiles'
678+
# Without this, the value '/usr/local' becomes 'msys64/usr/local'
679+
export MSYS2_ARG_CONV_EXCL='-DCMAKE_INSTALL_PREFIX='
680+
fi
681+
682+
if [ "${_CRT}" = 'ucrt' ]; then
683+
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -D_UCRT"
684+
_LIBS_GLOBAL="${_LIBS_GLOBAL} -lucrt"
685+
if [ "${_CC}" = 'gcc' ]; then
686+
_LDFLAGS_GLOBAL="${_LDFLAGS_GLOBAL} -specs=${_GCCSPECS}"
687+
fi
688+
fi
679689
fi
680690

681691
_CMAKE_GLOBAL="${_CMAKE_GLOBAL} -DCMAKE_INSTALL_MESSAGE=NEVER"
682692
_CMAKE_GLOBAL="${_CMAKE_GLOBAL} -DCMAKE_INSTALL_PREFIX=${_PREFIX}"
683693

684-
if [ "${_CRT}" = 'ucrt' ]; then
685-
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -D_UCRT"
686-
_LIBS_GLOBAL="${_LIBS_GLOBAL} -lucrt"
687-
if [ "${_CC}" = 'gcc' ]; then
688-
_LDFLAGS_GLOBAL="${_LDFLAGS_GLOBAL} -specs=${_GCCSPECS}"
689-
fi
690-
fi
691-
692694
_CONFIGURE_GLOBAL="${_CONFIGURE_GLOBAL} --build=${_BUILD_HOST} --host=${_TRIPLET}"
693695
[ "${_CPU}" = 'x86' ] && _CFLAGS_GLOBAL="${_CFLAGS_GLOBAL} -fno-asynchronous-unwind-tables"
694696

0 commit comments

Comments
 (0)