xref: /btstack/test/mesh/CMakeLists.txt (revision 6fb99087c23301b60b9cffe2addca6756a428667)
11d1c93c5SMatthias Ringwaldcmake_minimum_required (VERSION 3.5)
21d1c93c5SMatthias Ringwaldproject(BTstackMesh)
31d1c93c5SMatthias Ringwald
41d1c93c5SMatthias Ringwald# add libusb
51d1c93c5SMatthias Ringwaldfind_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "include" "libusb" "libusb-1.0")
61d1c93c5SMatthias Ringwaldfind_library(LIBUSB_LIBRARY NAMES usb-1.0 PATH_SUFFIXES "lib" "lib32" "lib64" "dylib")
71d1c93c5SMatthias Ringwaldget_filename_component(LIBUSB_LIBRARY_PATH ${LIBUSB_LIBRARY} DIRECTORY)
81d1c93c5SMatthias Ringwaldinclude_directories( ${LIBUSB_INCLUDE_DIR} )
91d1c93c5SMatthias Ringwaldlink_directories( ${LIBUSB_LIBRARY_PATH} )
101d1c93c5SMatthias Ringwaldlink_libraries( usb-1.0 )
111d1c93c5SMatthias Ringwald
121d1c93c5SMatthias Ringwaldinclude_directories(../../3rd-party/micro-ecc)
131d1c93c5SMatthias Ringwaldinclude_directories(../../3rd-party/tinydir)
141d1c93c5SMatthias Ringwaldinclude_directories(../../src)
151d1c93c5SMatthias Ringwaldinclude_directories(../../platform/posix)
16*6fb99087SMatthias Ringwaldinclude_directories(../../3rd-party/rijndael)
171d1c93c5SMatthias Ringwaldinclude_directories(.)
181d1c93c5SMatthias Ringwald
19d935ec81SMatthias Ringwaldfile(GLOB SOURCES_SRC       "../../src/*.c"                     "../../src/*.h" "../../example/sco_demo_util.c" "../../example/sco_demo_util.h")
20d935ec81SMatthias Ringwaldfile(GLOB SOURCES_BLE       "../../src/ble/*.c"                 "../../src/ble/*.h")
21d935ec81SMatthias Ringwaldfile(GLOB SOURCES_GATT      "../../src/ble/gatt-service/*.c"    "../../src/ble/gatt-service/*.h")
2277ba3d3fSMatthias Ringwaldfile(GLOB SOURCES_MESH      "../../src/mesh/*.c"                "../../src/mesh/*.h" )
23d935ec81SMatthias Ringwaldfile(GLOB SOURCES_UECC      "../../3rd-party/micro-ecc/uECC.c"  "../../3rd-party/micro-ecc/uECC.h")
24d935ec81SMatthias Ringwaldfile(GLOB SOURCES_POSIX     "../../platform/posix/*.c"          "../../platform/posix/*.h")
25d935ec81SMatthias Ringwaldfile(GLOB SOURCES_LIBUSB    "../../platform/libusb/*.c"         "../../platform/libusb/*.h")
261d1c93c5SMatthias Ringwald
27d935ec81SMatthias Ringwald
28d935ec81SMatthias Ringwaldfile(GLOB SOURCES_OFF "../../src/ble/le_device_db_memory.c" "../../src/ble/le_device_db_memory.h" "../../src/ble/le_device_db_tlv.c" "../../src/ble/le_device_db_tlv.h")
291d1c93c5SMatthias Ringwaldlist(REMOVE_ITEM SOURCES_BLE ${SOURCES_OFF})
301d1c93c5SMatthias Ringwald
31a5a7b6daSMatthias Ringwaldset(SOURCES_MESH_NEW main.c)
321d1c93c5SMatthias Ringwald
331d1c93c5SMatthias Ringwaldset(SOURCES
341d1c93c5SMatthias Ringwald	${SOURCES_POSIX}
351d1c93c5SMatthias Ringwald	${SOURCES_LIBUSB}
361d1c93c5SMatthias Ringwald	${SOURCES_SRC}
371d1c93c5SMatthias Ringwald	${SOURCES_BLE}
381d1c93c5SMatthias Ringwald	${SOURCES_MESH}
391d1c93c5SMatthias Ringwald	${SOURCES_MESH_NEW}
401d1c93c5SMatthias Ringwald	${SOURCES_GATT}
411d1c93c5SMatthias Ringwald	${SOURCES_UECC}
421d1c93c5SMatthias Ringwald)
431d1c93c5SMatthias Ringwaldlist(SORT SOURCES)
441d1c93c5SMatthias Ringwald
451d1c93c5SMatthias Ringwald# create static lib
461d1c93c5SMatthias Ringwaldadd_library(btstack STATIC ${SOURCES})
471d1c93c5SMatthias Ringwald
481d1c93c5SMatthias Ringwald# list of targets
49a5a7b6daSMatthias Ringwaldset(EXAMPLES_C mesh_pts.c)
500b2c76e9SMatthias Ringwald
510b2c76e9SMatthias Ringwaldfile(GLOB EXAMPLES_GATT "*.gatt")
521d1c93c5SMatthias Ringwald
531d1c93c5SMatthias Ringwald# create targets
540b2c76e9SMatthias Ringwaldforeach(EXAMPLE_FILE ${EXAMPLES_C})
551d1c93c5SMatthias Ringwald	get_filename_component(EXAMPLE ${EXAMPLE_FILE} NAME_WE)
560b2c76e9SMatthias Ringwald	if ( "${EXAMPLES_GATT}" MATCHES ${EXAMPLE} )
570b2c76e9SMatthias Ringwald		message("example ${EXAMPLE} -- with GATT DB")
580b2c76e9SMatthias Ringwald		add_custom_command(
590b2c76e9SMatthias Ringwald		    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
600b2c76e9SMatthias Ringwald    		COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py ${CMAKE_SOURCE_DIR}/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h > /dev/null
610b2c76e9SMatthias Ringwald		)
620b2c76e9SMatthias Ringwald		add_executable(${EXAMPLE} ${EXAMPLE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
630b2c76e9SMatthias Ringwald	else()
641d1c93c5SMatthias Ringwald		message("example ${EXAMPLE}")
651d1c93c5SMatthias Ringwald		add_executable(${EXAMPLE} ${EXAMPLE_FILE})
660b2c76e9SMatthias Ringwald	endif()
671d1c93c5SMatthias Ringwald	target_link_libraries(${EXAMPLE} btstack)
681d1c93c5SMatthias Ringwaldendforeach(EXAMPLE_FILE)
6984242f88SMatthias Ringwald
7084242f88SMatthias Ringwald# create mesh_message_test target
7184242f88SMatthias Ringwald
7284242f88SMatthias Ringwald## hard-coded to use CPPUtest
7384242f88SMatthias Ringwaldinclude_directories( /usr/local/include)
7484242f88SMatthias Ringwaldlink_directories( /usr/local/lib)
7584242f88SMatthias Ringwaldlink_libraries(CppUTest CppUTestExt)
7684242f88SMatthias Ringwaldadd_executable(mesh_message_test
7784242f88SMatthias Ringwald../../src/mesh/mesh_foundation.c
7884242f88SMatthias Ringwald../../src/mesh/mesh_node.c
7984242f88SMatthias Ringwald../../src/mesh/mesh_iv_index_seq_number.c
8084242f88SMatthias Ringwald../../src/mesh/mesh_network.c
8184242f88SMatthias Ringwald../../src/mesh/mesh_peer.c
8284242f88SMatthias Ringwald../../src/mesh/mesh_lower_transport.c
8384242f88SMatthias Ringwald../../src/mesh/mesh_upper_transport.c
8484242f88SMatthias Ringwald../../src/mesh/mesh_virtual_addresses.c
8584242f88SMatthias Ringwald../../src/mesh/mesh_keys.c
8684242f88SMatthias Ringwald../../src/mesh/mesh_crypto.c
8784242f88SMatthias Ringwald../../src/btstack_memory.c
8884242f88SMatthias Ringwald../../src/btstack_memory_pool.c
8984242f88SMatthias Ringwald../../src/btstack_util.c
9084242f88SMatthias Ringwald../../src/btstack_crypto.c
9184242f88SMatthias Ringwald../../src/btstack_linked_list.c
9284242f88SMatthias Ringwald../../src/hci_dump.c
9384242f88SMatthias Ringwald../../src/hci_cmd.c
9484242f88SMatthias Ringwald../../3rd-party/micro-ecc/uECC.c
95*6fb99087SMatthias Ringwald../../3rd-party/rijndael/rijndael.c
9684242f88SMatthias Ringwaldmock.c
9784242f88SMatthias Ringwaldmesh_message_test.cpp
9884242f88SMatthias Ringwald)
9984242f88SMatthias Ringwald
10084242f88SMatthias Ringwald
10184242f88SMatthias Ringwald
102