add osx build instruction

This commit is contained in:
yanqingmen 2015-12-29 20:47:47 +08:00
parent 4a456b2a75
commit 47d6d09081
2 changed files with 11 additions and 5 deletions

View File

@ -17,12 +17,17 @@ core of this wrapper is two classes:
## build native library ## build native library
for windows: open the xgboost.sln in "../windows" folder, you will found the xgboostjavawrapper project, you should do the following steps to build wrapper library: for windows: open the xgboost.sln in "../windows" folder, you will found the xgboost4j project, you should do the following steps to build wrapper library:
* Select x64/win32 and Release in build * Select x64/win32 and Release in build
* (if you have setted `JAVA_HOME` properly in windows environment variables, escape this step) right click on xgboostjavawrapper project -> choose "Properties" -> click on "C/C++" in the window -> change the "Additional Include Directories" to fit your jdk install path. * (if you have setted `JAVA_HOME` properly in windows environment variables, escape this step) right click on xgboost4j project -> choose "Properties" -> click on "C/C++" in the window -> change the "Additional Include Directories" to fit your jdk install path.
* rebuild all * rebuild all
* double click "create_wrap.bat" to set library to proper place * double click "create_wrap.bat" to set library to proper place
for linux: for linux:
* make sure you have installed jdk and `JAVA_HOME` has been setted properly * make sure you have installed jdk and `JAVA_HOME` has been setted properly
* run "create_wrap.sh" * run "create_wrap.sh"
for osx:
* make sure you have installed jdk
* for single thread xgboost, simply run "create_wrap.sh"
* for build with openMP, please refer to [build.md](../doc/build.md) to get openmp supported compiler first, and change the line "dis_omp=1" to "dis_omp=0" in "create_wrap.sh", then run "create_wrap.sh"

View File

@ -1,13 +1,14 @@
echo "build java wrapper" echo "build java wrapper"
dylib="so" dylib="so"
omp="0" dis_omp=0
if [ $(uname) == "Darwin" ]; then if [ $(uname) == "Darwin" ]; then
export JAVA_HOME=$(/usr/libexec/java_home) export JAVA_HOME=$(/usr/libexec/java_home)
dylib="dylib" dylib="dylib"
omp="1" #change this to 0 if your compiler support openmp
dis_omp=1
fi fi
cd .. cd ..
make java no_omp=${omp} make java no_omp=${dis_omp}
cd java cd java
echo "move native lib" echo "move native lib"