From cb97e8fb73f68fc44b8ae2e396218ac075cdca59 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 29 Apr 2022 13:23:31 +0200 Subject: [PATCH] windows-h4-zephyr: provide CMake file --- port/windows-h4-zephyr/CMakeLists.txt | 94 +++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 port/windows-h4-zephyr/CMakeLists.txt diff --git a/port/windows-h4-zephyr/CMakeLists.txt b/port/windows-h4-zephyr/CMakeLists.txt new file mode 100644 index 000000000..e864dace0 --- /dev/null +++ b/port/windows-h4-zephyr/CMakeLists.txt @@ -0,0 +1,94 @@ +cmake_minimum_required (VERSION 3.5) + +project(BTstack-windows-h4-zephyr) + +# extra compiler warnings +if ("${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang.*") + # using Clang + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-variable -Wswitch-default -Werror") +elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + # using GCC + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable -Wunused-variable -Wswitch-default -Werror") +elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel") + # using Intel C++ +elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") + # using Visual Studio C++ +endif() + +# to find generated .h from .gatt files +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +# local dir for btstack_config.h after build dir to avoid using .h from Makefile +include_directories(.) + +include_directories(../../3rd-party/micro-ecc) +include_directories(../../3rd-party/lc3-google/include) +include_directories(../../3rd-party/md5) +include_directories(../../3rd-party/hxcmod-player) +include_directories(../../3rd-party/hxcmod-player/mod) +include_directories(../../3rd-party/rijndael) +include_directories(../../src) +include_directories(../../chipset/zephyr) +include_directories(../../platform/embedded) +include_directories(../../platform/windows) + +file(GLOB SOURCES_SRC "../../src/*.c") +file(GLOB SOURCES_BLE "../../src/ble/*.c") +file(GLOB SOURCES_GATT "../../src/ble/gatt-service/*.c") +file(GLOB SOURCES_UECC "../../3rd-party/micro-ecc/uECC.c") +file(GLOB SOURCES_HXCMOD "../../3rd-party/hxcmod-player/*.c" "../../3rd-party/hxcmod-player/mods/*.c") +file(GLOB SOURCES_RIJNDAEL "../../3rd-party/rijndael/rijndael.c") +file(GLOB SOURCES_WINDOWS "../../platform/windows/*.c") +file(GLOB SOURCES_ZEPHYR "../../chipset/zephyr/*.c") +file(GLOB SOURCES_LC3_GOOGLE "../../3rd-party/lc3-google/src/*.c") +file(GLOB SOURCES_PORT "*.c") + +file(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c") +list(REMOVE_ITEM SOURCES_BLE ${SOURCES_BLE_OFF}) + +file(GLOB SOURCES_WINDOWS_OFF "../../platform/windows/hci_transport_h2_winusb.c") +list(REMOVE_ITEM SOURCES_WINDOWS ${SOURCES_WINDOWS_OFF}) + + +set(SOURCES + ${SOURCES_BLE} + ${SOURCES_GATT} + ${SOURCES_HXCMOD} + ${SOURCES_PORT} + ${SOURCES_RIJNDAEL} + ${SOURCES_SRC} + ${SOURCES_UECC} + ${SOURCES_ZEPHYR} + ${SOURCES_WINDOWS} +) +list(SORT SOURCES) + +# create static lib +add_library(btstack STATIC ${SOURCES}) + +# get list of examples, skipping mesh_node_demo +include(../../example/CMakeLists.txt) +set (EXAMPLES ${EXAMPLES_LE_ONLY} ${EXAMPLES_GENERAL}) +list(REMOVE_ITEM EXAMPLES "mesh_node_demo") + +# create targets +foreach(EXAMPLE ${EXAMPLES}) + # get c file + file(GLOB EXAMPLE_FILE "../../example/${EXAMPLE}.c") + + # add GATT DB creation + if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} ) + message("example ${EXAMPLE} -- with GATT DB") + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h + DEPENDS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt + COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py + ARGS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h + ) + list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h) + else() + message("example ${EXAMPLE}") + endif() + add_executable(${EXAMPLE} ${EXAMPLE_FILE} ) + target_link_libraries(${EXAMPLE} btstack) +endforeach(EXAMPLE)