mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-10 06:44:32 +00:00
test/hfp: rework CMake build
This commit is contained in:
parent
e0828146ae
commit
588df5e92a
@ -1,15 +1,6 @@
|
||||
cmake_minimum_required (VERSION 3.5)
|
||||
project(test-hfp)
|
||||
|
||||
# fink pkgconfig
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# libusb
|
||||
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
|
||||
include_directories(${LIBUSB_INCLUDE_DIRS})
|
||||
link_directories(${LIBUSB_LIBRARY_DIRS})
|
||||
link_libraries(${LIBUSB_LIBRARIES})
|
||||
|
||||
# add CppUTest
|
||||
include_directories("/usr/local/include")
|
||||
link_directories("/usr/local/lib")
|
||||
@ -18,13 +9,9 @@ link_libraries( CppUTestExt )
|
||||
|
||||
include_directories(.)
|
||||
include_directories(..)
|
||||
include_directories(../../3rd-party/micro-ecc)
|
||||
include_directories(../../3rd-party/bluedroid/decoder/include)
|
||||
include_directories(../../3rd-party/bluedroid/encoder/include)
|
||||
include_directories(../../3rd-party/md5)
|
||||
include_directories(../../3rd-party/hxcmod-player)
|
||||
include_directories(../../3rd-party/hxcmod-player/mod)
|
||||
include_directories(../../3rd-party/rijndael)
|
||||
include_directories(../../3rd-party/yxml)
|
||||
include_directories(../../3rd-party/tinydir)
|
||||
include_directories(../../src)
|
||||
@ -33,59 +20,30 @@ include_directories(../../platform/posix)
|
||||
include_directories(../../platform/embedded)
|
||||
include_directories(../../port/libusb)
|
||||
|
||||
file(GLOB SOURCES_SRC "../../src/*.c" "../../example/sco_demo_util.c")
|
||||
file(GLOB SOURCES_BLE "../../src/ble/*.c")
|
||||
file(GLOB SOURCES_GATT "../../src/ble/gatt-service/*.c")
|
||||
set (SOURCES_SRC
|
||||
../../src/btstack_linked_list.c
|
||||
../../src/btstack_util.c
|
||||
../../src/btstack_memory.c
|
||||
../../src/hci_cmd.c
|
||||
../../src/hci_dump.c
|
||||
)
|
||||
file(GLOB SOURCES_CLASSIC "../../src/classic/*.c")
|
||||
file(GLOB SOURCES_BLUEDROID "../../3rd-party/bluedroid/encoder/srce/*.c" "../../3rd-party/bluedroid/decoder/srce/*.c")
|
||||
file(GLOB SOURCES_MD5 "../../3rd-party/md5/md5.c")
|
||||
file(GLOB SOURCES_UECC "../../3rd-party/micro-ecc/uECC.c")
|
||||
file(GLOB SOURCES_YXML "../../3rd-party/yxml/yxml.c")
|
||||
file(GLOB SOURCES_HXCMOD "../../3rd-party/hxcmod-player/*.c" "../../3rd-party/hxcmod-player/mods/*.c")
|
||||
file(GLOB SOURCES_RIJNDAEL "../../3rd-party/rijndael/rijndael.c")
|
||||
file(GLOB SOURCES_POSIX "../../platform/posix/*.c")
|
||||
file(GLOB SOURCES_LIBUSB "../../port/libusb/*.c" "../../platform/libusb/*.c")
|
||||
file(GLOB SOURCES_ZEPHYR "../../chipset/zephyr/*.c")
|
||||
|
||||
file(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c")
|
||||
list(REMOVE_ITEM SOURCES_BLE ${SOURCES_BLE_OFF})
|
||||
|
||||
file(GLOB SOURCES_POSIX_OFF "../../platform/posix/le_device_db_fs.c")
|
||||
list(REMOVE_ITEM SOURCES_POSIX ${SOURCES_POSIX_OFF})
|
||||
|
||||
set(SOURCES
|
||||
${SOURCES_MD5}
|
||||
${SOURCES_YXML}
|
||||
${SOURCES_BLUEDROID}
|
||||
${SOURCES_POSIX}
|
||||
${SOURCES_RIJNDAEL}
|
||||
${SOURCES_LIBUSB}
|
||||
${SOURCES_SRC}
|
||||
${SOURCES_BLE}
|
||||
${SOURCES_GATT}
|
||||
${SOURCES_CLASSIC}
|
||||
${SOURCES_UECC}
|
||||
${SOURCES_HXCMOD}
|
||||
${SOURCES_ZEPHYR}
|
||||
mock.c
|
||||
test_sequences.c
|
||||
)
|
||||
list(SORT SOURCES)
|
||||
|
||||
set_source_files_properties(../../src/classic/hfp_ag.c PROPERTIES LANGUAGE CXX )
|
||||
|
||||
list(APPEND SOURCES mock.c test_sequences.c)
|
||||
|
||||
# create static lib
|
||||
add_library(btstack STATIC ${SOURCES})
|
||||
|
||||
# create targets for all examples
|
||||
file(GLOB EXAMPLES_C "*.c")
|
||||
list(SORT EXAMPLES_C)
|
||||
|
||||
# remove some
|
||||
file(GLOB EXAMPLES_OFF "test_sequences.c" "mock.c")
|
||||
list(REMOVE_ITEM EXAMPLES_C ${EXAMPLES_OFF})
|
||||
|
||||
# create targets
|
||||
# create targets for all tests
|
||||
file(GLOB EXAMPLES_C "*_test.c")
|
||||
foreach(EXAMPLE_FILE ${EXAMPLES_C})
|
||||
get_filename_component(EXAMPLE ${EXAMPLE_FILE} NAME_WE)
|
||||
# Use C++ Compiler
|
||||
|
@ -53,6 +53,8 @@
|
||||
#include "classic/hfp_hf.h"
|
||||
#include "classic/sdp_client.h"
|
||||
#include "classic/sdp_client_rfcomm.h"
|
||||
#include "hci.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
#include "mock.h"
|
||||
|
||||
@ -130,8 +132,8 @@ void print_without_newlines(uint8_t *data, uint16_t len){
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
extern "C" void l2cap_init(void){}
|
||||
extern "C" void hci_add_event_handler(btstack_packet_callback_registration_t * callback_handler){
|
||||
void l2cap_init(void){}
|
||||
void hci_add_event_handler(btstack_packet_callback_registration_t * callback_handler){
|
||||
registered_hci_packet_handler = callback_handler->callback;
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// HFP Mock API
|
||||
uint8_t * get_rfcomm_payload();
|
||||
uint16_t get_rfcomm_payload_len();
|
||||
@ -55,3 +59,7 @@ void inject_hfp_command_to_hf(uint8_t * data, int len);
|
||||
|
||||
int has_more_hfp_commands(int start_command_offset, int end_command_offset);
|
||||
char * get_next_hfp_command(int start_command_offset, int end_command_offset);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -46,6 +46,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct hfp_test_item{
|
||||
char * name;
|
||||
char ** test;
|
||||
@ -93,3 +97,6 @@ hfp_test_item_t * hfp_pts_ag_rhh_tests();
|
||||
int hfp_pts_hf_rhh_tests_size();
|
||||
hfp_test_item_t * hfp_pts_hf_rhh_tests();
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user