summaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 00000000..3a016b30
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,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 ()