xref: /btstack/port/windows-h4/CMakeLists.txt (revision 02bddf72ded804ec650dff99a15cca6ff8460083)
14e03265bSMatthias Ringwaldcmake_minimum_required (VERSION 3.18)
24e03265bSMatthias Ringwald
34e03265bSMatthias Ringwaldproject(BTstack-windows-h4)
44e03265bSMatthias Ringwald
54e03265bSMatthias RingwaldSET(BTSTACK_ROOT ${CMAKE_SOURCE_DIR}/../..)
64e03265bSMatthias Ringwald
74e03265bSMatthias Ringwald# extra compiler warnings
84e03265bSMatthias Ringwaldif ("${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang.*")
94e03265bSMatthias Ringwald	# using Clang
104e03265bSMatthias Ringwald	SET(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} -Wunused-variable -Wswitch-default -Werror")
114e03265bSMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
124e03265bSMatthias Ringwald	# using GCC
134e03265bSMatthias Ringwald	SET(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} -Wunused-but-set-variable -Wunused-variable -Wswitch-default -Werror")
144e03265bSMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
154e03265bSMatthias Ringwald	# using Intel C++
164e03265bSMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
174e03265bSMatthias Ringwald	# using Visual Studio C++
184e03265bSMatthias Ringwaldendif()
194e03265bSMatthias Ringwald
20*02bddf72SMatthias Ringwald# to generate .h from .gatt files
21*02bddf72SMatthias Ringwaldfind_package (Python REQUIRED COMPONENTS Interpreter)
224e03265bSMatthias Ringwaldinclude_directories(${CMAKE_CURRENT_BINARY_DIR})
234e03265bSMatthias Ringwald
244e03265bSMatthias Ringwald# local dir for btstack_config.h after build dir to avoid using .h from Makefile
254e03265bSMatthias Ringwaldinclude_directories(.)
264e03265bSMatthias Ringwald
274e03265bSMatthias Ringwald
284e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/micro-ecc)
294e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include)
304e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include)
314e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/lc3-google/include)
324e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/md5)
334e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/hxcmod-player)
344e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/hxcmod-player/mod)
354e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/lwip/core/src/include)
364e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server)
374e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/rijndael)
384e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/yxml)
394e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/3rd-party/tinydir)
404e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/src)
414e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/chipset/bcm)
424e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/chipset/csr)
434e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/chipset/cc256x)
444e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/chipset/em9301)
454e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/chipset/realtek)
464e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/chipset/tc3566x)
474e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/chipset/stlc2500d)
484e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/chipset/zephyr)
494e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/platform/embedded)
504e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/platform/lwip)
514e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/platform/lwip/port)
524e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/platform/windows)
534e03265bSMatthias Ringwaldinclude_directories(${BTSTACK_ROOT}/platform/posix)
544e03265bSMatthias Ringwald
554e03265bSMatthias Ringwaldfile(GLOB SOURCES_SRC       "${BTSTACK_ROOT}/src/*.c" "${BTSTACK_ROOT}/example/sco_demo_util.c")
564e03265bSMatthias Ringwaldfile(GLOB SOURCES_BLE       "${BTSTACK_ROOT}/src/ble/*.c")
574e03265bSMatthias Ringwaldfile(GLOB SOURCES_BLUEDROID "${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce/*.c" "${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce/*.c")
584e03265bSMatthias Ringwaldfile(GLOB SOURCES_CLASSIC   "${BTSTACK_ROOT}/src/classic/*.c")
594e03265bSMatthias Ringwaldfile(GLOB SOURCES_MESH      "${BTSTACK_ROOT}/src/mesh/*.c")
604e03265bSMatthias Ringwaldfile(GLOB SOURCES_GATT      "${BTSTACK_ROOT}/src/ble/gatt-service/*.c")
614e03265bSMatthias Ringwaldfile(GLOB SOURCES_UECC      "${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c")
624e03265bSMatthias Ringwaldfile(GLOB SOURCES_HXCMOD    "${BTSTACK_ROOT}/3rd-party/hxcmod-player/*.c"  "${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods/*.c")
634e03265bSMatthias Ringwaldfile(GLOB SOURCES_MD5       "${BTSTACK_ROOT}/3rd-party/md5/md5.c")
644e03265bSMatthias Ringwaldfile(GLOB SOURCES_RIJNDAEL  "${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c")
654e03265bSMatthias Ringwaldfile(GLOB SOURCES_YXML      "${BTSTACK_ROOT}/3rd-party/yxml/yxml.c")
664e03265bSMatthias Ringwaldfile(GLOB SOURCES_WINDOWS   "${BTSTACK_ROOT}/platform/windows/*.c" ${BTSTACK_ROOT}/platform/posix/wav_util.c)
674e03265bSMatthias Ringwaldfile(GLOB SOURCES_BCM       "${BTSTACK_ROOT}/chipset/bcm/*.c")
684e03265bSMatthias Ringwaldfile(GLOB SOURCES_CSR       "${BTSTACK_ROOT}/chipset/csr/*.c")
694e03265bSMatthias Ringwaldfile(GLOB SOURCES_EM9301    "${BTSTACK_ROOT}/chipset/em9301/*.c")
704e03265bSMatthias Ringwaldfile(GLOB SOURCES_STLC2500D "${BTSTACK_ROOT}/chipset/stlc2500d/*.c")
714e03265bSMatthias Ringwaldfile(GLOB SOURCES_TC2566X   "${BTSTACK_ROOT}/chipset/tc3566x/*.c")
724e03265bSMatthias Ringwaldfile(GLOB SOURCES_REALTEK   "${BTSTACK_ROOT}/chipset/realtek/*.c")
734e03265bSMatthias Ringwaldfile(GLOB SOURCES_ZEPHYR    "${BTSTACK_ROOT}/chipset/zephyr/*.c")
744e03265bSMatthias Ringwaldfile(GLOB SOURCES_LC3_GOOGLE "${BTSTACK_ROOT}/3rd-party/lc3-google/src/*.c")
754e03265bSMatthias Ringwaldfile(GLOB SOURCES_PORT      "*.c")
764e03265bSMatthias Ringwald
774e03265bSMatthias Ringwaldset(LWIP_CORE_SRC
784e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/def.c
794e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/inet_chksum.c
804e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/init.c
814e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ip.c
824e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/mem.c
834e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/memp.c
844e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/netif.c
854e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/pbuf.c
864e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp.c
874e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp_in.c
884e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp_out.c
894e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/timeouts.c
904e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/udp.c
914e03265bSMatthias Ringwald		)
924e03265bSMatthias Ringwaldset (LWIP_IPV4_SRC
934e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/acd.c
944e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/dhcp.c
954e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/etharp.c
964e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/icmp.c
974e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4.c
984e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4_addr.c
994e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4_frag.c
1004e03265bSMatthias Ringwald		)
1014e03265bSMatthias Ringwaldset (LWIP_NETIF_SRC
1024e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/netif/ethernet.c
1034e03265bSMatthias Ringwald		)
1044e03265bSMatthias Ringwaldset (LWIP_HTTPD
1054e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/altcp_proxyconnect.c
1064e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/fs.c
1074e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/httpd.c
1084e03265bSMatthias Ringwald		)
1094e03265bSMatthias Ringwaldset (LWIP_DHCPD
1104e03265bSMatthias Ringwald		${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server/dhserver.c
1114e03265bSMatthias Ringwald		)
1124e03265bSMatthias Ringwaldset (LWIP_PORT
1134e03265bSMatthias Ringwald		${BTSTACK_ROOT}/platform/lwip/port/sys_arch.c
1144e03265bSMatthias Ringwald		${BTSTACK_ROOT}//platform/lwip/bnep_lwip.c
1154e03265bSMatthias Ringwald		)
1164e03265bSMatthias Ringwaldset (SOURCES_LWIP ${LWIP_CORE_SRC} ${LWIP_IPV4_SRC} ${LWIP_NETIF_SRC} ${LWIP_HTTPD} ${LWIP_DHCPD} ${LWIP_PORT})
1174e03265bSMatthias Ringwald
1184e03265bSMatthias Ringwaldfile(GLOB SOURCES_BLE_OFF "${BTSTACK_ROOT}/src/ble/le_device_db_memory.c")
1194e03265bSMatthias Ringwaldlist(REMOVE_ITEM SOURCES_BLE   ${SOURCES_BLE_OFF})
1204e03265bSMatthias Ringwald
1214e03265bSMatthias Ringwaldfile(GLOB SOURCES_POSIX_OFF "${BTSTACK_ROOT}/platform/posix/le_device_db_fs.c")
1224e03265bSMatthias Ringwaldlist(REMOVE_ITEM SOURCES_POSIX   ${SOURCES_POSIX_OFF})
1234e03265bSMatthias Ringwald
1244e03265bSMatthias Ringwaldset(SOURCES
1254e03265bSMatthias Ringwald		${SOURCES_BLE}
1264e03265bSMatthias Ringwald		${SOURCES_BCM}
1274e03265bSMatthias Ringwald		${SOURCES_BLUEDROID}
1284e03265bSMatthias Ringwald		${SOURCES_CLASSIC}
1294e03265bSMatthias Ringwald		${SOURCES_CSR}
1304e03265bSMatthias Ringwald		${SOURCES_EM9301}
1314e03265bSMatthias Ringwald		${SOURCES_GATT}
1324e03265bSMatthias Ringwald		${SOURCES_HXCMOD}
1334e03265bSMatthias Ringwald		${SOURCES_HXCMOD}
1344e03265bSMatthias Ringwald		${SOURCES_LIBUSB}
1354e03265bSMatthias Ringwald		${SOURCES_MD5}
1364e03265bSMatthias Ringwald		${SOURCES_PORT}
1374e03265bSMatthias Ringwald		${SOURCES_REALTEK}
1384e03265bSMatthias Ringwald		${SOURCES_RIJNDAEL}
1394e03265bSMatthias Ringwald		${SOURCES_SRC}
1404e03265bSMatthias Ringwald		${SOURCES_CC256X}
1414e03265bSMatthias Ringwald		${SOURCES_CSR}
1424e03265bSMatthias Ringwald		${SOURCES_STLC2500D}
1434e03265bSMatthias Ringwald		${SOURCES_TC2566X}
1444e03265bSMatthias Ringwald		${SOURCES_UECC}
1454e03265bSMatthias Ringwald		${SOURCES_WINDOWS}
1464e03265bSMatthias Ringwald		${SOURCES_YXML}
1474e03265bSMatthias Ringwald		${SOURCES_ZEPHYR}
1484e03265bSMatthias Ringwald)
1494e03265bSMatthias Ringwaldlist(SORT SOURCES)
1504e03265bSMatthias Ringwald
1514e03265bSMatthias Ringwald# create static lib
1524e03265bSMatthias Ringwaldadd_library(btstack STATIC ${SOURCES})
1534e03265bSMatthias Ringwald
1544e03265bSMatthias Ringwald# Add CC256x Support and specify init script
1554e03265bSMatthias Ringwaldset (CC256X_INIT_SCRIPT bluetooth_init_cc2564C_1.5.c)
1564e03265bSMatthias Ringwaldinclude(${BTSTACK_ROOT}/chipset/cc256x/cc256x.cmake)
1574e03265bSMatthias Ringwald
1584e03265bSMatthias Ringwald# Add BCM Support and download PatchRAM files
1594e03265bSMatthias Ringwaldinclude(${BTSTACK_ROOT}/chipset/bcm/bcm.cmake)
1604e03265bSMatthias Ringwald
1614e03265bSMatthias Ringwald# get list of examples, skipping mesh_node_demo
1624e03265bSMatthias Ringwaldinclude(../../example/CMakeLists.txt)
1634e03265bSMatthias Ringwaldset (EXAMPLES ${EXAMPLES_GENERAL} ${EXAMPLES_CLASSIC_ONLY}  ${EXAMPLES_LE_ONLY} ${EXAMPLES_DUAL_MODE})
1644e03265bSMatthias Ringwaldlist(REMOVE_DUPLICATES EXAMPLES)
1654e03265bSMatthias Ringwaldlist(REMOVE_ITEM EXAMPLES "mesh_node_demo")
1664e03265bSMatthias Ringwald
1674e03265bSMatthias Ringwald# create targets
1684e03265bSMatthias Ringwaldforeach(EXAMPLE ${EXAMPLES})
1694e03265bSMatthias Ringwald	# get c file
1704e03265bSMatthias Ringwald	file(GLOB EXAMPLE_FILE "${BTSTACK_ROOT}/example/${EXAMPLE}.c")
1714e03265bSMatthias Ringwald	set (SOURCE_FILES ${EXAMPLE_FILE})
1724e03265bSMatthias Ringwald
1734e03265bSMatthias Ringwald	# add GATT DB creation
1744e03265bSMatthias Ringwald	if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} )
1754e03265bSMatthias Ringwald		message("example ${EXAMPLE} -- with GATT DB")
1764e03265bSMatthias Ringwald		add_custom_command(
1774e03265bSMatthias Ringwald		    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
1784e03265bSMatthias Ringwald			DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
179*02bddf72SMatthias Ringwald			COMMAND ${Python_EXECUTABLE}
1804e03265bSMatthias Ringwald			ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
1814e03265bSMatthias Ringwald		)
1824e03265bSMatthias Ringwald		list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
1834e03265bSMatthias Ringwald	else()
1844e03265bSMatthias Ringwald		message("example ${EXAMPLE}")
1854e03265bSMatthias Ringwald	endif()
1864e03265bSMatthias Ringwald	add_executable(${EXAMPLE} ${SOURCE_FILES} )
1874e03265bSMatthias Ringwald	target_link_libraries(${EXAMPLE} btstack)
1884e03265bSMatthias Ringwaldendforeach(EXAMPLE)
189