Skip to content
Open
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ include(cmake/third_party.cmake)
# Valid values are "generic", "avx2", "avx512", "sve".
option(NSPARSE_OPT_LEVEL "" "generic")
option(NSPARSE_ENABLE_PYTHON "Build Python bindings" OFF)
option(NSPARSE_BUILD_JNI "Build JNI shared library for Java integration" OFF)

add_subdirectory(nsparse)

Expand All @@ -29,6 +30,11 @@ if(NSPARSE_ENABLE_PYTHON)
add_subdirectory(nsparse/python)
endif()

# JNI bindings
if(NSPARSE_BUILD_JNI)
add_subdirectory(jni)
endif()

# CTest must be included in the top level to enable `make test` target.
include(CTest)

Expand Down
26 changes: 26 additions & 0 deletions jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0

find_package(JNI REQUIRED)

add_library(nsparse_jni SHARED nsparse_jni.cpp)

target_include_directories(nsparse_jni PRIVATE
${JNI_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}
)

target_link_libraries(nsparse_jni PRIVATE nsparse)

set_target_properties(nsparse_jni PROPERTIES
POSITION_INDEPENDENT_CODE ON
OUTPUT_NAME "nsparse_jni"
PREFIX "lib"
)

# Strip debug symbols in release builds
if(CMAKE_BUILD_TYPE STREQUAL "Release")
if(NOT WIN32)
target_link_options(nsparse_jni PRIVATE -s)
endif()
endif()
Loading
Loading