[CI] Improve CI for Mac M1 (#9748)

* [CI] Improve CI for Mac M1

* Add -v flag

* Disable OpenMP in libxgboost4j.dylib

* Target MacOS 10.15+ to use C++17
This commit is contained in:
Philip Hyunsu Cho 2023-11-01 10:03:56 -07:00 committed by GitHub
parent d3f0646779
commit 1b9ed4a4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

View File

@ -32,6 +32,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(FATAL_ERROR "Need Clang 9.0 or newer to build XGBoost")
endif()
endif()
if(APPLE)
set(CMAKE_MACOSX_DEPLOYMENT_TARGET 10.15)
endif()
include(${xgboost_SOURCE_DIR}/cmake/PrefetchIntrinsics.cmake)
find_prefetch_intrinsics()

View File

@ -12,14 +12,17 @@ sysctl -n machdep.cpu.brand_string
uname -m
set +x
# Create new Conda env
echo "--- Set up Conda env"
. $HOME/mambaforge/etc/profile.d/conda.sh
. $HOME/mambaforge/etc/profile.d/mamba.sh
conda_env=xgboost_dev_$(uuidgen | tr '[:upper:]' '[:lower:]' | tr -d '-')
mamba create -y -n ${conda_env} python=3.8
conda activate ${conda_env}
mamba env update -n ${conda_env} --file tests/ci_build/conda_env/macos_cpu_test.yml
# Build XGBoost4J binary
echo "--- Build libxgboost4j.dylib"
set -x
mkdir build
pushd build
export JAVA_HOME=$(/usr/libexec/java_home)
cmake .. -GNinja -DJVM_BINDINGS=ON -DUSE_OPENMP=OFF
ninja -v
popd
rm -rf build
set +x
# Ensure that XGBoost can be built with Clang 11
echo "--- Build and Test XGBoost with MacOS M1, Clang 11"