Last active
June 28, 2019 22:16
-
-
Save mcspr/80829350513faf37d3154ab67c40ae8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import("env") | |
import os | |
PROJECT_CFG = env.GetProjectConfig() | |
STORAGE = os.path.join(env["PROJECT_DIR"], PROJECT_CFG.get("common", "shared_libdeps_dir")) | |
LIB_DEPS = env.GetProjectOption("lib_deps") | |
#print("using", STORAGE) | |
def subprocess_libdeps(storage, lib_deps): | |
import subprocess | |
args = [env.subst("$PYTHONEXE"), "-mplatformio", "lib", "-d", storage, "install"] | |
args.extend(lib_deps) | |
subprocess.check_call(args) | |
def library_manager_libdeps(storage, lib_deps): | |
from platformio.managers.lib import LibraryManager | |
manager = LibraryManager(storage) | |
for lib in lib_deps: | |
if manager.get_package_dir(*manager.parse_pkg_uri(lib)): | |
continue | |
manager.install(lib) | |
library_manager_libdeps(STORAGE, LIB_DEPS) | |
#subprocess_libdeps(STORAGE, LIB_DEPS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[common] | |
shared_libdeps_dir = my_project_libraries | |
[env] | |
platform = espressif32 | |
framework = arduino | |
lib_deps = | |
https://github.com/me-no-dev/AsyncTCP#d1f28ff8 | |
ArduinoJson@5.13.4 | |
lib_extra_dirs = | |
${common.shared_libdeps_dir} | |
extra_scripts = pre:extra_script_libdeps.py | |
[env:a] | |
board = lolin32 | |
src_build_flags = -DCFG_A | |
[env:b] | |
board = lolin_d32_pro | |
src_build_flags = -DCFG_B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ArduinoJson.h> | |
#include <AsyncTCP.h> | |
void setup() { | |
Serial.begin(115200); | |
Serial.flush(); | |
#if defined(CFG_A) | |
Serial.println("CFG_A ACTIVE"); | |
#elif defined(CFG_B) | |
Serial.println("CFG_B ACTIVE"); | |
#endif | |
} | |
void loop() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment