diff options
| -rw-r--r-- | .github/workflows/macos.yml | 1 | ||||
| -rwxr-xr-x | configure | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 57feb362f..0d4b9a96c 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -25,6 +25,7 @@ jobs: # WyriHaximus/github-action-get-previous-tag@master need it fetch-depth: 0 submodules: true + - name: Prepare local xmake run: cp -rf . ../xmake-source - uses: xmake-io/github-action-setup-xmake@v1 @@ -3753,6 +3753,20 @@ _check_cxsnippets() { if test_nz "${CPPFLAGS}"; then compflags="${compflags} ${CPPFLAGS}" fi + # add -isysroot and -target on macOS to ensure system SDK headers are used for option checking + if is_plat "macosx"; then + _os_iorunv "xcrun" "-sdk" "macosx" "--show-sdk-path"; local _sdkdir="${_ret}" + if test_nz "${_sdkdir}"; then + compflags="-isysroot ${_sdkdir} ${compflags}" + path_basename "${_sdkdir}"; local _basename="${_ret}" + if test_nz "${_basename}" && string_startswith "${_basename}" "MacOSX"; then + string_replace "${_basename}" "MacOSX" ""; local _target_minver="${_ret}" + if test_nz "${_target_minver}"; then + compflags="-target ${_target_arch}-apple-macos${_target_minver} ${compflags}" + fi + fi + fi + fi _toolchain_compcmd "${sourcekind}" "${objectfile}" "${sourcefile}" "${compflags}"; local compcmd="${_ret}" if ${xmake_sh_diagnosis}; then print "> ${compcmd}" |
