1cmake_minimum_required (VERSION 3.5) 2 3project(BTstack-windows-winusb-intel) 4 5SET(BTSTACK_ROOT ${CMAKE_SOURCE_DIR}/../..) 6 7# extra compiler warnings 8if ("${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang.*") 9 # using Clang 10 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-variable -Wswitch-default -Werror") 11elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") 12 # using GCC 13 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable -Wunused-variable -Wswitch-default -Werror") 14elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel") 15 # using Intel C++ 16elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") 17 # using Visual Studio C++ 18endif() 19 20# Generate .h from .gatt files 21find_package (Python COMPONENTS Interpreter) 22include_directories(${CMAKE_CURRENT_BINARY_DIR}) 23message ("Python: ${Python_EXECUTABLE}") 24 25# local dir for btstack_config.h after build dir to avoid using .h from Makefile 26include_directories(.) 27 28include_directories(../../3rd-party/bluedroid/decoder/include) 29include_directories(../../3rd-party/bluedroid/encoder/include) 30include_directories(../../3rd-party/micro-ecc) 31include_directories(../../3rd-party/lc3-google/include) 32include_directories(../../3rd-party/md5) 33include_directories(../../3rd-party/hxcmod-player) 34include_directories(../../3rd-party/hxcmod-player/mod) 35include_directories(../../3rd-party/rijndael) 36include_directories(../../3rd-party/yxml) 37include_directories(../../src) 38include_directories(../../chipset/csr) 39include_directories(../../chipset/intel) 40include_directories(../../chipset/zephyr) 41include_directories(../../platform/embedded) 42include_directories(../../platform/posix) 43include_directories(../../platform/windows) 44 45file(GLOB SOURCES_SRC "../../src/*.c" "../../example/sco_demo_util.c" "../../platform/posix/wav_util.c") 46file(GLOB SOURCES_BLUEDROID "../../3rd-party/bluedroid/encoder/srce/*.c" "../../3rd-party/bluedroid/decoder/srce/*.c") 47file(GLOB SOURCES_CLASSIC "../../src/classic/*.c") 48file(GLOB SOURCES_BLE "../../src/ble/*.c") 49file(GLOB SOURCES_GATT "../../src/ble/gatt-service/*.c") 50file(GLOB SOURCES_UECC "../../3rd-party/micro-ecc/uECC.c") 51file(GLOB SOURCES_HXCMOD "../../3rd-party/hxcmod-player/*.c" "../../3rd-party/hxcmod-player/mods/*.c") 52file(GLOB SOURCES_MD5 "../../3rd-party/md5/md5.c") 53file(GLOB SOURCES_RIJNDAEL "../../3rd-party/rijndael/rijndael.c") 54file(GLOB SOURCES_WINDOWS "../../platform/windows/*.c") 55file(GLOB SOURCES_CSR "../../chipset/csr/*.c") 56file(GLOB SOURCES_INTEL "../../chipset/intel/*.c") 57file(GLOB SOURCES_ZEPHYR "../../chipset/zephyr/*.c") 58file(GLOB SOURCES_LC3_GOOGLE "../../3rd-party/lc3-google/src/*.c") 59file(GLOB SOURCES_PORT "*.c") 60file(GLOB SOURCES_YXML "../../3rd-party/yxml/yxml.c") 61 62file(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c") 63list(REMOVE_ITEM SOURCES_BLE ${SOURCES_BLE_OFF}) 64 65 66set(SOURCES 67 ${SOURCES_BLE} 68 ${SOURCES_BLUEDROID} 69 ${SOURCES_CLASSIC} 70 ${SOURCES_GATT} 71 ${SOURCES_HXCMOD} 72 ${SOURCES_MD5} 73 ${SOURCES_PORT} 74 ${SOURCES_RIJNDAEL} 75 ${SOURCES_SRC} 76 ${SOURCES_UECC} 77 ${SOURCES_WINDOWS} 78 ${SOURCES_YXML} 79 ${SOURCES_CSR} 80 ${SOURCES_INTEL} 81 ${SOURCES_ZEPHYR} 82) 83list(SORT SOURCES) 84 85# create static lib 86add_library(btstack STATIC ${SOURCES}) 87 88# get list of examples, skipping mesh_node_demo 89include(../../example/CMakeLists.txt) 90set (EXAMPLES ${EXAMPLES_GENERAL} ${EXAMPLES_CLASSIC_ONLY} ${EXAMPLES_LE_ONLY} ${EXAMPLES_DUAL_MODE}) 91list(REMOVE_DUPLICATES EXAMPLES) 92list(REMOVE_ITEM EXAMPLES "mesh_node_demo") 93 94# create targets 95foreach(EXAMPLE ${EXAMPLES}) 96 # get c file 97 set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c) 98 99 # add GATT DB creation 100 if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} ) 101 message("example ${EXAMPLE} -- with GATT DB") 102 add_custom_command( 103 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h 104 DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt 105 COMMAND ${Python_EXECUTABLE} 106 ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h 107 ) 108 list(APPEND SOURCES_EXAMPLE ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h) 109 else() 110 message("example ${EXAMPLE}") 111 endif() 112 add_executable(${EXAMPLE} ${SOURCES_EXAMPLE}) 113 target_link_libraries(${EXAMPLE} btstack setupapi winusb) 114endforeach(EXAMPLE) 115