xref: /btstack/port/windows-winusb/CMakeLists.txt (revision e111ffb10703cf0a1df6f3f94723cd20b75caadf)
18b0cf348SMatthias Ringwaldcmake_minimum_required (VERSION 3.5)
28b0cf348SMatthias Ringwald
38b0cf348SMatthias Ringwaldproject(BTstack-windows-winusb)
48b0cf348SMatthias Ringwald
5dce6d7b3SMatthias RingwaldSET(BTSTACK_ROOT ${CMAKE_SOURCE_DIR}/../..)
6dce6d7b3SMatthias Ringwald
78b0cf348SMatthias Ringwald# extra compiler warnings
88b0cf348SMatthias Ringwaldif ("${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang.*")
98b0cf348SMatthias Ringwald	# using Clang
108b0cf348SMatthias Ringwald	SET(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} -Wunused-variable -Wswitch-default -Werror")
118b0cf348SMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
128b0cf348SMatthias Ringwald	# using GCC
138b0cf348SMatthias Ringwald	SET(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} -Wunused-but-set-variable -Wunused-variable -Wswitch-default -Werror")
148b0cf348SMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
158b0cf348SMatthias Ringwald	# using Intel C++
168b0cf348SMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
178b0cf348SMatthias Ringwald	# using Visual Studio C++
188b0cf348SMatthias Ringwaldendif()
198b0cf348SMatthias Ringwald
2002bddf72SMatthias Ringwald# to generate .h from .gatt files
2102bddf72SMatthias Ringwaldfind_package (Python REQUIRED COMPONENTS Interpreter)
228b0cf348SMatthias Ringwaldinclude_directories(${CMAKE_CURRENT_BINARY_DIR})
238b0cf348SMatthias Ringwald
248b0cf348SMatthias Ringwald# local dir for btstack_config.h after build dir to avoid using .h from Makefile
258b0cf348SMatthias Ringwaldinclude_directories(.)
268b0cf348SMatthias Ringwald
278b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/bluedroid/decoder/include)
288b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/bluedroid/encoder/include)
298b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/micro-ecc)
308b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/lc3-google/include)
318b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/md5)
328b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/hxcmod-player)
338b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/hxcmod-player/mod)
348b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/rijndael)
358b0cf348SMatthias Ringwaldinclude_directories(../../3rd-party/yxml)
368b0cf348SMatthias Ringwaldinclude_directories(../../src)
378b0cf348SMatthias Ringwaldinclude_directories(../../chipset/zephyr)
388b0cf348SMatthias Ringwaldinclude_directories(../../platform/embedded)
398b0cf348SMatthias Ringwaldinclude_directories(../../platform/posix)
408b0cf348SMatthias Ringwaldinclude_directories(../../platform/windows)
418b0cf348SMatthias Ringwald
428b0cf348SMatthias Ringwaldfile(GLOB SOURCES_SRC       "../../src/*.c" "../../example/sco_demo_util.c" "../../platform/posix/wav_util.c")
438b0cf348SMatthias Ringwaldfile(GLOB SOURCES_BLUEDROID "../../3rd-party/bluedroid/encoder/srce/*.c" "../../3rd-party/bluedroid/decoder/srce/*.c")
448b0cf348SMatthias Ringwaldfile(GLOB SOURCES_CLASSIC   "../../src/classic/*.c")
458b0cf348SMatthias Ringwaldfile(GLOB SOURCES_BLE       "../../src/ble/*.c")
468b0cf348SMatthias Ringwaldfile(GLOB SOURCES_GATT      "../../src/ble/gatt-service/*.c")
478b0cf348SMatthias Ringwaldfile(GLOB SOURCES_UECC      "../../3rd-party/micro-ecc/uECC.c")
488b0cf348SMatthias Ringwaldfile(GLOB SOURCES_HXCMOD    "../../3rd-party/hxcmod-player/*.c"  "../../3rd-party/hxcmod-player/mods/*.c")
498b0cf348SMatthias Ringwaldfile(GLOB SOURCES_MD5       "../../3rd-party/md5/md5.c")
508b0cf348SMatthias Ringwaldfile(GLOB SOURCES_RIJNDAEL  "../../3rd-party/rijndael/rijndael.c")
518b0cf348SMatthias Ringwaldfile(GLOB SOURCES_WINDOWS   "../../platform/windows/*.c")
528b0cf348SMatthias Ringwaldfile(GLOB SOURCES_ZEPHYR    "../../chipset/zephyr/*.c")
538b0cf348SMatthias Ringwaldfile(GLOB SOURCES_LC3_GOOGLE "../../3rd-party/lc3-google/src/*.c")
548b0cf348SMatthias Ringwaldfile(GLOB SOURCES_PORT      "*.c")
558b0cf348SMatthias Ringwaldfile(GLOB SOURCES_YXML      "../../3rd-party/yxml/yxml.c")
568b0cf348SMatthias Ringwald
578b0cf348SMatthias Ringwaldfile(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c")
588b0cf348SMatthias Ringwaldlist(REMOVE_ITEM SOURCES_BLE   ${SOURCES_BLE_OFF})
598b0cf348SMatthias Ringwald
608b0cf348SMatthias Ringwald
618b0cf348SMatthias Ringwaldset(SOURCES
628b0cf348SMatthias Ringwald	${SOURCES_BLE}
638b0cf348SMatthias Ringwald	${SOURCES_BLUEDROID}
648b0cf348SMatthias Ringwald	${SOURCES_CLASSIC}
658b0cf348SMatthias Ringwald	${SOURCES_GATT}
668b0cf348SMatthias Ringwald	${SOURCES_HXCMOD}
678b0cf348SMatthias Ringwald	${SOURCES_MD5}
688b0cf348SMatthias Ringwald	${SOURCES_PORT}
698b0cf348SMatthias Ringwald	${SOURCES_RIJNDAEL}
708b0cf348SMatthias Ringwald	${SOURCES_SRC}
718b0cf348SMatthias Ringwald	${SOURCES_UECC}
728b0cf348SMatthias Ringwald	${SOURCES_WINDOWS}
738b0cf348SMatthias Ringwald	${SOURCES_YXML}
748b0cf348SMatthias Ringwald	${SOURCES_ZEPHYR}
758b0cf348SMatthias Ringwald)
768b0cf348SMatthias Ringwaldlist(SORT SOURCES)
778b0cf348SMatthias Ringwald
788b0cf348SMatthias Ringwald# create static lib
798b0cf348SMatthias Ringwaldadd_library(btstack STATIC ${SOURCES})
808b0cf348SMatthias Ringwald
818b0cf348SMatthias Ringwald# get list of examples, skipping mesh_node_demo
828b0cf348SMatthias Ringwaldinclude(../../example/CMakeLists.txt)
838b0cf348SMatthias Ringwaldset (EXAMPLES ${EXAMPLES_GENERAL} ${EXAMPLES_CLASSIC_ONLY}  ${EXAMPLES_LE_ONLY} ${EXAMPLES_DUAL_MODE})
848b0cf348SMatthias Ringwaldlist(REMOVE_DUPLICATES EXAMPLES)
858b0cf348SMatthias Ringwaldlist(REMOVE_ITEM EXAMPLES "mesh_node_demo")
868b0cf348SMatthias Ringwald
878b0cf348SMatthias Ringwald# create targets
888b0cf348SMatthias Ringwaldforeach(EXAMPLE ${EXAMPLES})
898b0cf348SMatthias Ringwald	# get c file
901e0ee29bSMatthias Ringwald	set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c)
918b0cf348SMatthias Ringwald
928b0cf348SMatthias Ringwald	# add GATT DB creation
938b0cf348SMatthias Ringwald	if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} )
948b0cf348SMatthias Ringwald		message("example ${EXAMPLE} -- with GATT DB")
958b0cf348SMatthias Ringwald	  	add_custom_command(
968b0cf348SMatthias Ringwald		    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
9702bddf72SMatthias Ringwald			DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
9802bddf72SMatthias Ringwald			COMMAND ${Python_EXECUTABLE}
9902bddf72SMatthias Ringwald			ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
1008b0cf348SMatthias Ringwald		)
1018b0cf348SMatthias Ringwald		list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
1028b0cf348SMatthias Ringwald	else()
1038b0cf348SMatthias Ringwald		message("example ${EXAMPLE}")
1048b0cf348SMatthias Ringwald	endif()
1051e0ee29bSMatthias Ringwald	add_executable(${EXAMPLE} ${SOURCES_EXAMPLE})
106*e111ffb1SMatthias Ringwald	target_link_libraries(${EXAMPLE} btstack setupapi winusb)
1078b0cf348SMatthias Ringwaldendforeach(EXAMPLE)
108