2
0
Эх сурвалжийг харах

Make idfpath and idf_version macros available as replacement vars in fpc.cfg

Michael Ring 1 жил өмнө
parent
commit
e0229632fb
1 өөрчлөгдсөн 29 нэмэгдсэн , 0 устгасан
  1. 29 0
      compiler/globals.pas

+ 29 - 0
compiler/globals.pas

@@ -986,6 +986,22 @@ implementation
        result:=getrealtime(st);
      end;
 
+   function idfversionstring(version : longint):string;
+   {
+     Convert back the numerical idf_version for esp32 to string
+   }
+     begin
+       result := '';
+       if version > 0 then
+         begin
+           result := inttostr(version div 10000)+'.';
+           version := version - (version div 10000)*10000;
+           result := result + inttostr(version div 100)+'.';
+           version := version - (version div 100)*100;
+           result := result + inttostr(version);
+         end;
+     end;
+
 {****************************************************************************
                           Default Macro Handling
 ****************************************************************************}
@@ -1065,6 +1081,19 @@ implementation
          Replace(s,'$OPENBSD_LOCALBASE',GetOpenBSDLocalBase);
          Replace(s,'$OPENBSD_X11BASE',GetOpenBSDX11Base);
 {$endif openbsd}
+{$ifdef xtensa}
+         if idf_version > 0 then
+           Replace(s,'$IDF_VERSION',idfversionstring(idf_version));
+         if idfpath <> '' then
+           Replace(s,'$IDFPATH',idfpath);
+{$endif xtensa}
+{$ifdef riscv32}
+         if idf_version > 0 then
+           Replace(s,'$IDF_VERSION',idfversionstring(idf_version));
+         if idfpath <> '' then
+           Replace(s,'$IDFPATH',idfpath);
+{$endif riscv32}
+
          if not substitute_env_variables then
            exit;
          { Replace environment variables between dollar signs }