From 978097bb42bad35e96725aac5076169e95ddc3db Mon Sep 17 00:00:00 2001 From: Eric Paniagua Date: Wed, 2 Sep 2020 16:56:54 -0700 Subject: [PATCH] Generate device.h to avoid cmake problem with computed includes. --- src/kaleidoscope/CMakeLists.txt | 7 ++++++ src/kaleidoscope/device/device.h | 8 +++++-- src/kaleidoscope/device/device.h.in | 27 +++++++++++++++++++++++ src/kaleidoscope/device/virtual/Virtual.h | 2 -- 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 src/kaleidoscope/device/device.h.in diff --git a/src/kaleidoscope/CMakeLists.txt b/src/kaleidoscope/CMakeLists.txt index 9d2cf485..be990675 100644 --- a/src/kaleidoscope/CMakeLists.txt +++ b/src/kaleidoscope/CMakeLists.txt @@ -10,6 +10,13 @@ target_include_directories(bitfields ${KALEIDOSCOPE_SRC} "${VIRTUAL_ROOT}/cores/arduino" ) +set(KALEIDOSCOPE_HARDWARE_H "Kaleidoscope-Hardware-Model01.h") + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/device/device.h.in" + "${CMAKE_CURRENT_SOURCE_DIR}/device/device.h" + @ONLY) + add_library(hooks hooks.cpp) target_include_directories(hooks PRIVATE diff --git a/src/kaleidoscope/device/device.h b/src/kaleidoscope/device/device.h index ed16ea93..1b730ba8 100644 --- a/src/kaleidoscope/device/device.h +++ b/src/kaleidoscope/device/device.h @@ -14,10 +14,14 @@ * this program. If not, see . */ +/* + * DO NOT EDIT: This file has been generated during the build process. + */ + #pragma once +#include "Kaleidoscope-Hardware-Model01.h" + #ifdef KALEIDOSCOPE_VIRTUAL_BUILD #include "kaleidoscope/device/virtual/Virtual.h" -#else -#include KALEIDOSCOPE_HARDWARE_H #endif diff --git a/src/kaleidoscope/device/device.h.in b/src/kaleidoscope/device/device.h.in new file mode 100644 index 00000000..cd01232f --- /dev/null +++ b/src/kaleidoscope/device/device.h.in @@ -0,0 +1,27 @@ +/* Kaleidoscope - Firmware for computer input devices + * Copyright (C) 2013-2019 Keyboard.io, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +/* + * DO NOT EDIT: This file has been generated during the build process. + */ + +#pragma once + +#include "@KALEIDOSCOPE_HARDWARE_H@" + +#ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#include "kaleidoscope/device/virtual/Virtual.h" +#endif diff --git a/src/kaleidoscope/device/virtual/Virtual.h b/src/kaleidoscope/device/virtual/Virtual.h index 0170d404..cf5f817c 100644 --- a/src/kaleidoscope/device/virtual/Virtual.h +++ b/src/kaleidoscope/device/virtual/Virtual.h @@ -19,8 +19,6 @@ #ifdef KALEIDOSCOPE_VIRTUAL_BUILD -#include KALEIDOSCOPE_HARDWARE_H - #include "kaleidoscope/driver/bootloader/None.h" #include "kaleidoscope/driver/led/Base.h"