Pero:
 
EDIT: Hey, I think I got it! Well, it seems that platformio prefers to have its variants in the original folder, that is C:\Users.platformio\packages/… Only when I moved my “my_variant” folder there, did it finish the build without errors! Any thoughts why is that so?
 
 
Support of the board_build.variants_dir is builder-script  dependent.
The builder scripts for NordicNRF52 + Arduino do not allow changing the variant directory. It is constantly pointed to the actual framework package’s variants directory.
  
  
    
    
      
          if "build.variant" in board: 
              env.Append(CPPPATH=[ 
                  join(FRAMEWORK_DIR, "variants", board.get("build.variant")) 
              ]) 
              libs.append( 
                  env.BuildLibrary( 
                      join("$BUILD_DIR", "FrameworkArduinoVariant"), 
                      join(FRAMEWORK_DIR, "variants", 
                           board.get("build.variant")))) 
       
     
  
    
    
  
  
 
This is in contrast to Atmel SAM + Arduino where build.variants_dir is used
  
  
    
    
      
          libs = [] 
          if "build.variant" in board: 
              variants_dir = os.path.join( 
                  "$PROJECT_DIR", board.get("build.variants_dir")) if board.get( 
                      "build.variants_dir", "") else os.path.join(FRAMEWORK_DIR, "variants") 
              env.Append( 
                  CPPPATH=[ 
                      os.path.join(variants_dir, board.get("build.variant")) 
                  ], 
                  LIBPATH=[ 
                      os.path.join(variants_dir, board.get("build.variant")) 
                  ], 
              ) 
              libs.append(env.BuildLibrary( 
                  os.path.join("$BUILD_DIR", "FrameworkArduinoVariant"), 
                  os.path.join(variants_dir, board.get("build.variant")) 
              )) 
       
     
  
    
    
  
  
 
And hence you observe that difference.
An issue about this has been opened in Support build.variants_dir · Issue #11 · platformio/builder-framework-arduino-nrf5 · GitHub .