@@ -118,9 +118,11 @@ TPlatform = class
118
118
FPlatformType: TPlatformType;
119
119
FEnabled: Boolean;
120
120
FLibraryName: String;
121
+ FDebugLibraryName: String;
121
122
FPrefix: String;
122
123
procedure SetEnabled (const AValue: Boolean);
123
124
procedure SetLibraryName (const AValue: String);
125
+ procedure SetDebugLibraryName (const AValue: String);
124
126
procedure SetPrefix (const AValue: String);
125
127
public
126
128
constructor Create(const AProject: TProject;
@@ -149,6 +151,11 @@ TPlatform = class
149
151
{ The name of the (dynamic or static) library for this platform. }
150
152
property LibraryName: String read FLibraryName write SetLibraryName;
151
153
154
+ { Optional name of the (dynamic or static) library containing a DEBUG build
155
+ for this platform. This version of the library will be used if the
156
+ application is built with a define that is set in TProject.DebugDefine. }
157
+ property DebugLibraryName: String read FDebugLibraryName write SetDebugLibraryName;
158
+
152
159
{ The function name prefix to use for this platform. Usually an empty
153
160
string, but on some platforms, each function will have a '_' prefix. }
154
161
property Prefix: String read FPrefix write SetPrefix;
@@ -167,6 +174,7 @@ TProject = class
167
174
FUseUnits: String;
168
175
169
176
FLibraryConstant: String;
177
+ FDebugDefine: String;
170
178
FPlatforms: array [TPlatformType] of TPlatform;
171
179
172
180
FIgnoreParseErrors: Boolean;
@@ -210,6 +218,7 @@ TProject = class
210
218
procedure SetUnconvertibleHandling (const Value : TUnconvertibleHandling);
211
219
function GetPlatform (const AIndex: TPlatformType): TPlatform;
212
220
procedure SetLibraryConstant (const Value : String);
221
+ procedure SetDebugDefine (const Value : String);
213
222
procedure SetEnumHandling (const Value : TEnumHandling);
214
223
procedure SetUseUnits (const Value : String);
215
224
procedure SetSymbolsToIgnore (const Value : TStrings);
@@ -299,6 +308,15 @@ TProject = class
299
308
LIB_MYLIB = 'mylib.dll' }
300
309
property LibraryConstant: String read FLibraryConstant write SetLibraryConstant;
301
310
311
+ (* The name of the define that is used to link to Debug versions of the
312
+ library. For example, if there are is a debug version of the 'mylib.dll'
313
+ library called 'mylib_debug.dll', and DebugDefine is set to 'DEBUG_LIBS',
314
+ then the following code will be generated:
315
+
316
+ const
317
+ LIB_MYLIB = {$IFDEF DEBUG_LIBS}'mylib_debug.dll'{ELSE}'mylib.dll'{$ENDIF} *)
318
+ property DebugDefine: String read FDebugDefine write SetDebugDefine;
319
+
302
320
{ Information about each of the supported platforms }
303
321
property Platforms[const AIndex: TPlatformType]: TPlatform read GetPlatform;
304
322
@@ -403,10 +421,12 @@ implementation
403
421
ID_UNCONVERTIBLE_HANDLING = ' UnconvertibleHandling' ;
404
422
ID_ENABLED = ' Enabled' ;
405
423
ID_LIBRARY_NAME = ' LibraryName' ;
424
+ ID_DEBUG_LIBRARY_NAME = ' DebugLibraryName' ;
406
425
ID_PREFIX = ' Prefix' ;
407
426
ID_LIBRARY_CONSTANT = ' LibraryConstant' ;
408
427
ID_EXCLUDED_HEADERS = ' ExcludedHeaders' ;
409
428
ID_CUSTOM_CTYPES_MAP = ' CTypesToDelphiMap' ;
429
+ ID_DEBUG_DEFINE = ' DebugDefine' ;
410
430
ID_COUNT = ' Count' ;
411
431
ID_ITEM = ' Item' ;
412
432
ID_SCRIPT = ' Script' ;
@@ -577,6 +597,7 @@ procedure TProject.Load(const AFilename: String);
577
597
FTargetPasFile := IniFile.ReadString(IS_PROJECT, ID_TARGET_PAS_FILE, ' ' );
578
598
FUseUnits := IniFile.ReadString(IS_PROJECT, ID_USE_UNITS, ' ' );
579
599
FLibraryConstant := IniFile.ReadString(IS_PROJECT, ID_LIBRARY_CONSTANT, ' ' );
600
+ FDebugDefine := IniFile.ReadString(IS_PROJECT, ID_DEBUG_DEFINE, ' ' );
580
601
FIgnoredFiles := IniFile.ReadString(IS_PROJECT, ID_EXCLUDED_HEADERS, ' ' );
581
602
FCustomCTypesMap := IniFile.ReadString(IS_PROJECT, ID_CUSTOM_CTYPES_MAP, ' ' );
582
603
for P := Low(TPlatformType) to High(TPlatformType) do
@@ -639,6 +660,7 @@ procedure TProject.Reset;
639
660
FTargetPasFile := ' ' ;
640
661
FUseUnits := ' ' ;
641
662
FLibraryConstant := ' ' ;
663
+ FDebugDefine := ' ' ;
642
664
FIgnoredFiles := ' ' ;
643
665
644
666
for P := Low(TPlatformType) to High(TPlatformType) do
@@ -675,6 +697,7 @@ procedure TProject.Save(const AFilename: String);
675
697
IniFile.WriteString(IS_PROJECT, ID_TARGET_PAS_FILE, FTargetPasFile);
676
698
IniFile.WriteString(IS_PROJECT, ID_USE_UNITS, FUseUnits);
677
699
IniFile.WriteString(IS_PROJECT, ID_LIBRARY_CONSTANT, FLibraryConstant);
700
+ IniFile.WriteString(IS_PROJECT, ID_DEBUG_DEFINE, FDebugDefine);
678
701
IniFile.WriteString(IS_PROJECT, ID_EXCLUDED_HEADERS, FIgnoredFiles);
679
702
IniFile.WriteString(IS_PROJECT, ID_CUSTOM_CTYPES_MAP, FCustomCTypesMap);
680
703
@@ -756,6 +779,15 @@ procedure TProject.SetCustomCTypesMap(const AValue: String);
756
779
end ;
757
780
end ;
758
781
782
+ procedure TProject.SetDebugDefine (const Value : String);
783
+ begin
784
+ if (Value <> FDebugDefine) then
785
+ begin
786
+ FDebugDefine := Value ;
787
+ Modified := True;
788
+ end ;
789
+ end ;
790
+
759
791
procedure TProject.SetDelayedLoading (const Value : Boolean);
760
792
begin
761
793
if (Value <> FDelayedLoading) then
@@ -921,13 +953,15 @@ procedure TPlatform.Load(const AIniFile: TMemIniFile);
921
953
922
954
FEnabled := AIniFile.ReadBool(Section, ID_ENABLED, False);
923
955
FLibraryName := AIniFile.ReadString(Section, ID_LIBRARY_NAME, ' ' );
956
+ FDebugLibraryName := AIniFile.ReadString(Section, ID_DEBUG_LIBRARY_NAME, ' ' );
924
957
FPrefix := AIniFile.ReadString(Section, ID_PREFIX, ' ' );
925
958
end ;
926
959
927
960
procedure TPlatform.Reset ;
928
961
begin
929
962
FEnabled := (FPlatformType = TPlatformType.Win32);
930
963
FLibraryName := ' ' ;
964
+ FDebugLibraryName := ' ' ;
931
965
FPrefix := ' ' ;
932
966
end ;
933
967
@@ -938,9 +972,19 @@ procedure TPlatform.Save(const AIniFile: TMemIniFile);
938
972
Section := IS_PLATFORM_PREFIX + GetEnumName(TypeInfo(TPlatformType), Ord(FPlatformType));
939
973
AIniFile.WriteBool(Section, ID_ENABLED, FEnabled);
940
974
AIniFile.WriteString(Section, ID_LIBRARY_NAME, FLibraryName);
975
+ AIniFile.WriteString(Section, ID_DEBUG_LIBRARY_NAME, FDebugLibraryName);
941
976
AIniFile.WriteString(Section, ID_PREFIX, FPrefix);
942
977
end ;
943
978
979
+ procedure TPlatform.SetDebugLibraryName (const AValue: String);
980
+ begin
981
+ if (AValue <> FDebugLibraryName) then
982
+ begin
983
+ FDebugLibraryName := AValue;
984
+ FProject.Modified := True;
985
+ end ;
986
+ end ;
987
+
944
988
procedure TPlatform.SetEnabled (const AValue: Boolean);
945
989
begin
946
990
if (AValue <> FEnabled) then
0 commit comments