Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generated cxx wrapper to support multi-platform compile #39

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,6 @@ set(ALL_SOURCE_LIST
wedpr-computing/ppc-psi wedpr-computing/ppc-mpc wedpr-computing/ppc-pir ${CEM_SOURCE}
wedpr-initializer wedpr-main)

if(BUILD_WEDPR_TOOLKIT)
# fetch the python dependencies
option(FETCH_PYTHON_DEPS "Install python required modules if not available" ON)
message(STATUS "Python fetch dependencies: ${FETCH_PYTHON_DEPS}")
if(WIN32)
message(STATUS "Getting SWIG for Windows: ...")
include(swig)
message(STATUS "Getting SWIG for Windows: ...DONE")
endif()
endif()

if(BUILD_ALL)
add_sources("${ALL_SOURCE_LIST}")
elseif(BUILD_UDF)
Expand Down
4 changes: 3 additions & 1 deletion cpp/wedpr-transport/sdk-wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ include(${SWIG_USE_FILE})
# Add subdirectories for each language if desired
option(BUILD_PYTHON "Build Python SWIG module" ON)
if(BUILD_PYTHON)
# fetch the python dependencies
option(FETCH_PYTHON_DEPS "Install python required modules if not available" ON)
message(STATUS "Python fetch dependencies: ${FETCH_PYTHON_DEPS}")
include(python)
add_subdirectory(python)
endif()

# Add subdirectories for each language if desired
option(BUILD_JAVA "Build JAVA SWIG module" ON)
if(BUILD_JAVA)
include(java)
add_subdirectory(java)
endif()
45 changes: 29 additions & 16 deletions cpp/wedpr-transport/sdk-wrapper/java/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
file(GLOB_RECURSE SRCS wedpr_java_transport.i)
set_source_files_properties(${SRCS} PROPERTIES CPLUSPLUS ON)

set(WEDPR_TRANSPORT_PACKAGE "com.webank.wedpr.sdk.jni.generated")

set_property(SOURCE swig/wedpr_java_transport.i PROPERTY COMPILE_OPTIONS
-package ${WEDPR_TRANSPORT_PACKAGE})

file(MAKE_DIRECTORY ${WEDPR_JAVA_TRANSPORT_DIR})
file(MAKE_DIRECTORY ${WEDPR_JAVA_TRANSPORT_LIB_DIR})

swig_add_library(${WEDPR_JAVA_TRANSPORT}
TYPE MODULE
LANGUAGE java
OUTPUT_DIR ${WEDPR_JAVA_TRANSPORT_DIR}
SOURCES ${SRCS})
option(AUTO_GENERATE "Auto generate the targes" OFF)
if(AUTO_GENERATE)
if(WIN32)
message(STATUS "Getting SWIG for Windows: ...")
include(swig)
message(STATUS "Getting SWIG for Windows: ...DONE")
endif()
# only auto-generate should find swig
include(java)
file(GLOB_RECURSE SRCS wedpr_java_transport.i)
set_source_files_properties(${SRCS} PROPERTIES CPLUSPLUS ON)

set(WEDPR_TRANSPORT_PACKAGE "com.webank.wedpr.sdk.jni.generated")

set_property(SOURCE swig/wedpr_java_transport.i PROPERTY COMPILE_OPTIONS
-package ${WEDPR_TRANSPORT_PACKAGE})

file(MAKE_DIRECTORY ${WEDPR_JAVA_TRANSPORT_DIR})
file(MAKE_DIRECTORY ${WEDPR_JAVA_TRANSPORT_LIB_DIR})

swig_add_library(${WEDPR_JAVA_TRANSPORT}
TYPE MODULE
LANGUAGE java
OUTPUT_DIR ${WEDPR_JAVA_TRANSPORT_DIR}
SOURCES ${SRCS})
else()
file(GLOB_RECURSE SRCS src/*.cxx)
add_library(${WEDPR_JAVA_TRANSPORT} SHARED ${SRCS})
endif()

SET(LIBRARY_OUTPUT_PATH ${WEDPR_JAVA_TRANSPORT_LIB_DIR})
message("LIBRARY_OUTPUT_PATH: ${WEDPR_JAVA_TRANSPORT_LIB_DIR}")
Expand Down
14 changes: 9 additions & 5 deletions cpp/wedpr-transport/sdk-wrapper/java/bindings/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ plugins {
id "de.undercouch.download" version "4.1.2"
id 'com.github.sherter.google-java-format' version '0.9'
}
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: 'signing'

// Additional attribute definition
ext {
Expand Down Expand Up @@ -93,7 +96,7 @@ version = '1.0.0-SNAPSHOT'
jar {
exclude '**/*.xml'
exclude '**/*.properties'
/*manifest {
manifest {
try {
def repo = grgit.open(currentDir: project.rootDir)
if (repo != null) {
Expand All @@ -109,7 +112,7 @@ jar {
} catch (Exception e) {
e.printStackTrace()
}
} from sourceSets.main.output*/
} from sourceSets.main.output

doLast {
copy {
Expand Down Expand Up @@ -164,7 +167,7 @@ publishing {

pom {
name = 'wedpr'
description = 'wedpr java transport jni'
description = 'wedpr java gateway sdk'
url = 'http://www.fisco-bcos.org'

licenses {
Expand Down Expand Up @@ -200,7 +203,8 @@ publishing {
password 'deployment123'
}
}
signing {
sign publishing.publications.mavenJava
}
}

}

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'wedpr-java-transport-jni'
rootProject.name = 'wedpr-gateway-sdk'

Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public static String getLibName(String baseName) {
} else if (osName.contains(MAC)) {
String arch = getArch();
if ("arm".equals(arch)) {
return "lib" + baseName + "-aarch64" + ".jnilib";
return "lib" + baseName + "-aarch64" + ".dylib";
}
return "lib" + baseName + ".jnilib";
return "lib" + baseName + ".dylib";
} else {
throw new RuntimeException("unrecognized OS: " + osName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public synchronized void delete() {
/**
* : receive message from gateway, call by gateway<br>
* <br>
*
* @return void
*/
public void onReceiveMessage(
Message _msg,
Expand Down
Loading
Loading