Skip to content

Commit

Permalink
update dylib postfix
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Sep 14, 2024
1 parent 2ea8867 commit 1ef611f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 30 deletions.
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
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

0 comments on commit 1ef611f

Please sign in to comment.