xref: /btstack/test/gatt_client/CMakeLists.txt (revision f41de160e418a8e2f7f80794bd5b2e2bacb8e973)
1*f41de160SMatthias Ringwaldcmake_minimum_required (VERSION 3.5)
2*f41de160SMatthias Ringwaldproject(gatt-client-test)
3*f41de160SMatthias Ringwald
4*f41de160SMatthias Ringwald# fink pkgconfig
5*f41de160SMatthias Ringwaldfind_package(PkgConfig REQUIRED)
6*f41de160SMatthias Ringwald
7*f41de160SMatthias Ringwald# add CppUTest
8*f41de160SMatthias Ringwaldinclude_directories("/usr/local/include")
9*f41de160SMatthias Ringwaldlink_directories("/usr/local/lib")
10*f41de160SMatthias Ringwaldlink_libraries( CppUTest )
11*f41de160SMatthias Ringwaldlink_libraries( CppUTestExt )
12*f41de160SMatthias Ringwald
13*f41de160SMatthias Ringwaldinclude_directories(.)
14*f41de160SMatthias Ringwaldinclude_directories(../../src)
15*f41de160SMatthias Ringwaldinclude_directories( ${CMAKE_CURRENT_BINARY_DIR})
16*f41de160SMatthias Ringwald
17*f41de160SMatthias Ringwaldset(SOURCES
18*f41de160SMatthias Ringwald	../../src/ad_parser.c
19*f41de160SMatthias Ringwald	../../src/ble/att_db.c
20*f41de160SMatthias Ringwald	../../src/ble/att_dispatch.c
21*f41de160SMatthias Ringwald	../../src/ble/gatt_client.c
22*f41de160SMatthias Ringwald	../../src/ble/le_device_db_memory.c
23*f41de160SMatthias Ringwald	../../src/btstack_linked_list.c
24*f41de160SMatthias Ringwald	../../src/btstack_memory.c
25*f41de160SMatthias Ringwald	../../src/btstack_memory_pool.c
26*f41de160SMatthias Ringwald	../../src/btstack_util.c
27*f41de160SMatthias Ringwald	../../src/hci_cmd.c
28*f41de160SMatthias Ringwald	../../src/hci_dump.c
29*f41de160SMatthias Ringwald)
30*f41de160SMatthias Ringwald
31*f41de160SMatthias Ringwald# create static lib
32*f41de160SMatthias Ringwaldadd_library(btstack STATIC ${SOURCES})
33*f41de160SMatthias Ringwald
34*f41de160SMatthias Ringwald# create targets
35*f41de160SMatthias Ringwaldforeach(EXAMPLE_FILE le_central.c gatt_client_test.c)
36*f41de160SMatthias Ringwald	get_filename_component(EXAMPLE ${EXAMPLE_FILE} NAME_WE)
37*f41de160SMatthias Ringwald	set (SOURCE_FILES ${EXAMPLE_FILE} mock.c)
38*f41de160SMatthias Ringwald	# profile.h
39*f41de160SMatthias Ringwald	add_custom_command(
40*f41de160SMatthias Ringwald		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/profile.h
41*f41de160SMatthias Ringwald		COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py
42*f41de160SMatthias Ringwald		ARGS ${CMAKE_SOURCE_DIR}/profile.gatt ${CMAKE_CURRENT_BINARY_DIR}/profile.h
43*f41de160SMatthias Ringwald	)
44*f41de160SMatthias Ringwald	list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/profile.h)
45*f41de160SMatthias Ringwald	# Use C++ Compiler
46*f41de160SMatthias Ringwald	set_source_files_properties(${EXAMPLE_FILE} mock.c PROPERTIES LANGUAGE CXX )
47*f41de160SMatthias Ringwald	add_executable(${EXAMPLE} ${SOURCE_FILES} )
48*f41de160SMatthias Ringwald	target_link_libraries(${EXAMPLE} btstack)
49*f41de160SMatthias Ringwaldendforeach(EXAMPLE_FILE)
50