定制lazarus compiler config


lazarus默认的Target OS和Target CPU包含很多用不上的OS和CPU,我平时只用到Linux、windows和Android,CPU为aarch64、arm、i386和x86_64,为方便选择不同的OS和CPU,只需修改lazarus\components\codetools\definetemplates.pas

FPCOperatingSystemNames: array[1..38] of shortstring =(
   'linux',
   'win32','win64','wince',
   'darwin','macos',
   'freebsd','netbsd','openbsd','dragonfly',
   'aix',
   'amiga',
   'android',
   'aros',
   'atari',
   'beos',
   'embedded',
   'emx',
   'freertos',
   'gba',
   'go32v2',
   'haiku',
   'iphonesim',
   'ios',
   'java',
   'msdos',
   'morphos',
   'nds',
   'netware',
   'netwlibc',
   'os2',
   'palmos',
   'qnx',
   'solaris',
   'symbian',
   'watcom',
   'wdosx',
   'wii'
  );
FPCOperatingSystemCaptions: array[1..38] of shortstring =(
   'AIX',
   'Amiga',
   'Android',
   'AROS',
   'Atari',
   'BeOS',
   'Darwin',
   'DragonFly',
   'Embedded',
   'emx',
   'FreeBSD',
   'FreeRTOS',
   'GBA',
   'Go32v2',
   'Haiku',
   'iPhoneSim',
   'iOS',
   'Java',
   'Linux',
   'MacOS',
   'MorphOS',
   'MSDOS',
   'NDS',
   'NetBSD',
   'NetWare',
   'NetwLibC',
   'OpenBSD',
   'OS2',
   'PalmOS',
   'QNX',
   'Solaris',
   'Symbian',
   'Watcom',
   'wdosx',
   'Win32',
   'Win64',
   'WinCE',
   'Wii'
  ); 

改为:

  FPCOperatingSystemNames: array[1..4] of shortstring =(
     'linux',
     'win32',
     'win64',
     'android'
    );
  FPCOperatingSystemCaptions: array[1..4] of shortstring =(
     'Linux',
     'Win32',
     'Win64',
     'Android'
    );

及将

FPCProcessorNames: array[1..14] of shortstring =(
    'aarch64',
    'arm',
    'avr',
    'i386',
    'i8086',
    'jvm',
    'm68k',
    'mips',
    'mipsel',
    'powerpc',
    'powerpc64',
    'sparc',
    'x86_64',
    'xtensa'
  );

改为:

  FPCProcessorNames: array[1..4] of shortstring =(
      'aarch64',
      'arm',
      'x86_64',
      'i386'
    );

最后重新编译lazarus就可以。