refactor: migrate MICRO_PIP to fine-grained feature flags
Replace monolithic MICRO_PIP/PIP_MICRO with granular flags: Feature flags (CMake options + platform auto-detection): - PIP_NO_FILESYSTEM, PIP_NO_THREADS, PIP_NO_SOCKET - PIP_NO_PROCESS, PIP_NO_DYNLIB, PIP_NO_FFT, PIP_NO_SERIAL Embedded optimization flag: - PIP_EMBEDDED (auto-set for Pico SDK and FreeRTOS) Controls buffer sizes, time stubs, terminal fallback, init stubs Platform blocks in CMakeLists.txt: - Pico SDK: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL; conditionally disables THREADS (no FreeRTOS) and SOCKET (no LWIP) - FreeRTOS: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL; conditionally disables SOCKET (no LWIP) - Android: auto-disables PROCESS, DYNLIB, FFT Updated 96 files across libs/, utils/, tests/, and CMakeLists.txt. Builds verified for Linux (547 tests pass) and Pico SDK (100%). Removed all MICRO_PIP and PIP_MICRO references (0 remaining).
This commit is contained in:
@@ -43,11 +43,15 @@ PIString mask(const PIString & str) {
|
||||
}
|
||||
|
||||
PIString overrideFile(PIString path) {
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
if (path.isEmpty()) return {};
|
||||
PIFile::FileInfo fi(path);
|
||||
auto ext = fi.extension();
|
||||
path.insert(path.size_s() - ext.size_s() - (ext.isEmpty() ? 0 : 1), ".override");
|
||||
return path;
|
||||
#else
|
||||
return path;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +142,9 @@ PIValueTree PIValueTreeConversions::fromText(PIIODevice * device) {
|
||||
PIMap<PIString, PIString> substitutions;
|
||||
if (!device) return ret;
|
||||
PIString base_path;
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
if (device->isTypeOf<PIFile>()) base_path = PIFile::FileInfo(device->path()).dir().replaceAll('\\', '/');
|
||||
#endif
|
||||
PIIOTextStream ts(device);
|
||||
PIString line, comm;
|
||||
PIVariant value;
|
||||
@@ -211,10 +217,12 @@ PIValueTree PIValueTreeConversions::fromText(PIIODevice * device) {
|
||||
line.cutLeft(1).trim();
|
||||
if (path.front() == "include") {
|
||||
PIString include = line.trimmed();
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
if (!PIFile::FileInfo(include).isAbsolute()) {
|
||||
include = base_path + "/" + include.replaceAll('\\', '/');
|
||||
include.replaceAll("//", '/');
|
||||
}
|
||||
#endif
|
||||
PIValueTree inc_vt = PIValueTreeConversions::fromTextFile(include);
|
||||
inc_vt.forEachRecursive(
|
||||
[&substitutions](const PIValueTree & v, const PIString & fn) { substitutions[fn] = v.value().toString(); });
|
||||
@@ -345,6 +353,9 @@ PIValueTree PIValueTreeConversions::fromText(const PIString & str) {
|
||||
|
||||
|
||||
PIValueTree PIValueTreeConversions::fromJSONFile(const PIString & path) {
|
||||
#ifdef PIP_NO_FILESYSTEM
|
||||
return PIValueTree();
|
||||
#else
|
||||
auto ret = PIValueTreeConversions::fromJSON(PIJSON::fromJSON(PIString::fromUTF8(PIFile::readAll(path))));
|
||||
auto ofp = overrideFile(path);
|
||||
if (PIFile::isExists(ofp)) {
|
||||
@@ -352,10 +363,14 @@ PIValueTree PIValueTreeConversions::fromJSONFile(const PIString & path) {
|
||||
ret.merge(override_vt);
|
||||
}
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
PIValueTree PIValueTreeConversions::fromTextFile(const PIString & path) {
|
||||
#ifdef PIP_NO_FILESYSTEM
|
||||
return PIValueTree();
|
||||
#else
|
||||
PIFile f(path, PIIODevice::ReadOnly);
|
||||
auto ret = PIValueTreeConversions::fromText(&f);
|
||||
auto ofp = overrideFile(path);
|
||||
@@ -365,18 +380,27 @@ PIValueTree PIValueTreeConversions::fromTextFile(const PIString & path) {
|
||||
ret.merge(override_vt);
|
||||
}
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool PIValueTreeConversions::toJSONFile(const PIString & path, const PIValueTree & root, Options options) {
|
||||
#ifdef PIP_NO_FILESYSTEM
|
||||
return false;
|
||||
#else
|
||||
auto d = toJSON(root, options).toJSON(PIJSON::Tree).toUTF8();
|
||||
int written = PIFile::writeAll(path, d);
|
||||
return written == d.size_s();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool PIValueTreeConversions::toTextFile(const PIString & path, const PIValueTree & root, Options options) {
|
||||
#ifdef PIP_NO_FILESYSTEM
|
||||
return false;
|
||||
#else
|
||||
auto d = toText(root, options).toUTF8();
|
||||
int written = PIFile::writeAll(path, d);
|
||||
return written == d.size_s();
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user