blob: 3a016b30bd8e5d60201597b386d96b40a3c166a4 (
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
|
set (tinyb_LIB_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/api
${PROJECT_SOURCE_DIR}/api/tinyb
${PROJECT_SOURCE_DIR}/include
)
include_directories(
${tinyb_LIB_INCLUDE_DIRS}
${GLIB2_INCLUDE_DIRS}
${GIO_INCLUDE_DIRS}
${GIO-UNIX_INCLUDE_DIRS}
)
set (tinyb_LIB_SRCS
${PROJECT_SOURCE_DIR}/src/BluetoothObject.cpp
${PROJECT_SOURCE_DIR}/src/BluetoothEvent.cpp
${PROJECT_SOURCE_DIR}/src/BluetoothManager.cpp
${PROJECT_SOURCE_DIR}/src/BluetoothAdapter.cpp
${PROJECT_SOURCE_DIR}/src/BluetoothDevice.cpp
${PROJECT_SOURCE_DIR}/src/BluetoothGattService.cpp
${PROJECT_SOURCE_DIR}/src/BluetoothGattCharacteristic.cpp
${PROJECT_SOURCE_DIR}/src/BluetoothGattDescriptor.cpp
${PROJECT_SOURCE_DIR}/src/tinyb_utils.cpp
${PROJECT_SOURCE_DIR}/src/generated-code.c
# autogenerated version file
${CMAKE_CURRENT_BINARY_DIR}/version.c
)
set (tinyb_LIB_GLOB_HEADERS
${PROJECT_SOURCE_DIR}/api/tinyb.hpp
)
add_library (tinyb SHARED ${tinyb_LIB_SRCS})
target_link_libraries (
tinyb
${CMAKE_THREAD_LIBS_INIT}
${GLIB2_LIBRARIES}
${GIO_LIBRARIES}
)
set_target_properties(
tinyb
PROPERTIES
SOVERSION ${tinyb_VERSION_MAJOR}
VERSION ${tinyb_VERSION_STRING}
CXX_STANDARD 11
)
install (FILES ${tinyb_LIB_GLOB_HEADERS} DESTINATION include/)
install (DIRECTORY ${PROJECT_SOURCE_DIR}/api/tinyb/ DESTINATION include/tinyb)
macro (tinyb_CREATE_INSTALL_PKGCONFIG generated_file install_location)
configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
endmacro (tinyb_CREATE_INSTALL_PKGCONFIG)
tinyb_create_install_pkgconfig (tinyb.pc lib${LIB_SUFFIX}/pkgconfig)
install(TARGETS tinyb LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if (BUILDSWIG)
find_package (SWIG)
if (SWIG_FOUND)
include (${SWIG_USE_FILE})
set_source_files_properties (tinyb.i PROPERTIES SWIG_FLAGS "-I${CMAKE_BINARY_DIR}/src")
if (BUILDSWIGJAVA)
add_subdirectory (java)
endif ()
endif ()
endif ()
|