summaryrefslogtreecommitdiffstats
path: root/java/jni/tinyb/CMakeLists.txt
blob: 6d0b0a07ba1284dbde2d3f4967728a3dfa96430f (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
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/direct_bt
    ${PROJECT_SOURCE_DIR}/api/tinyb
    ${PROJECT_SOURCE_DIR}/include
    ${PROJECT_SOURCE_DIR}/java/jni
)

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

set (tinyb_JNI_SRCS
  ${PROJECT_SOURCE_DIR}/src/direct_bt/BasicTypes.cpp
  ${PROJECT_SOURCE_DIR}/java/jni/JNIMem.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/helper_base.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/BluetoothFactory.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/BluetoothUtils.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/helper_tinyb.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/DBusAdapter.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/DBusDevice.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/DBusEvent.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/DBusGattCharacteristic.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/DBusGattDescriptor.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/DBusGattService.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/DBusManager.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/tinyb/DBusObject.cxx
)

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

add_library (javatinyb SHARED ${tinyb_JNI_SRCS})
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})

add_dependencies(javatinyb tinyb tinybjar)