aboutsummaryrefslogtreecommitdiffstats
path: root/java_jni/jni/CMakeLists.txt
blob: 97bd1248d82698019dfe4a0c49e999bed92a8ba6 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 (jaulib_base_LIB_INCLUDE_DIRS
    ${PROJECT_SOURCE_DIR}/include
)

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

#
# jaulib_jni
#

set (jaulib_jni_JNI_SRCS
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jni_mem.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/helper_jni.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/JVM_JNI8.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/MachineDataInfoRuntime.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/jau_fs_FileUtil.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/jau_io_MemUtil.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/jau_io_UriTk.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/jau_sys_Clock.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/ByteInStream_File.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/ByteInStream_URL.cxx
  ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/ByteInStream_Feed.cxx
)

if(WIN32)
    set (jaulib_jni_JNI_SRCS ${jaulib_jni_JNI_SRCS} ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/WindowsDynamicLinkerImpl_JNI.cxx)
else()
    set (jaulib_jni_JNI_SRCS ${jaulib_jni_JNI_SRCS} ${PROJECT_SOURCE_DIR}/java_jni/jni/jau/UnixDynamicLinkerImpl_JNI.cxx)
endif()

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

add_library (jaulib_jni_jni SHARED ${jaulib_jni_JNI_SRCS})
target_link_libraries(
    jaulib_jni_jni 
    ${JNI_LIBRARIES} 
    jaulib
)

if(USE_STRIP)
add_custom_command(TARGET jaulib_jni_jni POST_BUILD
                   COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}jaulib_jni_jni${CMAKE_SHARED_LIBRARY_SUFFIX}.${jaulib_VERSION_SHORT}
                   COMMENT "stripping jaulib_jni_jni"
                   VERBATIM
                   )
endif(USE_STRIP)

set_target_properties(
    jaulib_jni_jni
    PROPERTIES
    SOVERSION ${jaulib_VERSION_MAJOR}
    VERSION ${jaulib_VERSION_SHORT}
)

install(TARGETS jaulib_jni_jni LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

add_dependencies(jaulib_jni_jni jaulib jaulib_base_jar jaulib_jni_jar)