mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps] Apps can be picked and ordered at compile-time
This commit is contained in:
committed by
EmilieNumworks
parent
173c0249a2
commit
dcdd27d6bf
@@ -1,14 +1,20 @@
|
||||
include apps/shared/Makefile
|
||||
include apps/home/Makefile
|
||||
include apps/on_boarding/Makefile
|
||||
include apps/hardware_test/Makefile
|
||||
snapshots =
|
||||
|
||||
# You can select below which apps you want to include in your build, as well as
|
||||
# their order on the home screen. Each Makefile below is responsible for setting
|
||||
# the $snapshots variable (name of the snapshot class) and the $snapshot_headers
|
||||
# (path to the snapshot header).
|
||||
include apps/calculation/Makefile
|
||||
include apps/graph/Makefile
|
||||
include apps/home/Makefile
|
||||
include apps/hardware_test/Makefile
|
||||
include apps/on_boarding/Makefile
|
||||
include apps/probability/Makefile
|
||||
include apps/regression/Makefile
|
||||
include apps/sequence/Makefile
|
||||
include apps/settings/Makefile
|
||||
include apps/shared/Makefile
|
||||
include apps/statistics/Makefile
|
||||
include apps/probability/Makefile
|
||||
include apps/regression/Makefile
|
||||
include apps/code/Makefile
|
||||
#include apps/picview/Makefile
|
||||
|
||||
@@ -38,6 +44,14 @@ app_objs += $(addprefix apps/,\
|
||||
variable_box_leaf_cell.o\
|
||||
)
|
||||
|
||||
snapshots_declaration = $(foreach i,$(snapshots),$(i) m_snapshot$(subst :,,$(i));)
|
||||
snapshots_construction = $(foreach i,$(snapshots),,m_snapshot$(subst :,,$(i))())
|
||||
snapshots_list = $(foreach i,$(snapshots),,&m_snapshot$(subst :,,$(i)))
|
||||
snapshots_count = $(words $(snapshots))
|
||||
snapshot_includes = $(foreach i,$(snapshot_headers),-include $(i) )
|
||||
|
||||
apps/apps_container_storage.o apps/main.o: CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count)
|
||||
|
||||
app_images += apps/exam_icon.png
|
||||
|
||||
# Tracking which source file uses which image is painful. But we need to ensure
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
#include "apps_container_storage.h"
|
||||
|
||||
#ifndef APPS_CONTAINER_SNAPSHOT_CONSTRUCTORS
|
||||
#error Missing snapshot constructors
|
||||
#endif
|
||||
|
||||
#ifndef APPS_CONTAINER_SNAPSHOT_LIST
|
||||
#error Missing snapshot list
|
||||
#endif
|
||||
|
||||
#ifndef APPS_CONTAINER_SNAPSHOT_COUNT
|
||||
#error Missing snapshot count
|
||||
#endif
|
||||
|
||||
constexpr int k_numberOfCommonApps = 1+APPS_CONTAINER_SNAPSHOT_COUNT; // Take the Home app into account
|
||||
|
||||
AppsContainerStorage::AppsContainerStorage() :
|
||||
AppsContainer(),
|
||||
m_calculationSnapshot(),
|
||||
m_graphSnapshot(),
|
||||
m_sequenceSnapshot(),
|
||||
m_settingsSnapshot(),
|
||||
m_statisticsSnapshot(),
|
||||
m_probabilitySnapshot(),
|
||||
m_regressionSnapshot(),
|
||||
m_codeSnapshot()
|
||||
AppsContainer()
|
||||
APPS_CONTAINER_SNAPSHOT_CONSTRUCTORS
|
||||
{
|
||||
}
|
||||
|
||||
@@ -22,15 +29,8 @@ App::Snapshot * AppsContainerStorage::appSnapshotAtIndex(int index) {
|
||||
return nullptr;
|
||||
}
|
||||
App::Snapshot * snapshots[] = {
|
||||
homeAppSnapshot(),
|
||||
&m_calculationSnapshot,
|
||||
&m_graphSnapshot,
|
||||
&m_sequenceSnapshot,
|
||||
&m_settingsSnapshot,
|
||||
&m_statisticsSnapshot,
|
||||
&m_probabilitySnapshot,
|
||||
&m_regressionSnapshot,
|
||||
&m_codeSnapshot
|
||||
homeAppSnapshot()
|
||||
APPS_CONTAINER_SNAPSHOT_LIST
|
||||
};
|
||||
assert(sizeof(snapshots)/sizeof(snapshots[0]) == k_numberOfCommonApps);
|
||||
assert(index >= 0 && index < k_numberOfCommonApps);
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
#define APPS_CONTAINER_STORAGE_H
|
||||
|
||||
#include "apps_container.h"
|
||||
#include "graph/app.h"
|
||||
#include "probability/app.h"
|
||||
#include "calculation/app.h"
|
||||
#include "regression/app.h"
|
||||
#include "sequence/app.h"
|
||||
#include "settings/app.h"
|
||||
#include "statistics/app.h"
|
||||
#include "code/app.h"
|
||||
|
||||
#ifndef APPS_CONTAINER_SNAPSHOT_DECLARATIONS
|
||||
#error Missing snapshot declarations
|
||||
#endif
|
||||
|
||||
class AppsContainerStorage : public AppsContainer {
|
||||
public:
|
||||
@@ -17,16 +13,7 @@ public:
|
||||
int numberOfApps() override;
|
||||
App::Snapshot * appSnapshotAtIndex(int index) override;
|
||||
private:
|
||||
static constexpr int k_numberOfCommonApps = 9;
|
||||
static constexpr int k_totalNumberOfApps = 2+k_numberOfCommonApps;
|
||||
Calculation::App::Snapshot m_calculationSnapshot;
|
||||
Graph::App::Snapshot m_graphSnapshot;
|
||||
Sequence::App::Snapshot m_sequenceSnapshot;
|
||||
Settings::App::Snapshot m_settingsSnapshot;
|
||||
Statistics::App::Snapshot m_statisticsSnapshot;
|
||||
Probability::App::Snapshot m_probabilitySnapshot;
|
||||
Regression::App::Snapshot m_regressionSnapshot;
|
||||
Code::App::Snapshot m_codeSnapshot;
|
||||
APPS_CONTAINER_SNAPSHOT_DECLARATIONS
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
snapshots += Calculation::App::Snapshot
|
||||
snapshot_headers += apps/calculation/app.h
|
||||
|
||||
app_objs += $(addprefix apps/calculation/,\
|
||||
app.o\
|
||||
calculation.o\
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
snapshots += Code::App::Snapshot
|
||||
snapshot_headers += apps/code/app.h
|
||||
|
||||
app_objs += $(addprefix apps/code/,\
|
||||
app.o\
|
||||
editor_controller.o\
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
snapshots += Graph::App::Snapshot
|
||||
snapshot_headers += apps/graph/app.h
|
||||
|
||||
app_objs += $(addprefix apps/graph/,\
|
||||
app.o\
|
||||
cartesian_function.o\
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
snapshots += Probability::App::Snapshot
|
||||
snapshot_headers += apps/probability/app.h
|
||||
|
||||
app_objs += $(addprefix apps/probability/,\
|
||||
app.o\
|
||||
calculation/calculation.o\
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
snapshots += Regression::App::Snapshot
|
||||
snapshot_headers += apps/regression/app.h
|
||||
|
||||
app_objs += $(addprefix apps/regression/,\
|
||||
app.o\
|
||||
banner_view.o\
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
snapshots += Sequence::App::Snapshot
|
||||
snapshot_headers += apps/sequence/app.h
|
||||
|
||||
app_objs += $(addprefix apps/sequence/,\
|
||||
app.o\
|
||||
graph/banner_view.o\
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
snapshots += Settings::App::Snapshot
|
||||
snapshot_headers += apps/settings/app.h
|
||||
|
||||
app_objs += $(addprefix apps/settings/,\
|
||||
app.o\
|
||||
main_controller.o\
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
snapshots += Statistics::App::Snapshot
|
||||
snapshot_headers += apps/statistics/app.h
|
||||
|
||||
app_objs += $(addprefix apps/statistics/,\
|
||||
app.o\
|
||||
box_banner_view.o\
|
||||
|
||||
Reference in New Issue
Block a user