From 24353a7322b949a0278e4adac6569ebc998a6326 Mon Sep 17 00:00:00 2001 From: Damon Barry Date: Tue, 11 Apr 2017 17:38:27 -0700 Subject: [PATCH] Add macOS support for Java remote modules --- jenkins/osx_c.sh | 8 +++++++- proxy/gateway/java/CMakeLists.txt | 15 +++++++++++---- proxy/gateway/java/nanomsg-binding/java_nanomsg.c | 1 - 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/jenkins/osx_c.sh b/jenkins/osx_c.sh index 419e23cd..e0b06bdb 100755 --- a/jenkins/osx_c.sh +++ b/jenkins/osx_c.sh @@ -9,13 +9,18 @@ script_dir=$(cd "$(dirname "$0")" && pwd) build_root=$(cd "${script_dir}/.." && pwd) build_folder=$build_root"/build" -CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) +CORES=$(sysctl -n hw.ncpu) # Java binding pushd $build_root/bindings/java/gateway-java-binding mvn clean install popd +# Java proxy gateway +pushd $build_root/proxy/gateway/java/gateway-remote-module +mvn clean install +popd + rm -rf $build_folder mkdir -p $build_folder pushd $build_folder @@ -26,6 +31,7 @@ cmake \ -Dbuild_cores=$CORES \ -Denable_ble_module:BOOL=OFF \ -Denable_java_binding=ON \ + -Denable_java_remote_modules:BOOL=ON \ -Drun_unittests:BOOL=ON \ -Drun_e2e_tests:BOOL=ON \ .. diff --git a/proxy/gateway/java/CMakeLists.txt b/proxy/gateway/java/CMakeLists.txt index d7150eee..05619570 100644 --- a/proxy/gateway/java/CMakeLists.txt +++ b/proxy/gateway/java/CMakeLists.txt @@ -30,10 +30,6 @@ set(java_nanomsg_headers ./nanomsg-binding/java_nanomsg.h ) -if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(LINUX TRUE) -endif() - if(WIN32) set(java_include_dirs $ENV{JAVA_HOME}/include @@ -57,6 +53,17 @@ elseif(LINUX) set(java_libs $ENV{JAVA_HOME}/jre/lib/${JDK_ARCH}/server/libjvm.so ) +elseif(APPLE) + set(java_include_dirs + $ENV{JAVA_HOME}/include + $ENV{JAVA_HOME}/include/darwin + ) + set(java_link_dirs + $ENV{JAVA_HOME}/jre/lib/server + ) + set(java_libs + $ENV{JAVA_HOME}/jre/lib/server/libjvm.dylib + ) endif() if( diff --git a/proxy/gateway/java/nanomsg-binding/java_nanomsg.c b/proxy/gateway/java/nanomsg-binding/java_nanomsg.c index a49f6354..ffe89969 100644 --- a/proxy/gateway/java/nanomsg-binding/java_nanomsg.c +++ b/proxy/gateway/java/nanomsg-binding/java_nanomsg.c @@ -18,7 +18,6 @@ JNIEXPORT jstring JNICALL Java_com_microsoft_azure_gateway_remote_NanomsgLibrary jthrowable exception = (*env)->ExceptionOccurred(env); if (error_msg == NULL || exception) { - error_msg = ""; (*env)->ExceptionDescribe(env); (*env)->ExceptionClear(env); }