diff --git a/.travis.yml b/.travis.yml index dc65a1180..da91aeb19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,8 +33,6 @@ matrix: env: TASK=cmake_test - os: linux env: TASK=r_test - - os: osx - env: TASK=java_test - os: osx env: TASK=python_lightweight_test - os: osx diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cc2d1ff7..b02b8f026 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,8 +96,6 @@ if(MSVC) else() set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}) - #Prevent shared library being called liblibxgboost.so on Linux - set(CMAKE_SHARED_LIBRARY_PREFIX "") endif() set(LINK_LIBRARIES dmlccore rabit) @@ -137,11 +135,12 @@ endif() add_library(objxgboost OBJECT ${SOURCES}) set_target_properties(${objxgboost} PROPERTIES POSITION_INDEPENDENT_CODE 1) -add_library(libxgboost SHARED $ ${CUDA_OBJS}) -add_executable(xgboost $ ${CUDA_OBJS}) +add_executable(runxgboost $ ${CUDA_OBJS}) +set_target_properties(runxgboost PROPERTIES OUTPUT_NAME xgboost) +target_link_libraries(runxgboost ${LINK_LIBRARIES}) +add_library(xgboost SHARED $ ${CUDA_OBJS}) target_link_libraries(xgboost ${LINK_LIBRARIES}) -target_link_libraries(libxgboost ${LINK_LIBRARIES}) option(JVM_BINDINGS "Build JVM bindings" OFF) @@ -150,11 +149,11 @@ if(JVM_BINDINGS) include_directories(${JNI_INCLUDE_DIRS} jvm-packages/xgboost4j/src/native) - add_library(libxgboost4j SHARED + add_library(xgboost4j SHARED $ ${CUDA_OBJS} jvm-packages/xgboost4j/src/native/xgboost4j.cpp) - target_link_libraries(libxgboost4j + target_link_libraries(xgboost4j ${LINK_LIBRARIES} - ${JNI_LIBRARIES}) + ${JAVA_JVM_LIBRARY}) endif() diff --git a/appveyor.yml b/appveyor.yml index 172cb9cb8..084f35b8e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,10 @@ environment: matrix: - - solution_name: C:/projects/xgboost/build2013/xgboost.sln - - solution_name: C:/projects/xgboost/build2015/xgboost.sln + - target: native + solution_name: C:/projects/xgboost/build2013/xgboost.sln + - target: native + solution_name: C:/projects/xgboost/build2015/xgboost.sln + - target: jvm platform: - x64 @@ -10,6 +13,7 @@ configuration: - Release install: + - SET PATH=;%PATH% - git submodule update --init --recursive before_build: @@ -19,5 +23,8 @@ before_build: - cmake .. -G"Visual Studio 12 2013 Win64" - cd ../build2015 - cmake .. -G"Visual Studio 14 2015 Win64" + build_script: - - msbuild %solution_name% + - cd %APPVEYOR_BUILD_FOLDER% + - if "%target%" == "native" msbuild %solution_name% + - if "%target%" == "jvm" cd jvm-packages && C:\Python36-x64\python create_jni.py diff --git a/jvm-packages/create_jni.py b/jvm-packages/create_jni.py index 11a84ec77..23b663880 100755 --- a/jvm-packages/create_jni.py +++ b/jvm-packages/create_jni.py @@ -6,7 +6,11 @@ import shutil import subprocess import sys from contextlib import contextmanager -from subprocess import check_output + + +# Monkey-patch the API inconsistency between Python2.X and 3.X. +if sys.platform.startswith("linux"): + sys.platform = "linux" CONFIG = { @@ -56,14 +60,18 @@ def cp(source, target): def normpath(path): """Normalize UNIX path to a native path.""" - return os.path.join(*path.split("/")) + normalized = os.path.join(*path.split("/")) + if os.path.isabs(path): + return os.path.abspath("/") + normalized + else: + return normalized if __name__ == "__main__": if sys.platform == "darwin": # Enable of your compiler supports OpenMP. CONFIG["USE_OPENMP"] = "OFF" - os.environ["JAVA_HOME"] = check_output( + os.environ["JAVA_HOME"] = subprocess.check_output( "/usr/libexec/java_home").strip().decode() print("building Java wrapper") @@ -88,7 +96,7 @@ if __name__ == "__main__": library_name = { "win32": "xgboost4j.dll", "darwin": "libxgboost4j.dylib", - "linux2": "libxgboost4j.so" + "linux": "libxgboost4j.so" }[sys.platform] maybe_makedirs("xgboost4j/src/main/resources/lib") cp("../lib/" + library_name, "xgboost4j/src/main/resources/lib") diff --git a/jvm-packages/xgboost4j/src/native/xgboost4j.cpp b/jvm-packages/xgboost4j/src/native/xgboost4j.cpp index bfd302ef1..4df4c3d11 100644 --- a/jvm-packages/xgboost4j/src/native/xgboost4j.cpp +++ b/jvm-packages/xgboost4j/src/native/xgboost4j.cpp @@ -76,7 +76,7 @@ XGB_EXTERN_C int XGBoost4jCallbackDataIterNext( batch, jenv->GetFieldID(batchClass, "featureValue", "[F")); XGBoostBatchCSR cbatch; cbatch.size = jenv->GetArrayLength(joffset) - 1; - cbatch.offset = reinterpret_cast( + cbatch.offset = reinterpret_cast( jenv->GetLongArrayElements(joffset, 0)); if (jlabel != nullptr) { cbatch.label = jenv->GetFloatArrayElements(jlabel, 0); diff --git a/tests/travis/run_test.sh b/tests/travis/run_test.sh index 1917b4ac5..37d27c56c 100755 --- a/tests/travis/run_test.sh +++ b/tests/travis/run_test.sh @@ -81,10 +81,9 @@ fi if [ ${TASK} == "java_test" ]; then set -e - make jvm-packages cd jvm-packages - mvn clean install -DskipTests=true - mvn test + mvn -q clean install -DskipTests -Dmaven.test.skip + mvn -q test fi if [ ${TASK} == "cmake_test" ]; then