From 7d23ea7e9e8f84b1d30cc8cdb10d3341df5f85b0 Mon Sep 17 00:00:00 2001 From: huangzixuan Date: Sun, 20 Dec 2015 20:47:30 +0800 Subject: [PATCH] add settings for OS X --- Makefile | 4 ++++ java/create_wrap.sh | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 77944747d..531676a4e 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,10 @@ ifeq ($(UNAME), Linux) JAVAINCFLAGS += -I${JAVA_HOME}/include/linux endif +ifeq ($(UNAME), Darwin) + JAVAINCFLAGS += -I${JAVA_HOME}/include/darwin +endif + ifeq ($(no_omp),1) CFLAGS += -DDISABLE_OPENMP else diff --git a/java/create_wrap.sh b/java/create_wrap.sh index 8b7968cb9..fd8b46add 100755 --- a/java/create_wrap.sh +++ b/java/create_wrap.sh @@ -1,6 +1,13 @@ echo "build java wrapper" +dylib="so" +omp="0" +if [ $(uname) == "Darwin" ]; then + export JAVA_HOME=$(/usr/libexec/java_home) + dylib="dylib" + omp="1" +fi cd .. -make java +make java no_omp=${omp} cd java echo "move native lib" @@ -9,7 +16,7 @@ if [ ! -d "$libPath" ]; then mkdir -p "$libPath" fi -rm -f xgboost4j/src/main/resources/lib/libxgboost4j.so -mv libxgboost4j.so xgboost4j/src/main/resources/lib/ +rm -f xgboost4j/src/main/resources/lib/libxgboost4j.${dylib} +mv libxgboost4j.so xgboost4j/src/main/resources/lib/libxgboost4j.${dylib} echo "complete"