Recent

Author Topic: LAMW [NoGUI] Chipset Changing Bug in Android Module Projects  (Read 1289 times)

loaded

  • Sr. Member
  • ****
  • Posts: 266
LAMW [NoGUI] A patch to fix the "libcontrols.so" naming issue instead of the Javaclass name that occurs in later Chipset changes in Android Module Projects. I struggled a lot because of this bug.

I waited for it to be fixed, but jmpessoa is probably too busy, so I rolled up my sleeves. ;D
Let's put it here, maybe it will be useful to someone.

lazandroidmodulewizard-master\ide_tools\androidprojoptions.pas Procedure whose file is located at line ~1305


Before ;

Code: Pascal  [Select][+][-]
  1. procedure TLamwProjectOptions.TryChangeChipset();
  2. var
  3.   index: integer;
  4. begin
  5.   if cbChipset.Text <> '' then
  6.   begin
  7.     if cbChipset.Text <> FChipSetTarget then
  8.     begin
  9.        index:= cbChipset.ItemIndex;
  10.        case index of
  11.          0: begin  //ARMv6
  12.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_armV6.txt') then
  13.            begin
  14.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'armeabi'+PathDelim+'libcontrols';
  15.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_armV6.txt', 2);
  16.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'arm';
  17.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_armV6.txt', 0);
  18.            end;
  19.          end;
  20.          1: begin  //ARMv7a+Soft
  21.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_armV7a.txt') then
  22.            begin
  23.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'armeabi-v7a'+PathDelim+'libcontrols';
  24.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_armV7a.txt', 2);
  25.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'arm';
  26.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_armV7a.txt', 0);
  27.            end;
  28.          end;
  29.          2: begin //ARMv7a+VFPv3
  30.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_armV7a_VFPv3.txt') then
  31.            begin
  32.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'armeabi-v7a'+PathDelim+'libcontrols';
  33.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_armV7a_VFPv3.txt', 2);
  34.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'arm';
  35.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_armV7a_VFPv3.txt', 0);
  36.            end;
  37.          end;
  38.          3: begin //x86
  39.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_x86.txt') then
  40.            begin
  41.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'x86'+PathDelim+'libcontrols';
  42.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_x86.txt', 2);
  43.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'i386';
  44.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_x86.txt', 0);
  45.            end;
  46.          end;
  47.          4: begin //Mipsel
  48.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_mipsel.txt') then
  49.            begin
  50.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'mips'+PathDelim+'libcontrols';
  51.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_mipsel.txt', 2);
  52.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'mipsel';
  53.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_mipsel.txt', 0);
  54.            end
  55.          end;
  56.          5: begin //Aarch64    //build_arm64.txt
  57.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_arm64.txt') then
  58.            begin
  59.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'arm64-v8a'+PathDelim+'libcontrols';
  60.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_arm64.txt', 2);
  61.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'aarch64';
  62.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_arm64.txt', 0);
  63.            end;
  64.          end;
  65.          6: begin  //x86_64
  66.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_x86_64.txt') then
  67.            begin
  68.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'x86_64'+PathDelim+'libcontrols';
  69.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_x86_64.txt', 2);
  70.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'x86_64';
  71.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_x86_64.txt', 0);
  72.            end;
  73.          end;
  74.        end;
  75.     end;
  76.   end;
  77. end;
  78.  
  79.  
  80.  

Post

Code: Pascal  [Select][+][-]
  1. procedure TLamwProjectOptions.TryChangeChipset();
  2. var
  3.   index: integer;
  4.   cfname:TStringArray;
  5. begin
  6.   if cbChipset.Text <> '' then
  7.   begin
  8.     if cbChipset.Text <> FChipSetTarget then
  9.     begin
  10.        index:= cbChipset.ItemIndex;
  11.        cfname:=LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename.Split(PathDelim);
  12.        case index of
  13.          0: begin  //ARMv6
  14.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_armV6.txt') then
  15.            begin
  16.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'armeabi'+PathDelim+cfname[high(cfname)];
  17.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_armV6.txt', 2);
  18.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'arm';
  19.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_armV6.txt', 0);
  20.            end;
  21.          end;
  22.          1: begin  //ARMv7a+Soft
  23.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_armV7a.txt') then
  24.            begin
  25.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'armeabi-v7a'+PathDelim+cfname[high(cfname)];
  26.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_armV7a.txt', 2);
  27.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'arm';
  28.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_armV7a.txt', 0);
  29.            end;
  30.          end;
  31.          2: begin //ARMv7a+VFPv3
  32.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_armV7a_VFPv3.txt') then
  33.            begin
  34.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'armeabi-v7a'+PathDelim+cfname[high(cfname)];
  35.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_armV7a_VFPv3.txt', 2);
  36.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'arm';
  37.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_armV7a_VFPv3.txt', 0);
  38.            end;
  39.          end;
  40.          3: begin //x86
  41.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_x86.txt') then
  42.            begin
  43.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'x86'+PathDelim+cfname[high(cfname)];
  44.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_x86.txt', 2);
  45.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'i386';
  46.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_x86.txt', 0);
  47.            end;
  48.          end;
  49.          4: begin //Mipsel
  50.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_mipsel.txt') then
  51.            begin
  52.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'mips'+PathDelim+cfname[high(cfname)];
  53.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_mipsel.txt', 2);
  54.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'mipsel';
  55.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_mipsel.txt', 0);
  56.            end
  57.          end;
  58.          5: begin //Aarch64    //build_arm64.txt
  59.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_arm64.txt') then
  60.            begin
  61.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'arm64-v8a'+PathDelim+cfname[high(cfname)];
  62.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_arm64.txt', 2);
  63.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'aarch64';
  64.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_arm64.txt', 0);
  65.            end;
  66.          end;
  67.          6: begin  //x86_64
  68.            if FileExists(FProjectPath + 'jni' + PathDelim + 'build-modes' +PathDelim+ 'build_x86_64.txt') then
  69.            begin
  70.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetFilename:=  '..'+PathDelim+'libs'+PathDelim+'x86_64'+PathDelim+cfname[high(cfname)];
  71.              LazarusIDE.ActiveProject.LazCompilerOptions.CustomOptions:= GetBuildMode('build_x86_64.txt', 2);
  72.              LazarusIDE.ActiveProject.LazCompilerOptions.TargetCPU:= 'x86_64';
  73.              LazarusIDE.ActiveProject.LazCompilerOptions.Libraries:= GetBuildMode('build_x86_64.txt', 0);
  74.            end;
  75.          end;
  76.        end;
  77.     end;
  78.   end;
  79. end;
  80.  
Installing the spelling, google translate is used :)

jmpessoa

  • Hero Member
  • *****
  • Posts: 1920
Re: LAMW [NoGUI] Chipset Changing Bug in Android Module Projects
« Reply #1 on: June 14, 2021, 06:25:22 pm »
Nice!

I will commit your patch/fix!

Thank you!

[DONE !!]

« Last Edit: June 14, 2021, 07:49:09 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018