[jvm-packages] Another pack of build/CI improvements (#2422)
* [jvm-packages] Fixed compilation on Windows * [jvm-packages] Build the JNI bindings on Appveyor * [jvm-packages] Build & test on OS X * [jvm-packages] Re-applied the CMake build changes reverted by #2395 * Fixed Appveyor JVM build * Muted Maven on Travis * Don't link with libawt * "linux2"->"linux" Python2.x and 3.X use slightly different values for ``sys.platform``.
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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<long *>(
|
||||
cbatch.offset = reinterpret_cast<jlong *>(
|
||||
jenv->GetLongArrayElements(joffset, 0));
|
||||
if (jlabel != nullptr) {
|
||||
cbatch.label = jenv->GetFloatArrayElements(jlabel, 0);
|
||||
|
||||
Reference in New Issue
Block a user