Skip to content

Commit

Permalink
Sync with Embarcadero fork.
Browse files Browse the repository at this point in the history
  • Loading branch information
pyscripter committed Jun 26, 2022
1 parent bcd672f commit dc26d7f
Show file tree
Hide file tree
Showing 40 changed files with 2,399 additions and 3,181 deletions.
11 changes: 10 additions & 1 deletion Modules/DelphiFMX/DelphiFMX.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ uses
System.StartUpCopy,
SysUtils,
Classes,
FMX.Forms,
FMX.Types,
{$IFDEF OSX}
FMX.Context.Metal,
{$ENDIF OSX}
uMain in 'uMain.pas';

{$I ..\..\Source\Definition.Inc}
Expand All @@ -16,11 +21,15 @@ exports
{$IFDEF MSWINDOWS}
{$E pyd}
{$ENDIF}
{$WARN SYMBOL_PLATFORM OFF}
{$IFDEF LINUX}
{$SONAME 'DelphiFMX'}

{$ENDIF}
{$WARN SYMBOL_PLATFORM ON}

begin
{$IFDEF OSX}
GlobalUseMetal := TCustomContextMetal.IsMetalSupported();
{$ENDIF OSX}
end.

33 changes: 28 additions & 5 deletions Modules/DelphiFMX/DelphiFMX.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<MainSource>DelphiFMX.dpr</MainSource>
<Platform Condition="'$(Platform)'==''">Linux64</Platform>
<ProjectGuid>{0C4154A5-D276-4D62-BA30-564FACD77917}</ProjectGuid>
<ProjectVersion>19.2</ProjectVersion>
<TargetedPlatforms>37011</TargetedPlatforms>
<ProjectVersion>19.3</ProjectVersion>
<TargetedPlatforms>168083</TargetedPlatforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
Expand All @@ -28,6 +28,11 @@
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='OSXARM64' and '$(Base)'=='true') or '$(Base_OSXARM64)'!=''">
<Base_OSXARM64>true</Base_OSXARM64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
Expand Down Expand Up @@ -66,6 +71,12 @@
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='OSXARM64' and '$(Cfg_2)'=='true') or '$(Cfg_2_OSXARM64)'!=''">
<Cfg_2_OSXARM64>true</Cfg_2_OSXARM64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
<Cfg_2_Win64>true</Cfg_2_Win64>
<CfgParent>Cfg_2</CfgParent>
Expand Down Expand Up @@ -99,6 +110,13 @@
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple&apos;s speech recognition servers</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_OSXARM64)'!=''">
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple&apos;s speech recognition servers</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
<Base_OSX64>true</Base_OSX64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<BT_BuildType>Debug</BT_BuildType>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
Expand Down Expand Up @@ -129,6 +147,12 @@
<PropertyGroup Condition="'$(Cfg_2_OSX64)'!=''">
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_OSXARM64)'!=''">
<DCC_RemoteDebug>true</DCC_RemoteDebug>
<Cfg_2_OSX64>true</Cfg_2_OSX64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<Manifest_File>(None)</Manifest_File>
</PropertyGroup>
Expand All @@ -137,7 +161,6 @@
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="uMain.pas"/>
<None Include="PythonVersionIndex.inc"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
Expand All @@ -163,12 +186,12 @@
<Platforms>
<Platform value="Android">True</Platform>
<Platform value="Android64">True</Platform>
<Platform value="iOSDevice64">False</Platform>
<Platform value="Linux64">True</Platform>
<Platform value="OSX64">True</Platform>
<Platform value="OSXARM64">True</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>
<Platform value="iOSDevice64">False</Platform>
<Platform value="iOSSimulator">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
Expand Down
1 change: 0 additions & 1 deletion Modules/DelphiFMX/PythonVersionIndex.inc

This file was deleted.

16 changes: 9 additions & 7 deletions Modules/DelphiFMX/uMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ function PyInit_DelphiFMX: PPyObject; cdecl;

implementation

uses WrapDelphi, WrapDelphiFMX;
uses
System.SysUtils, WrapDelphi, WrapDelphiFMX;

var
gEngine : TPythonEngine;
Expand All @@ -23,11 +24,7 @@ function PyInit_DelphiFMX: PPyObject;
try
gEngine := TPythonEngine.Create(nil);
gEngine.AutoFinalize := False;
gEngine.UseLastKnownVersion := False;
// Adapt to the desired python version - Will only work with this version
var PythonVersionIndex := {$I PythonVersionIndex.inc}; // 7 = 3.9
gEngine.RegVersion := PYTHON_KNOWN_VERSIONS[PythonVersionIndex].RegVersion;
gEngine.DllName := PYTHON_KNOWN_VERSIONS[PythonVersionIndex].DllName;
gEngine.UseLastKnownVersion := true;

gModule := TPythonModule.Create(nil);
gModule.Engine := gEngine;
Expand All @@ -38,8 +35,11 @@ function PyInit_DelphiFMX: PPyObject;
gDelphiWrapper.Engine := gEngine;
gDelphiWrapper.Module := gModule;

gEngine.LoadDll;
gEngine.LoadDllInExtensionModule();
except
on E: Exception do begin
WriteLn('An error has occurred: ' + E.Message);
end;
end;
Result := gModule.Module;
end;
Expand All @@ -48,10 +48,12 @@ initialization
gEngine := nil;
gModule := nil;
gDelphiWrapper := nil;

finalization
gEngine.Free;
gModule.Free;
gDelphiWrapper.Free;

end.


2 changes: 1 addition & 1 deletion Modules/DelphiVCL/DelphiVCL.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ uses
Classes,
uMain in 'uMain.pas';

{$I Definition.Inc}
{$I ..\..\Source\Definition.Inc}

exports
// This must match the pattern "PyInit_[ProjectName]"
Expand Down
1 change: 0 additions & 1 deletion Modules/DelphiVCL/PythonVersionIndex.inc

This file was deleted.

16 changes: 9 additions & 7 deletions Modules/DelphiVCL/uMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ function PyInit_DelphiVCL: PPyObject; cdecl;

implementation

uses WrapDelphi, WrapDelphiVCL;
uses
System.SysUtils, WrapDelphi, WrapDelphiVCL;

var
gEngine : TPythonEngine;
Expand All @@ -23,11 +24,7 @@ function PyInit_DelphiVCL: PPyObject;
try
gEngine := TPythonEngine.Create(nil);
gEngine.AutoFinalize := False;
gEngine.UseLastKnownVersion := False;
// Adapt to the desired python version - Will only work with this version
var PythonVersionIndex := {$I PythonVersionIndex.inc}; // 7 = 3.9
gEngine.RegVersion := PYTHON_KNOWN_VERSIONS[PythonVersionIndex].RegVersion;
gEngine.DllName := PYTHON_KNOWN_VERSIONS[PythonVersionIndex].DllName;
gEngine.UseLastKnownVersion := true;

gModule := TPythonModule.Create(nil);
gModule.Engine := gEngine;
Expand All @@ -38,8 +35,11 @@ function PyInit_DelphiVCL: PPyObject;
gDelphiWrapper.Engine := gEngine;
gDelphiWrapper.Module := gModule;

gEngine.LoadDll;
gEngine.LoadDllInExtensionModule();
except
on E: Exception do begin
WriteLn('An error has occurred: ' + E.Message);
end;
end;
Result := gModule.Module;
end;
Expand All @@ -48,10 +48,12 @@ initialization
gEngine := nil;
gModule := nil;
gDelphiWrapper := nil;

finalization
gEngine.Free;
gModule.Free;
gDelphiWrapper.Free;

end.


Loading

0 comments on commit dc26d7f

Please sign in to comment.