From 8f3fea300af612062cc3a4cba0fd3b59b613a050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 13 Jun 2018 14:13:27 +0200 Subject: [PATCH] cmake: bluetooth: Don't #include gatt files from src files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to a bug in KBuild, bluetooth samples needed to #include the gatt sources to re-use code between samples. This bug was not ported to CMake so we can stop applying this workaround. gatt source files are now directly added to the 'app' library instead of having adapter source files in the app's src directory that \#include's the gatt files. Signed-off-by: Sebastian Bøe --- samples/bluetooth/peripheral/CMakeLists.txt | 8 ++++---- samples/bluetooth/peripheral/src/bas.c | 2 -- samples/bluetooth/peripheral/src/cts.c | 2 -- samples/bluetooth/peripheral/src/dis.c | 2 -- samples/bluetooth/peripheral/src/hrs.c | 2 -- samples/bluetooth/peripheral_csc/CMakeLists.txt | 6 +++++- samples/bluetooth/peripheral_csc/src/bas.c | 2 -- samples/bluetooth/peripheral_csc/src/dis.c | 2 -- samples/bluetooth/peripheral_dis/CMakeLists.txt | 5 ++++- samples/bluetooth/peripheral_dis/src/dis.c | 2 -- samples/bluetooth/peripheral_esp/CMakeLists.txt | 4 ++-- samples/bluetooth/peripheral_esp/src/bas.c | 2 -- samples/bluetooth/peripheral_esp/src/dis.c | 2 -- samples/bluetooth/peripheral_hids/CMakeLists.txt | 7 ++++++- samples/bluetooth/peripheral_hids/src/bas.c | 2 -- samples/bluetooth/peripheral_hids/src/dis.c | 2 -- samples/bluetooth/peripheral_hids/src/hog.c | 2 -- samples/bluetooth/peripheral_hr/CMakeLists.txt | 7 ++++++- samples/bluetooth/peripheral_hr/src/bas.c | 2 -- samples/bluetooth/peripheral_hr/src/dis.c | 2 -- samples/bluetooth/peripheral_hr/src/hrs.c | 2 -- 21 files changed, 27 insertions(+), 40 deletions(-) delete mode 100644 samples/bluetooth/peripheral/src/bas.c delete mode 100644 samples/bluetooth/peripheral/src/cts.c delete mode 100644 samples/bluetooth/peripheral/src/dis.c delete mode 100644 samples/bluetooth/peripheral/src/hrs.c delete mode 100644 samples/bluetooth/peripheral_csc/src/bas.c delete mode 100644 samples/bluetooth/peripheral_csc/src/dis.c delete mode 100644 samples/bluetooth/peripheral_dis/src/dis.c delete mode 100644 samples/bluetooth/peripheral_esp/src/bas.c delete mode 100644 samples/bluetooth/peripheral_esp/src/dis.c delete mode 100644 samples/bluetooth/peripheral_hids/src/bas.c delete mode 100644 samples/bluetooth/peripheral_hids/src/dis.c delete mode 100644 samples/bluetooth/peripheral_hids/src/hog.c delete mode 100644 samples/bluetooth/peripheral_hr/src/bas.c delete mode 100644 samples/bluetooth/peripheral_hr/src/dis.c delete mode 100644 samples/bluetooth/peripheral_hr/src/hrs.c diff --git a/samples/bluetooth/peripheral/CMakeLists.txt b/samples/bluetooth/peripheral/CMakeLists.txt index 3177fd301da..8c9abd093b8 100644 --- a/samples/bluetooth/peripheral/CMakeLists.txt +++ b/samples/bluetooth/peripheral/CMakeLists.txt @@ -3,10 +3,10 @@ project(NONE) target_sources(app PRIVATE src/main.c - src/hrs.c - src/dis.c - src/bas.c - src/cts.c + ../gatt/hrs.c + ../gatt/dis.c + ../gatt/bas.c + ../gatt/cts.c ) zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral/src/bas.c b/samples/bluetooth/peripheral/src/bas.c deleted file mode 100644 index 2c05cf3ea60..00000000000 --- a/samples/bluetooth/peripheral/src/bas.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/bas.c" diff --git a/samples/bluetooth/peripheral/src/cts.c b/samples/bluetooth/peripheral/src/cts.c deleted file mode 100644 index fc9954274f8..00000000000 --- a/samples/bluetooth/peripheral/src/cts.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/cts.c" diff --git a/samples/bluetooth/peripheral/src/dis.c b/samples/bluetooth/peripheral/src/dis.c deleted file mode 100644 index 86abf067eec..00000000000 --- a/samples/bluetooth/peripheral/src/dis.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/dis.c" diff --git a/samples/bluetooth/peripheral/src/hrs.c b/samples/bluetooth/peripheral/src/hrs.c deleted file mode 100644 index b2e887d1ec2..00000000000 --- a/samples/bluetooth/peripheral/src/hrs.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/hrs.c" diff --git a/samples/bluetooth/peripheral_csc/CMakeLists.txt b/samples/bluetooth/peripheral_csc/CMakeLists.txt index 37764b00b3d..d35693a52ab 100644 --- a/samples/bluetooth/peripheral_csc/CMakeLists.txt +++ b/samples/bluetooth/peripheral_csc/CMakeLists.txt @@ -2,6 +2,10 @@ include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(NONE) FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) +target_sources(app PRIVATE + ${app_sources} + ../gatt/dis.c + ../gatt/bas.c + ) zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_csc/src/bas.c b/samples/bluetooth/peripheral_csc/src/bas.c deleted file mode 100644 index 2c05cf3ea60..00000000000 --- a/samples/bluetooth/peripheral_csc/src/bas.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/bas.c" diff --git a/samples/bluetooth/peripheral_csc/src/dis.c b/samples/bluetooth/peripheral_csc/src/dis.c deleted file mode 100644 index 86abf067eec..00000000000 --- a/samples/bluetooth/peripheral_csc/src/dis.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/dis.c" diff --git a/samples/bluetooth/peripheral_dis/CMakeLists.txt b/samples/bluetooth/peripheral_dis/CMakeLists.txt index 37764b00b3d..04f07c9e67e 100644 --- a/samples/bluetooth/peripheral_dis/CMakeLists.txt +++ b/samples/bluetooth/peripheral_dis/CMakeLists.txt @@ -2,6 +2,9 @@ include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(NONE) FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) +target_sources(app PRIVATE + ${app_sources} + ../gatt/dis.c + ) zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_dis/src/dis.c b/samples/bluetooth/peripheral_dis/src/dis.c deleted file mode 100644 index 86abf067eec..00000000000 --- a/samples/bluetooth/peripheral_dis/src/dis.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/dis.c" diff --git a/samples/bluetooth/peripheral_esp/CMakeLists.txt b/samples/bluetooth/peripheral_esp/CMakeLists.txt index f4629d86b42..6a2138e7599 100644 --- a/samples/bluetooth/peripheral_esp/CMakeLists.txt +++ b/samples/bluetooth/peripheral_esp/CMakeLists.txt @@ -3,8 +3,8 @@ project(NONE) target_sources(app PRIVATE src/main.c - src/bas.c - src/dis.c + ../gatt/bas.c + ../gatt/dis.c ) zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_esp/src/bas.c b/samples/bluetooth/peripheral_esp/src/bas.c deleted file mode 100644 index 2c05cf3ea60..00000000000 --- a/samples/bluetooth/peripheral_esp/src/bas.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/bas.c" diff --git a/samples/bluetooth/peripheral_esp/src/dis.c b/samples/bluetooth/peripheral_esp/src/dis.c deleted file mode 100644 index 86abf067eec..00000000000 --- a/samples/bluetooth/peripheral_esp/src/dis.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/dis.c" diff --git a/samples/bluetooth/peripheral_hids/CMakeLists.txt b/samples/bluetooth/peripheral_hids/CMakeLists.txt index 37764b00b3d..5e88af2c1eb 100644 --- a/samples/bluetooth/peripheral_hids/CMakeLists.txt +++ b/samples/bluetooth/peripheral_hids/CMakeLists.txt @@ -2,6 +2,11 @@ include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(NONE) FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) +target_sources(app PRIVATE + ${app_sources} + ../gatt/hog.c + ../gatt/dis.c + ../gatt/bas.c + ) zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_hids/src/bas.c b/samples/bluetooth/peripheral_hids/src/bas.c deleted file mode 100644 index 2c05cf3ea60..00000000000 --- a/samples/bluetooth/peripheral_hids/src/bas.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/bas.c" diff --git a/samples/bluetooth/peripheral_hids/src/dis.c b/samples/bluetooth/peripheral_hids/src/dis.c deleted file mode 100644 index 86abf067eec..00000000000 --- a/samples/bluetooth/peripheral_hids/src/dis.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/dis.c" diff --git a/samples/bluetooth/peripheral_hids/src/hog.c b/samples/bluetooth/peripheral_hids/src/hog.c deleted file mode 100644 index 1ba2e841d4a..00000000000 --- a/samples/bluetooth/peripheral_hids/src/hog.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/hog.c" diff --git a/samples/bluetooth/peripheral_hr/CMakeLists.txt b/samples/bluetooth/peripheral_hr/CMakeLists.txt index 37764b00b3d..2c5bb016823 100644 --- a/samples/bluetooth/peripheral_hr/CMakeLists.txt +++ b/samples/bluetooth/peripheral_hr/CMakeLists.txt @@ -2,6 +2,11 @@ include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(NONE) FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) +target_sources(app PRIVATE + ${app_sources} + ../gatt/hrs.c + ../gatt/dis.c + ../gatt/bas.c + ) zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_hr/src/bas.c b/samples/bluetooth/peripheral_hr/src/bas.c deleted file mode 100644 index 2c05cf3ea60..00000000000 --- a/samples/bluetooth/peripheral_hr/src/bas.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/bas.c" diff --git a/samples/bluetooth/peripheral_hr/src/dis.c b/samples/bluetooth/peripheral_hr/src/dis.c deleted file mode 100644 index 86abf067eec..00000000000 --- a/samples/bluetooth/peripheral_hr/src/dis.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/dis.c" diff --git a/samples/bluetooth/peripheral_hr/src/hrs.c b/samples/bluetooth/peripheral_hr/src/hrs.c deleted file mode 100644 index b2e887d1ec2..00000000000 --- a/samples/bluetooth/peripheral_hr/src/hrs.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Workaround build system bug that will put objects in source dir */ -#include "../../gatt/hrs.c"