diff --git a/library.json b/library.json index 26a1e81..b571294 100644 --- a/library.json +++ b/library.json @@ -11,5 +11,8 @@ }, "frameworks": "*", "platforms": "*", - "headers": "unity.h" + "headers": "unity.h", + "build": { + "extraScript": "platformio-build.py" + } } diff --git a/platformio-build.py b/platformio-build.py new file mode 100644 index 0000000..66fea42 --- /dev/null +++ b/platformio-build.py @@ -0,0 +1,17 @@ +import os + +Import("env") + +env.Append(CPPDEFINES=["UNITY_INCLUDE_CONFIG_H"]) + +# import "unity_config.h" folder to the library builder +try: + Import("projenv") + + projenv.Append(CPPDEFINES=["UNITY_INCLUDE_CONFIG_H"]) + for p in projenv["CPPPATH"]: + p = projenv.subst(p) + if os.path.isfile(os.path.join(p, "unity_config.h")): + env.Prepend(CPPPATH=[p]) +except: + pass