Skip to content

Commit 82fdf6f

Browse files
committed
fix configure
1 parent 930be83 commit 82fdf6f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.github/workflows/macos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
# WyriHaximus/github-action-get-previous-tag@master need it
2626
fetch-depth: 0
2727
submodules: true
28+
2829
- name: Prepare local xmake
2930
run: cp -rf . ../xmake-source
3031
- uses: xmake-io/github-action-setup-xmake@v1

configure

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3753,6 +3753,20 @@ _check_cxsnippets() {
37533753
if test_nz "${CPPFLAGS}"; then
37543754
compflags="${compflags} ${CPPFLAGS}"
37553755
fi
3756+
# add -isysroot and -target on macOS to ensure system SDK headers are used for option checking
3757+
if is_plat "macosx"; then
3758+
_os_iorunv "xcrun" "-sdk" "macosx" "--show-sdk-path"; local _sdkdir="${_ret}"
3759+
if test_nz "${_sdkdir}"; then
3760+
compflags="-isysroot ${_sdkdir} ${compflags}"
3761+
path_basename "${_sdkdir}"; local _basename="${_ret}"
3762+
if test_nz "${_basename}" && string_startswith "${_basename}" "MacOSX"; then
3763+
string_replace "${_basename}" "MacOSX" ""; local _target_minver="${_ret}"
3764+
if test_nz "${_target_minver}"; then
3765+
compflags="-target ${_target_arch}-apple-macos${_target_minver} ${compflags}"
3766+
fi
3767+
fi
3768+
fi
3769+
fi
37563770
_toolchain_compcmd "${sourcekind}" "${objectfile}" "${sourcefile}" "${compflags}"; local compcmd="${_ret}"
37573771
if ${xmake_sh_diagnosis}; then
37583772
print "> ${compcmd}"

0 commit comments

Comments
 (0)