瀏覽代碼

+ add option -FF to force the use of fpcres as RC compiler

Note: if we merge this to 3.2.x then we can switch to this by default once 3.2.2 is released

git-svn-id: trunk@46398 -
svenbarth 5 年之前
父節點
當前提交
b88d12c7b9
共有 3 個文件被更改,包括 21 次插入6 次删除
  1. 16 6
      compiler/comprsrc.pas
  2. 2 0
      compiler/options.pas
  3. 3 0
      compiler/rescmn.pas

+ 16 - 6
compiler/comprsrc.pas

@@ -78,13 +78,14 @@ procedure CollectResourceFiles;
 Var
   ResCompiler : String;
   RCCompiler  : String;
+  RCForceFPCRes : Boolean;
 
 implementation
 
 uses
   SysUtils,
   cutils,cfileutl,cclasses,
-  Globtype,Globals,Verbose,Fmodule, comphook,cpuinfo;
+  Globtype,Globals,Verbose,Fmodule, comphook,cpuinfo,rescmn;
 
 {****************************************************************************
                               TRESOURCEFILE
@@ -126,7 +127,10 @@ var
 begin
   if output=roRES then
     begin
-      s:=target_res.rccmd;
+      if RCForceFPCRes then
+        s:=FPCResRCArgs
+      else
+        s:=target_res.rccmd;
       Replace(s,'$RES',maybequoted(OutName));
       Replace(s,'$RC',maybequoted(fname));
       ObjUsed:=False;
@@ -162,7 +166,10 @@ var
 begin
   Result:=true;
   if output=roRES then
-    Bin:=SelectBin(RCCompiler,target_res.rcbin)
+    if RCForceFPCRes then
+      Bin:=SelectBin(RCCompiler,FPCResUtil)
+    else
+      Bin:=SelectBin(RCCompiler,target_res.rcbin)
   else
     Bin:=SelectBin(ResCompiler,target_res.resbin);
   if bin='' then
@@ -265,8 +272,11 @@ begin
   srcfilepath:=ExtractFilePath(current_module.mainsource);
   if output=roRES then
     begin
-      s:=target_res.rccmd;
-      if target_res.rcbin = 'windres' then
+      if RCForceFPCRes then
+        s:=FPCResRCArgs
+      else
+        s:=target_res.rccmd;
+      if (target_res.rcbin = 'windres') and not RCForceFPCRes then
         Replace(s,'$RC',WindresFileName(fname))
       else
         Replace(s,'$RC',maybequoted(fname));
@@ -317,7 +327,7 @@ begin
   if respath='' then
     respath:='.';
   Replace(s,'$INC',maybequoted(respath));
-  if (output=roRes) and (target_res.rcbin='windres') then
+  if (output=roRes) and (target_res.rcbin='windres') and not RCForceFPCRes then
   begin
     { try to find a preprocessor }
     preprocessorbin := respath+'cpp'+source_info.exeext;

+ 2 - 0
compiler/options.pas

@@ -1700,6 +1700,8 @@ begin
                          frameworksearchpath.AddPath(More,true)
                      else
                        IllegalPara(opt);
+                 'F' :
+                   RCForceFPCRes:=true;
                  'i' :
                    begin
                      if ispara then

+ 3 - 0
compiler/rescmn.pas

@@ -65,6 +65,9 @@ uses
              resflags : [res_external_file];
           );
 
+      FPCResRCArgs = '--include $INC -of res -D FPC -o $RES $RC';
+      FPCResUtil   = 'fpcres';
+
 
 implementation