1*1f805efeSMatthias Ringwaldcmake_minimum_required (VERSION 3.5) 2*1f805efeSMatthias Ringwald 3*1f805efeSMatthias Ringwaldset(CMAKE_C_COMPILER clang) 4*1f805efeSMatthias Ringwaldset(CMAKE_CXX_COMPILER clang) 5*1f805efeSMatthias Ringwald 6*1f805efeSMatthias Ringwaldproject(BTstack) 7*1f805efeSMatthias Ringwald 8*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/micro-ecc) 9*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/bluedroid/decoder/include) 10*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/bluedroid/encoder/include) 11*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/md5) 12*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/hxcmod-player) 13*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/hxcmod-player/mod) 14*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/lwip/core/src/include) 15*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/lwip/dhcp-server) 16*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/rijndael) 17*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/yxml) 18*1f805efeSMatthias Ringwaldinclude_directories(../../3rd-party/tinydir) 19*1f805efeSMatthias Ringwaldinclude_directories(../../src) 20*1f805efeSMatthias Ringwaldinclude_directories(../../platform/posix) 21*1f805efeSMatthias Ringwaldinclude_directories(../../platform/embedded) 22*1f805efeSMatthias Ringwaldinclude_directories(../../platform/lwip) 23*1f805efeSMatthias Ringwaldinclude_directories(../../platform/lwip/port) 24*1f805efeSMatthias Ringwaldinclude_directories(.) 25*1f805efeSMatthias Ringwald 26*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_SRC "../../src/*.c" "../../example/sco_demo_util.c") 27*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_BLE "../../src/ble/*.c") 28*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_GATT "../../src/ble/gatt-service/*.c") 29*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_CLASSIC "../../src/classic/*.c") 30*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_MESH "../../src/mesh/*.c") 31*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_BLUEDROID "../../3rd-party/bluedroid/encoder/srce/*.c" "../../3rd-party/bluedroid/decoder/srce/*.c") 32*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_MD5 "../../3rd-party/md5/md5.c") 33*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_UECC "../../3rd-party/micro-ecc/uECC.c") 34*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_YXML "../../3rd-party/yxml/yxml.c") 35*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_HXCMOD "../../3rd-party/hxcmod-player/*.c" "../../3rd-party/hxcmod-player/mods/*.c") 36*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_RIJNDAEL "../../3rd-party/rijndael/rijndael.c") 37*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_POSIX "../../platform/posix/*.c") 38*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_LIBUSB "../../port/libusb/*.c" "../../platform/libusb/*.c") 39*1f805efeSMatthias Ringwald 40*1f805efeSMatthias Ringwaldset(LWIP_CORE_SRC 41*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/def.c 42*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/inet_chksum.c 43*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/init.c 44*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ip.c 45*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/mem.c 46*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/memp.c 47*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/netif.c 48*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/pbuf.c 49*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/tcp.c 50*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/tcp_in.c 51*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/tcp_out.c 52*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/timeouts.c 53*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/udp.c 54*1f805efeSMatthias Ringwald ) 55*1f805efeSMatthias Ringwaldset (LWIP_IPV4_SRC 56*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/acd.c 57*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/dhcp.c 58*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/etharp.c 59*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/icmp.c 60*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/ip4.c 61*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/ip4_addr.c 62*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/core/ipv4/ip4_frag.c 63*1f805efeSMatthias Ringwald ) 64*1f805efeSMatthias Ringwaldset (LWIP_NETIF_SRC 65*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/netif/ethernet.c 66*1f805efeSMatthias Ringwald ) 67*1f805efeSMatthias Ringwaldset (LWIP_HTTPD 68*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/apps/http/altcp_proxyconnect.c 69*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/apps/http/fs.c 70*1f805efeSMatthias Ringwald ../../3rd-party/lwip/core/src/apps/http/httpd.c 71*1f805efeSMatthias Ringwald ) 72*1f805efeSMatthias Ringwaldset (LWIP_DHCPD 73*1f805efeSMatthias Ringwald ../../3rd-party/lwip/dhcp-server/dhserver.c 74*1f805efeSMatthias Ringwald ) 75*1f805efeSMatthias Ringwaldset (LWIP_PORT 76*1f805efeSMatthias Ringwald ../../platform/lwip/port/sys_arch.c 77*1f805efeSMatthias Ringwald ../../platform/lwip/bnep_lwip.c 78*1f805efeSMatthias Ringwald ) 79*1f805efeSMatthias Ringwald 80*1f805efeSMatthias Ringwaldset (SOURCES_LWIP ${LWIP_CORE_SRC} ${LWIP_IPV4_SRC} ${LWIP_NETIF_SRC} ${LWIP_HTTPD} ${LWIP_DHCPD} ${LWIP_PORT}) 81*1f805efeSMatthias Ringwald 82*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c") 83*1f805efeSMatthias Ringwaldlist(REMOVE_ITEM SOURCES_BLE ${SOURCES_BLE_OFF}) 84*1f805efeSMatthias Ringwald 85*1f805efeSMatthias Ringwaldfile(GLOB SOURCES_POSIX_OFF "../../platform/posix/le_device_db_fs.c") 86*1f805efeSMatthias Ringwaldlist(REMOVE_ITEM SOURCES_POSIX ${SOURCES_POSIX_OFF}) 87*1f805efeSMatthias Ringwald 88*1f805efeSMatthias Ringwaldset(SOURCES 89*1f805efeSMatthias Ringwald ${SOURCES_MD5} 90*1f805efeSMatthias Ringwald ${SOURCES_YXML} 91*1f805efeSMatthias Ringwald ${SOURCES_BLUEDROID} 92*1f805efeSMatthias Ringwald ${SOURCES_POSIX} 93*1f805efeSMatthias Ringwald ${SOURCES_RIJNDAEL} 94*1f805efeSMatthias Ringwald ${SOURCES_SRC} 95*1f805efeSMatthias Ringwald ${SOURCES_BLE} 96*1f805efeSMatthias Ringwald ${SOURCES_GATT} 97*1f805efeSMatthias Ringwald ${SOURCES_MESH} 98*1f805efeSMatthias Ringwald ${SOURCES_CLASSIC} 99*1f805efeSMatthias Ringwald ${SOURCES_UECC} 100*1f805efeSMatthias Ringwald ${SOURCES_HXCMOD} 101*1f805efeSMatthias Ringwald ) 102*1f805efeSMatthias Ringwaldlist(SORT SOURCES) 103*1f805efeSMatthias Ringwald 104*1f805efeSMatthias Ringwald# create static lib 105*1f805efeSMatthias Ringwaldadd_library(btstack STATIC ${SOURCES}) 106*1f805efeSMatthias Ringwald 107*1f805efeSMatthias Ringwald# create fuzz targets 108*1f805efeSMatthias Ringwaldfile(GLOB TARGETS_C "fuzz_*.c") 109*1f805efeSMatthias Ringwald 110*1f805efeSMatthias Ringwaldadd_compile_options( -fsanitize=fuzzer,address) 111*1f805efeSMatthias Ringwaldadd_link_options( -fsanitize=fuzzer,address) 112*1f805efeSMatthias Ringwald 113*1f805efeSMatthias Ringwald# create targets 114*1f805efeSMatthias Ringwaldforeach(TARGET_FILE ${TARGETS_C}) 115*1f805efeSMatthias Ringwald get_filename_component(EXAMPLE ${TARGET_FILE} NAME_WE) 116*1f805efeSMatthias Ringwald add_executable(${EXAMPLE} ${TARGET_FILE} ) 117*1f805efeSMatthias Ringwald target_link_libraries(${EXAMPLE} btstack) 118*1f805efeSMatthias Ringwaldendforeach(TARGET_FILE) 119