Skip to content

Commit

Permalink
chore: fix and improve C/C++ compiler detection
Browse files Browse the repository at this point in the history
- fix: Don't attempt xcrun if not present
- fix: Default to g++ instead of gcc for CXX when Xcode not present
- feat: Allow user to override CC and CXX env vars
  • Loading branch information
legobeat committed May 16, 2024
1 parent 5af62fc commit e8ec34c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/react-native/scripts/ios-configure-glog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ EOF
fi

XCRUN="$(which xcrun)"
if [ -z "$XCRUN" ]; then
export CC="$(which gcc)"
if [ -n "$XCRUN" ]; then
export CC="$CC:-$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
else
export CC="$CC:-$(which gcc)"
export CXX="$CXX:-$(which g++)"
fi
export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
export CXX="$CC"
export CXX="$CCX:-$CC"

# Remove automake symlink if it exists
if [ -h "test-driver" ]; then
Expand Down

0 comments on commit e8ec34c

Please sign in to comment.