xref: /btstack/port/windows-h4-zephyr/CMakeLists.txt (revision dce6d7b3e954ac46196136465f75a9848137c8e2)
1cb97e8fbSMatthias Ringwaldcmake_minimum_required (VERSION 3.5)
2cb97e8fbSMatthias Ringwald
3cb97e8fbSMatthias Ringwaldproject(BTstack-windows-h4-zephyr)
4cb97e8fbSMatthias Ringwald
5*dce6d7b3SMatthias RingwaldSET(BTSTACK_ROOT ${CMAKE_SOURCE_DIR}/../..)
6*dce6d7b3SMatthias Ringwald
7cb97e8fbSMatthias Ringwald# extra compiler warnings
8cb97e8fbSMatthias Ringwaldif ("${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang.*")
9cb97e8fbSMatthias Ringwald	# using Clang
10cb97e8fbSMatthias Ringwald	SET(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} -Wunused-variable -Wswitch-default -Werror")
11cb97e8fbSMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
12cb97e8fbSMatthias Ringwald	# using GCC
13cb97e8fbSMatthias Ringwald	SET(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} -Wunused-but-set-variable -Wunused-variable -Wswitch-default -Werror")
14cb97e8fbSMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
15cb97e8fbSMatthias Ringwald	# using Intel C++
16cb97e8fbSMatthias Ringwaldelseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
17cb97e8fbSMatthias Ringwald	# using Visual Studio C++
18cb97e8fbSMatthias Ringwaldendif()
19cb97e8fbSMatthias Ringwald
2002bddf72SMatthias Ringwald# to generate .h from .gatt files
2102bddf72SMatthias Ringwaldfind_package (Python REQUIRED COMPONENTS Interpreter)
22cb97e8fbSMatthias Ringwaldinclude_directories(${CMAKE_CURRENT_BINARY_DIR})
23cb97e8fbSMatthias Ringwald
24cb97e8fbSMatthias Ringwald# local dir for btstack_config.h after build dir to avoid using .h from Makefile
25cb97e8fbSMatthias Ringwaldinclude_directories(.)
26cb97e8fbSMatthias Ringwald
27cb97e8fbSMatthias Ringwaldinclude_directories(../../3rd-party/micro-ecc)
28cb97e8fbSMatthias Ringwaldinclude_directories(../../3rd-party/lc3-google/include)
29cb97e8fbSMatthias Ringwaldinclude_directories(../../3rd-party/md5)
30cb97e8fbSMatthias Ringwaldinclude_directories(../../3rd-party/hxcmod-player)
31cb97e8fbSMatthias Ringwaldinclude_directories(../../3rd-party/hxcmod-player/mod)
32cb97e8fbSMatthias Ringwaldinclude_directories(../../3rd-party/rijndael)
33cb97e8fbSMatthias Ringwaldinclude_directories(../../src)
34cb97e8fbSMatthias Ringwaldinclude_directories(../../chipset/zephyr)
35cb97e8fbSMatthias Ringwaldinclude_directories(../../platform/embedded)
36cb97e8fbSMatthias Ringwaldinclude_directories(../../platform/windows)
37cb97e8fbSMatthias Ringwald
38cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_SRC       "../../src/*.c")
39cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_BLE       "../../src/ble/*.c")
40cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_GATT      "../../src/ble/gatt-service/*.c")
41cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_UECC      "../../3rd-party/micro-ecc/uECC.c")
42cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_HXCMOD    "../../3rd-party/hxcmod-player/*.c"  "../../3rd-party/hxcmod-player/mods/*.c")
43cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_RIJNDAEL  "../../3rd-party/rijndael/rijndael.c")
44cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_WINDOWS   "../../platform/windows/*.c")
45cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_ZEPHYR    "../../chipset/zephyr/*.c")
46cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_LC3_GOOGLE "../../3rd-party/lc3-google/src/*.c")
47cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_PORT      "*.c")
48cb97e8fbSMatthias Ringwald
49cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c")
50cb97e8fbSMatthias Ringwaldlist(REMOVE_ITEM SOURCES_BLE   ${SOURCES_BLE_OFF})
51cb97e8fbSMatthias Ringwald
52cb97e8fbSMatthias Ringwaldfile(GLOB SOURCES_WINDOWS_OFF "../../platform/windows/hci_transport_h2_winusb.c")
53cb97e8fbSMatthias Ringwaldlist(REMOVE_ITEM SOURCES_WINDOWS   ${SOURCES_WINDOWS_OFF})
54cb97e8fbSMatthias Ringwald
55cb97e8fbSMatthias Ringwald
56cb97e8fbSMatthias Ringwaldset(SOURCES
57cb97e8fbSMatthias Ringwald	${SOURCES_BLE}
58cb97e8fbSMatthias Ringwald	${SOURCES_GATT}
59cb97e8fbSMatthias Ringwald	${SOURCES_HXCMOD}
60cb97e8fbSMatthias Ringwald	${SOURCES_PORT}
61cb97e8fbSMatthias Ringwald	${SOURCES_RIJNDAEL}
62cb97e8fbSMatthias Ringwald	${SOURCES_SRC}
63cb97e8fbSMatthias Ringwald	${SOURCES_UECC}
64cb97e8fbSMatthias Ringwald	${SOURCES_ZEPHYR}
65cb97e8fbSMatthias Ringwald	${SOURCES_WINDOWS}
66cb97e8fbSMatthias Ringwald)
67cb97e8fbSMatthias Ringwaldlist(SORT SOURCES)
68cb97e8fbSMatthias Ringwald
69cb97e8fbSMatthias Ringwald# create static lib
70cb97e8fbSMatthias Ringwaldadd_library(btstack STATIC ${SOURCES})
71cb97e8fbSMatthias Ringwald
72cb97e8fbSMatthias Ringwald# get list of examples, skipping mesh_node_demo
73cb97e8fbSMatthias Ringwaldinclude(../../example/CMakeLists.txt)
74cb97e8fbSMatthias Ringwaldset (EXAMPLES ${EXAMPLES_LE_ONLY} ${EXAMPLES_GENERAL})
75cb97e8fbSMatthias Ringwaldlist(REMOVE_ITEM EXAMPLES "mesh_node_demo")
76cb97e8fbSMatthias Ringwald
77cb97e8fbSMatthias Ringwald# create targets
78cb97e8fbSMatthias Ringwaldforeach(EXAMPLE ${EXAMPLES})
79cb97e8fbSMatthias Ringwald	# get c file
80cb97e8fbSMatthias Ringwald	file(GLOB EXAMPLE_FILE "../../example/${EXAMPLE}.c")
81cb97e8fbSMatthias Ringwald
82cb97e8fbSMatthias Ringwald	# add GATT DB creation
83cb97e8fbSMatthias Ringwald	if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} )
84cb97e8fbSMatthias Ringwald		message("example ${EXAMPLE} -- with GATT DB")
85cb97e8fbSMatthias Ringwald		add_custom_command(
86cb97e8fbSMatthias Ringwald		    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
8702bddf72SMatthias Ringwald			DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
8802bddf72SMatthias Ringwald			COMMAND ${Python_EXECUTABLE}
8902bddf72SMatthias Ringwald			ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
90cb97e8fbSMatthias Ringwald		)
91cb97e8fbSMatthias Ringwald		list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
92cb97e8fbSMatthias Ringwald	else()
93cb97e8fbSMatthias Ringwald		message("example ${EXAMPLE}")
94cb97e8fbSMatthias Ringwald	endif()
95cb97e8fbSMatthias Ringwald	add_executable(${EXAMPLE} ${EXAMPLE_FILE} )
96cb97e8fbSMatthias Ringwald	target_link_libraries(${EXAMPLE} btstack)
97cb97e8fbSMatthias Ringwaldendforeach(EXAMPLE)
98