aboutsummaryrefslogtreecommitdiffstats
path: root/java/jni/CMakeLists.txt
blob: 411883a649e2a0ee658e85be525b75f2d52a974b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
find_package(JNI REQUIRED)

if (JNI_FOUND)
    message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
    message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
endif (JNI_FOUND)

set (tinyb_LIB_INCLUDE_DIRS
    ${PROJECT_SOURCE_DIR}/api
    ${PROJECT_SOURCE_DIR}/api/tinyb
    ${PROJECT_SOURCE_DIR}/include
)

include_directories(
    ${JNI_INCLUDE_DIRS}
    ${tinyb_LIB_INCLUDE_DIRS}
    ${JNI_HEADER_PATH}
)

file(GLOB JNI_SOURCES "*.cxx")

set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")

add_library (javatinyb SHARED ${JNI_SOURCES})
target_link_libraries(javatinyb ${JNI_LIBRARIES} tinyb)

set_target_properties(
    javatinyb
    PROPERTIES
    SOVERSION ${tinyb_VERSION_MAJOR}
    VERSION ${tinyb_VERSION_STRING}
    CXX_STANDARD 11
    COMPILE_FLAGS "-Wall -Wextra"
)

install(TARGETS javatinyb LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})