Also, modify bin/kaleidoscope-builder to allow for building just a library. Requires bundle branch epan/build/justlib until that is merged into master. Signed-off-by: Eric Paniagua <eric.paniagua@gmail.com>epan/build/justlib
parent
5356514a22
commit
1c8503edbe
@ -1,3 +1,3 @@
|
||||
bin/
|
||||
lib/
|
||||
obj/
|
||||
**/bin/
|
||||
**/lib/
|
||||
**/obj/
|
||||
|
@ -0,0 +1,45 @@
|
||||
BIN_DIR=bin
|
||||
LIB_DIR=lib
|
||||
OBJ_DIR=obj
|
||||
|
||||
SKETCH_FILE=$(wildcard *.ino)
|
||||
BIN_FILE=$(subst .ino,,$(SKETCH_FILE))
|
||||
LIB_FILE=${BIN_FILE}-latest.a
|
||||
|
||||
TEST_FILES=$(wildcard *_test.cpp)
|
||||
TEST_OBJS=$(patsubst %.cpp,${OBJ_DIR}/%.o,$(TEST_FILES))
|
||||
|
||||
run: ${BIN_DIR}/${BIN_FILE}
|
||||
@echo "run"
|
||||
"./${BIN_DIR}/${BIN_FILE}" -t
|
||||
|
||||
${BIN_DIR}/${BIN_FILE}: ${TEST_OBJS} FORCE
|
||||
@echo "link"
|
||||
mkdir -p "${BIN_DIR}" "${LIB_DIR}"
|
||||
env LIBONLY=yes LOCAL_CFLAGS='"-I$(PWD)"' OUTPUT_PATH="$(PWD)/$(LIB_DIR)" VERBOSE=1 $(MAKE) -f delegate.mk
|
||||
g++ -o "${BIN_DIR}/${BIN_FILE}" -lpthread -g -w -lm -lXtst -lX11 ${TEST_OBJS} "${LIB_DIR}/${LIB_FILE}" -L"$(PWD)/../googletest/lib" -lgtest -lgmock
|
||||
|
||||
${OBJ_DIR}/%.o: %.cpp
|
||||
@echo "compile $@"
|
||||
mkdir -p "${OBJ_DIR}"
|
||||
g++ -o "$@" -c \
|
||||
-I../../src \
|
||||
-I../../../../../virtual/cores/arduino \
|
||||
-I../../../Kaleidoscope-HIDAdaptor-KeyboardioHID/src \
|
||||
-I../../../KeyboardioHID/src \
|
||||
-I../../testing/googletest/googletest/include \
|
||||
-DARDUINO=10607 \
|
||||
-DARDUINO_AVR_MODEL01 \
|
||||
'-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \
|
||||
-DKALEIDOSCOPE_VIRTUAL_BUILD=1 \
|
||||
-DKEYBOARDIOHID_BUILD_WITHOUT_HID=1 \
|
||||
-DUSBCON=dummy \
|
||||
-DARDUINO_ARCH_AVR=1 \
|
||||
'-DUSB_PRODUCT="Model 01"' \
|
||||
$<
|
||||
|
||||
clean: FORCE
|
||||
rm -rf "${BIN_DIR}" "${LIB_DIR}" "${OBJ_DIR}"
|
||||
|
||||
.PHONY: FORCE
|
||||
|
@ -0,0 +1,136 @@
|
||||
/* -*- mode: c++ -*-
|
||||
* Copyright (C) 2020 Eric Paniagua (epaniagua@google.com)
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef KALEIDOSCOPE_VIRTUAL_BUILD
|
||||
|
||||
// The Kaleidoscope core
|
||||
#include "Kaleidoscope.h"
|
||||
|
||||
// Support for storing the keymap in EEPROM
|
||||
#include "Kaleidoscope-EEPROM-Settings.h"
|
||||
#include "Kaleidoscope-EEPROM-Keymap.h"
|
||||
|
||||
// Support for communicating with the host via a simple Serial protocol
|
||||
#include "Kaleidoscope-FocusSerial.h"
|
||||
|
||||
// Support for keys that move the mouse
|
||||
#include "Kaleidoscope-MouseKeys.h"
|
||||
|
||||
// Support for macros
|
||||
#include "Kaleidoscope-Macros.h"
|
||||
|
||||
// Support for controlling the keyboard's LEDs
|
||||
#include "Kaleidoscope-LEDControl.h"
|
||||
|
||||
// Support for "Numpad" mode, which is mostly just the Numpad specific LED mode
|
||||
#include "Kaleidoscope-NumPad.h"
|
||||
|
||||
// Support for the "Boot greeting" effect, which pulses the 'LED' button for 10s
|
||||
// when the keyboard is connected to a computer (or that computer is powered on)
|
||||
#include "Kaleidoscope-LEDEffect-BootGreeting.h"
|
||||
|
||||
// Support for LED modes that set all LEDs to a single color
|
||||
#include "Kaleidoscope-LEDEffect-SolidColor.h"
|
||||
|
||||
// Support for an LED mode that makes all the LEDs 'breathe'
|
||||
#include "Kaleidoscope-LEDEffect-Breathe.h"
|
||||
|
||||
// Support for an LED mode that makes a red pixel chase a blue pixel across the keyboard
|
||||
#include "Kaleidoscope-LEDEffect-Chase.h"
|
||||
|
||||
// Support for LED modes that pulse the keyboard's LED in a rainbow pattern
|
||||
#include "Kaleidoscope-LEDEffect-Rainbow.h"
|
||||
|
||||
// Support for an LED mode that lights up the keys as you press them
|
||||
#include "Kaleidoscope-LED-Stalker.h"
|
||||
|
||||
// Support for an LED mode that prints the keys you press in letters 4px high
|
||||
#include "Kaleidoscope-LED-AlphaSquare.h"
|
||||
|
||||
// Support for an LED mode that lets one configure per-layer color maps
|
||||
#include "Kaleidoscope-Colormap.h"
|
||||
|
||||
// Support for Keyboardio's internal keyboard testing mode
|
||||
#include "Kaleidoscope-HardwareTestMode.h"
|
||||
|
||||
// Support for host power management (suspend & wakeup)
|
||||
#include "Kaleidoscope-HostPowerManagement.h"
|
||||
|
||||
// Support for magic combos (key chords that trigger an action)
|
||||
#include "Kaleidoscope-MagicCombo.h"
|
||||
|
||||
// Support for USB quirks, like changing the key state report protocol
|
||||
#include "Kaleidoscope-USB-Quirks.h"
|
||||
|
||||
#include "Kaleidoscope-Simulator.h"
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
#undef T
|
||||
#undef U
|
||||
#undef TEST
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
void executeTestFunction() {
|
||||
setup(); /* setup Kaleidoscope */
|
||||
testing::InitGoogleTest();
|
||||
RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
namespace kaleidoscope {
|
||||
namespace simulator {
|
||||
namespace {
|
||||
|
||||
using namespace actions;
|
||||
using namespace interface;
|
||||
using namespace interface::actions;
|
||||
|
||||
class SimulatorTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
sim_ = &Simulator::getInstance();
|
||||
}
|
||||
|
||||
Simulator* sim_;
|
||||
};
|
||||
|
||||
class KeyboardReports : public SimulatorTest {};
|
||||
|
||||
TEST_F(KeyboardReports, ActiveKeycodesAreAccurate) {
|
||||
// Assert that the next cycle generates exactly one keyboard report.
|
||||
//
|
||||
sim_->cycleActionsQueue().queue(AssertCycleGeneratesNReports<KeyboardReport_> {1});
|
||||
|
||||
sim_->tapKey(2, 1); // A
|
||||
sim_->cycleExpectReports(AssertKeycodesActive{Key_A});
|
||||
|
||||
sim_->cycleExpectReports(AssertReportEmpty{});
|
||||
}
|
||||
|
||||
TEST(Test, ThatPasses) {
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(Test, ThatFails) {
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace simulator
|
||||
} // namespace kaleidoscope
|
||||
|
||||
#endif // KALEIDOSCOPE_VIRTUAL_BUILD
|
@ -1,79 +0,0 @@
|
||||
/* -*- mode: c++ -*-
|
||||
* Copyright (C) 2020 Eric Paniagua (epaniagua@google.com)
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef KALEIDOSCOPE_VIRTUAL_BUILD
|
||||
|
||||
#pragma once
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
#undef T
|
||||
#undef U
|
||||
|
||||
#include "fake-gtest.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "Kaleidoscope-Simulator.h"
|
||||
|
||||
void executeTestFunction() {
|
||||
setup(); /* setup Kaleidoscope */
|
||||
testing::InitGoogleTest();
|
||||
RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
namespace kaleidoscope {
|
||||
namespace simulator {
|
||||
namespace {
|
||||
|
||||
using namespace actions;
|
||||
using namespace interface;
|
||||
using namespace interface::actions;
|
||||
|
||||
class SimulatorTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
sim_ = &Simulator::getInstance();
|
||||
}
|
||||
|
||||
Simulator* sim_;
|
||||
};
|
||||
|
||||
class KeyboardReports : public SimulatorTest {};
|
||||
|
||||
TEST_F(KeyboardReports, ActiveKeycodesAreAccurate) {
|
||||
// Assert that the next cycle generates exactly one keyboard report.
|
||||
//
|
||||
sim_->cycleActionsQueue().queue(AssertCycleGeneratesNReports<KeyboardReport_> {1});
|
||||
|
||||
sim_->tapKey(2, 1); // A
|
||||
sim_->cycleExpectReports(AssertKeycodesActive{Key_A});
|
||||
|
||||
sim_->cycleExpectReports(AssertReportEmpty{});
|
||||
}
|
||||
|
||||
TEST(Test, ThatPasses) {
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(Test, ThatFails) {
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace simulator
|
||||
} // namespace kaleidoscope
|
||||
|
||||
#endif // KALEIDOSCOPE_VIRTUAL_BUILD
|
@ -1 +0,0 @@
|
||||
#include "./hello-simulator_test.h"
|
Loading…
Reference in new issue