aboutsummaryrefslogtreecommitdiffstats
path: root/java/jni/direct_bt/CMakeLists.txt
blob: b98bf9433f13f06261b1fca73241bee2a82cf686 (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
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 (direct_bt_LIB_INCLUDE_DIRS
    ${PROJECT_SOURCE_DIR}/jaucpp/include
    ${PROJECT_SOURCE_DIR}/api
    ${PROJECT_SOURCE_DIR}/api/direct_bt
    ${PROJECT_SOURCE_DIR}/include
    ${PROJECT_SOURCE_DIR}/java/jni
)

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

set (direct_bt_JNI_SRCS
  ${PROJECT_SOURCE_DIR}/jaucpp/java/jni/jni_mem.cxx
  ${PROJECT_SOURCE_DIR}/jaucpp/java/jni/helper_jni.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/direct_bt/helper_dbt.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTNativeDownlink.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTAdapter.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTDevice.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTEvent.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTGattCharacteristic.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTGattDescriptor.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTGattService.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTManager.cxx
  ${PROJECT_SOURCE_DIR}/java/jni/direct_bt/DBTObject.cxx
)

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

add_library (javadirect_bt SHARED ${direct_bt_JNI_SRCS})
target_link_libraries(javadirect_bt ${JNI_LIBRARIES} direct_bt)

set_target_properties(
    javadirect_bt
    PROPERTIES
    SOVERSION ${tinyb_VERSION_MAJOR}
    VERSION ${tinyb_VERSION_STRING}
    CXX_STANDARD 17
    CXX_STANDARD_REQUIRED ON
    COMPILE_FLAGS "-Wall -Wextra -Werror"
)

install(TARGETS javadirect_bt LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

add_dependencies(javadirect_bt direct_bt tinybjar)