11f805efeSMatthias Ringwaldcmake_minimum_required (VERSION 3.5) 21f805efeSMatthias Ringwald 31f805efeSMatthias Ringwaldset(CMAKE_C_COMPILER clang) 41f805efeSMatthias Ringwaldset(CMAKE_CXX_COMPILER clang) 51f805efeSMatthias Ringwald 61f805efeSMatthias Ringwaldproject(BTstack) 71f805efeSMatthias Ringwald 81f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/micro-ecc) 91f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/bluedroid/decoder/include) 101f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/bluedroid/encoder/include) 111f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/md5) 12*1faf2c16SMatthias Ringwaldinclude_directories(../../3rd-party/lc3-google/include) 131f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/hxcmod-player) 141f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/hxcmod-player/mod) 151f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/lwip/core/src/include) 161f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/lwip/dhcp-server) 171f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/rijndael) 181f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/yxml) 191f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/tinydir) 201f805efeSMatthias Ringwaldinclude_directories(../../src) 211f805efeSMatthias Ringwaldinclude_directories(../../platform/posix) 221f805efeSMatthias Ringwaldinclude_directories(../../platform/embedded) 231f805efeSMatthias Ringwaldinclude_directories(../../platform/lwip) 241f805efeSMatthias Ringwaldinclude_directories(../../platform/lwip/port) 251f805efeSMatthias Ringwaldinclude_directories(.) 261f805efeSMatthias Ringwald 271f805efeSMatthias Ringwaldfile(GLOB SOURCES_SRC "../../src/*.c" "../../example/sco_demo_util.c") 281f805efeSMatthias Ringwaldfile(GLOB SOURCES_BLE "../../src/ble/*.c") 291f805efeSMatthias Ringwaldfile(GLOB SOURCES_GATT "../../src/ble/gatt-service/*.c") 301f805efeSMatthias Ringwaldfile(GLOB SOURCES_CLASSIC "../../src/classic/*.c") 311f805efeSMatthias Ringwaldfile(GLOB SOURCES_MESH "../../src/mesh/*.c") 321f805efeSMatthias Ringwaldfile(GLOB SOURCES_BLUEDROID "../../3rd-party/bluedroid/encoder/srce/*.c" "../../3rd-party/bluedroid/decoder/srce/*.c") 331f805efeSMatthias Ringwaldfile(GLOB SOURCES_MD5 "../../3rd-party/md5/md5.c") 341f805efeSMatthias Ringwaldfile(GLOB SOURCES_UECC "../../3rd-party/micro-ecc/uECC.c") 351f805efeSMatthias Ringwaldfile(GLOB SOURCES_YXML "../../3rd-party/yxml/yxml.c") 361f805efeSMatthias Ringwaldfile(GLOB SOURCES_HXCMOD "../../3rd-party/hxcmod-player/*.c" "../../3rd-party/hxcmod-player/mods/*.c") 371f805efeSMatthias Ringwaldfile(GLOB SOURCES_RIJNDAEL "../../3rd-party/rijndael/rijndael.c") 381f805efeSMatthias Ringwaldfile(GLOB SOURCES_POSIX "../../platform/posix/*.c") 391f805efeSMatthias Ringwaldfile(GLOB SOURCES_LIBUSB "../../port/libusb/*.c" "../../platform/libusb/*.c") 40*1faf2c16SMatthias Ringwaldfile(GLOB SOURCES_LC3_GOOGLE "../../3rd-party/lc3-google/src/*.c") 411f805efeSMatthias Ringwald 421f805efeSMatthias Ringwaldset(LWIP_CORE_SRC 431f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/def.c 441f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/inet_chksum.c 451f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/init.c 461f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ip.c 471f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/mem.c 481f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/memp.c 491f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/netif.c 501f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/pbuf.c 511f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/tcp.c 521f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/tcp_in.c 531f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/tcp_out.c 541f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/timeouts.c 551f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/udp.c 561f805efeSMatthias Ringwald ) 571f805efeSMatthias Ringwaldset (LWIP_IPV4_SRC 581f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/acd.c 591f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/dhcp.c 601f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/etharp.c 611f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/icmp.c 621f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/ip4.c 631f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/ip4_addr.c 641f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/ip4_frag.c 651f805efeSMatthias Ringwald ) 661f805efeSMatthias Ringwaldset (LWIP_NETIF_SRC 671f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/netif/ethernet.c 681f805efeSMatthias Ringwald ) 691f805efeSMatthias Ringwaldset (LWIP_HTTPD 701f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/apps/http/altcp_proxyconnect.c 711f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/apps/http/fs.c 721f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/apps/http/httpd.c 731f805efeSMatthias Ringwald ) 741f805efeSMatthias Ringwaldset (LWIP_DHCPD 751f805efeSMatthias Ringwald ../../3rd-party/lwip/dhcp-server/dhserver.c 761f805efeSMatthias Ringwald ) 771f805efeSMatthias Ringwaldset (LWIP_PORT 781f805efeSMatthias Ringwald ../../platform/lwip/port/sys_arch.c 791f805efeSMatthias Ringwald ../../platform/lwip/bnep_lwip.c 801f805efeSMatthias Ringwald ) 811f805efeSMatthias Ringwald 821f805efeSMatthias Ringwaldset (SOURCES_LWIP ${LWIP_CORE_SRC} ${LWIP_IPV4_SRC} ${LWIP_NETIF_SRC} ${LWIP_HTTPD} ${LWIP_DHCPD} ${LWIP_PORT}) 831f805efeSMatthias Ringwald 841f805efeSMatthias Ringwaldfile(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c") 851f805efeSMatthias Ringwaldlist(REMOVE_ITEM SOURCES_BLE ${SOURCES_BLE_OFF}) 861f805efeSMatthias Ringwald 871f805efeSMatthias Ringwaldfile(GLOB SOURCES_POSIX_OFF "../../platform/posix/le_device_db_fs.c") 881f805efeSMatthias Ringwaldlist(REMOVE_ITEM SOURCES_POSIX ${SOURCES_POSIX_OFF}) 891f805efeSMatthias Ringwald 901f805efeSMatthias Ringwaldset(SOURCES 911f805efeSMatthias Ringwald ${SOURCES_MD5} 921f805efeSMatthias Ringwald ${SOURCES_YXML} 931f805efeSMatthias Ringwald ${SOURCES_BLUEDROID} 941f805efeSMatthias Ringwald ${SOURCES_POSIX} 951f805efeSMatthias Ringwald ${SOURCES_RIJNDAEL} 961f805efeSMatthias Ringwald ${SOURCES_SRC} 971f805efeSMatthias Ringwald ${SOURCES_BLE} 981f805efeSMatthias Ringwald ${SOURCES_GATT} 991f805efeSMatthias Ringwald ${SOURCES_MESH} 1001f805efeSMatthias Ringwald ${SOURCES_CLASSIC} 1011f805efeSMatthias Ringwald ${SOURCES_UECC} 1021f805efeSMatthias Ringwald ${SOURCES_HXCMOD} 103*1faf2c16SMatthias Ringwald ${SOURCES_LC3_GOOGLE} 1041f805efeSMatthias Ringwald ) 1051f805efeSMatthias Ringwaldlist(SORT SOURCES) 1061f805efeSMatthias Ringwald 107bba538e5SMatthias Ringwaldadd_compile_options( -g -fsanitize=fuzzer,address -fprofile-instr-generate -fcoverage-mapping) 1083d576343SMatthias Ringwaldadd_link_options( -fsanitize=fuzzer,address -fprofile-instr-generate -fcoverage-mapping) 109eddac615SMatthias Ringwald 1101f805efeSMatthias Ringwald# create static lib 1111f805efeSMatthias Ringwaldadd_library(btstack STATIC ${SOURCES}) 1121f805efeSMatthias Ringwald 1131f805efeSMatthias Ringwald# create fuzz targets 1141f805efeSMatthias Ringwaldfile(GLOB TARGETS_C "fuzz_*.c") 1151f805efeSMatthias Ringwald 1161f805efeSMatthias Ringwald# create targets 1171f805efeSMatthias Ringwaldforeach(TARGET_FILE ${TARGETS_C}) 1181f805efeSMatthias Ringwald get_filename_component(EXAMPLE ${TARGET_FILE} NAME_WE) 1191f805efeSMatthias Ringwald add_executable(${EXAMPLE} ${TARGET_FILE} ) 1201f805efeSMatthias Ringwald target_link_libraries(${EXAMPLE} btstack) 1211f805efeSMatthias Ringwaldendforeach(TARGET_FILE) 122