path to *.h files to be included can be added in platformio.ini together with other dependencies.
See this example:
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
monitor_dtr = 0
monitor_rts = 0
monitor_speed = 9600
board_build.partitions = min_spiffs.csv
build_flags =
-I "/PlatformIO/includes1"
-I "/PlatformIO/includes2"
lib_deps =
ESP8266WiFi
ESP8266WebServer
LittleFS
ayushsharma82/ElegantOTA @ ^3.1.1
**elegantota_esp.h**
// under platformio.ini
board_build.partitions = min_spiffs.csv
// under lib_deps in platformio.ini
ESP8266WiFi
ESP8266WebServer
LittleFS
Ticker
// top of main.cpp
const char* ssid = "ssid";
const char* password = "password";
const char* hostname = "hostname";
bool nodemcuwificonnected = false;
// inside loop
server.handleClient();
ElegantOTA.loop();
**mqttasync.h**
// under platformio.ini
marvinroger/AsyncMqttClient@^0.9.0
// under main.cpp
#define MQTT_HOST IPAddress(192, 168, x, x)
#define MQTT_PORT 1883
#define MQTT_TOPIC "topic"
**myfunc.h**
//Depending on use requirements//
// under platformio.ini
bblanchon/ArduinoJson @ ^7.2.1
pfeerick/elapsedMillis @ ^1.0.6
plageoj/UrlEncode @ ^1.0.1