Commit 44d4a1ce authored by rarnu's avatar rarnu

add: 增加mac跨平台编译

parent f86b5833
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
*.ppu *.ppu
*.dcu *.dcu
*.rsm *.rsm
*.log
### Mac OS ### ### Mac OS ###
.DS_Store .DS_Store
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<%appSandboxKeys%>
</dict>
</plist>
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
interface interface
uses uses
{$IFDEF MSWINDOWS} Winapi.ShellAPI, Winapi.Windows, {$ENDIF}
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Layouts, FMX.Objects, FMX.Effects, FMX.Filter.Effects, FMX.Ani, Winapi.ShellAPI, Winapi.Windows; FMX.Layouts, FMX.Objects, FMX.Effects, FMX.Filter.Effects, FMX.Ani;
type type
TFormAbout = class(TForm) TFormAbout = class(TForm)
...@@ -38,7 +39,9 @@ end; ...@@ -38,7 +39,9 @@ end;
procedure TFormAbout.txtGitlabClick(Sender: TObject); procedure TFormAbout.txtGitlabClick(Sender: TObject);
begin begin
{$IFDEF WINDOWS}
ShellExecute(0, 'open', 'https://code.moenext.com/rarnu/puzzle-editor', nil, nil, SW_NORMAL); ShellExecute(0, 'open', 'https://code.moenext.com/rarnu/puzzle-editor', nil, nil, SW_NORMAL);
{$ENDIF}
end; end;
procedure TFormAbout.txtGitlabMouseEnter(Sender: TObject); procedure TFormAbout.txtGitlabMouseEnter(Sender: TObject);
......
...@@ -371,8 +371,10 @@ begin ...@@ -371,8 +371,10 @@ begin
end; end;
// debug // debug
{$IFDEF MSWINDOWS}
AMDPro3Path:= ADir + PathDelim + 'MDPro3.exe'; AMDPro3Path:= ADir + PathDelim + 'MDPro3.exe';
ShellExecute(0, 'open', PChar(AMDPro3Path), PChar(Format('-s %s', [DEBUG_NAME])), PChar(ADir), SW_SHOWNORMAL); ShellExecute(0, 'open', PChar(AMDPro3Path), PChar(Format('-s %s', [DEBUG_NAME])), PChar(ADir), SW_SHOWNORMAL);
{$ENDIF}
end; end;
procedure TFormMain.btnDelCardClick(Sender: TObject); procedure TFormMain.btnDelCardClick(Sender: TObject);
...@@ -876,6 +878,10 @@ begin ...@@ -876,6 +878,10 @@ begin
FFilePath:= ''; FFilePath:= '';
FCurrentCard := nil; FCurrentCard := nil;
{$IFNDEF MSWINDOWS}
btnDebug.Enabled := False;
{$ENDIF}
// init internal operation objects // init internal operation objects
BHand[0] := btnP0Hand; BHand[0] := btnP0Hand;
BHand[1] := btnP1Hand; BHand[1] := btnP1Hand;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
interface interface
uses uses
{$IFDEF MSWINDOWS} Windows, {$ENDIF}
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Layouts, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Edit, FMX.Layouts, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Edit,
...@@ -97,7 +96,7 @@ end; ...@@ -97,7 +96,7 @@ end;
procedure TFormSearchCard.edtCardNameKeyUp(Sender: TObject; var Key: Word; procedure TFormSearchCard.edtCardNameKeyUp(Sender: TObject; var Key: Word;
var KeyChar: WideChar; Shift: TShiftState); var KeyChar: WideChar; Shift: TShiftState);
begin begin
if (Key = VK_RETURN) then begin if (Key = vkReturn) then begin
btnSearchClick(btnSearch); btnSearchClick(btnSearch);
end; end;
end; end;
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
interface interface
uses uses
Windows, Classes, SysUtils, Registry, IniFiles; {$IFDEF MSWINDOWS} Windows, Registry, {$ENDIF}
Classes, SysUtils, IniFiles;
type type
TConfig = class TConfig = class
...@@ -29,6 +30,8 @@ var ...@@ -29,6 +30,8 @@ var
AToken: String; AToken: String;
begin begin
AToken := ''; AToken := '';
if (not FileExists(FMDConfPath)) then Exit(AToken);
with TStringList.Create do begin with TStringList.Create do begin
LoadFromFile(FMDConfPath, TEncoding.UTF8); LoadFromFile(FMDConfPath, TEncoding.UTF8);
// MyCardToken-> // MyCardToken->
...@@ -50,6 +53,7 @@ var ...@@ -50,6 +53,7 @@ var
begin begin
APath := ''; APath := '';
// GetMDPro3InstallPath // GetMDPro3InstallPath
{$IFDEF MSWINDOWS}
with TRegistry.Create do begin with TRegistry.Create do begin
RootKey:= HKEY_CURRENT_USER; RootKey:= HKEY_CURRENT_USER;
AOpened := OpenKey('Software\MDPro3\MDPro3Install', False); AOpened := OpenKey('Software\MDPro3\MDPro3Install', False);
...@@ -59,6 +63,10 @@ begin ...@@ -59,6 +63,10 @@ begin
end; end;
Free; Free;
end; end;
{$ENDIF}
// other platform will not have an callable MDPro3 installation.
Exit(APath); Exit(APath);
end; end;
...@@ -77,8 +85,15 @@ end; ...@@ -77,8 +85,15 @@ end;
class procedure TConfig.Init; class procedure TConfig.Init;
begin begin
{$IFDEF MSWINDOWS}
FMDConfPath := GetMDPro3InstallPath() + PathDelim + 'Data' + PathDelim + 'config.conf'; FMDConfPath := GetMDPro3InstallPath() + PathDelim + 'Data' + PathDelim + 'config.conf';
FConfPath := ChangeFileExt(ParamStr(0), '.conf'); FConfPath := ChangeFileExt(ParamStr(0), '.conf');
{$ENDIF}
{$IFDEF MACOS}
FMDConfPath := GetHomePath() + PathDelim + '.config' + PathDelim + 'PuzzleEditor2' + PathDelim + 'config.conf';
FConfPath := GetHomePath() + PathDelim + '.config' + PathDelim + 'PuzzleEditor2' + PathDelim + 'pe.conf';
{$ENDIF}
end; end;
...@@ -89,7 +104,10 @@ var ...@@ -89,7 +104,10 @@ var
begin begin
AFound:= False; AFound:= False;
with TStringList.Create do begin with TStringList.Create do begin
if (FileExists(FMDConfPath)) then begin
LoadFromFile(FMDConfPath, TEncoding.UTF8); LoadFromFile(FMDConfPath, TEncoding.UTF8);
end;
for i := 0 to Count - 1 do begin for i := 0 to Count - 1 do begin
if Strings[i].StartsWith('MyCardToken->') then begin if Strings[i].StartsWith('MyCardToken->') then begin
AFound := True; AFound := True;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<%VersionInfoPListKeys%>
<%ExtraInfoPListKeys%>
</dict>
</plist>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="Exists('$(BDS)\bin\CodeGear.Deployment.targets')" Project="$(BDS)\bin\CodeGear.Deployment.targets"/>
<ProjectExtensions>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<PropertyGroup>
<DeviceId Condition="'$(Platform)'=='Android'"/>
<DeviceId Condition="'$(Platform)'=='Android64'"/>
<DeviceId Condition="'$(Platform)'=='iOSDevice64'"/>
<DeviceId Condition="'$(Platform)'=='iOSSimARM64'"/>
</PropertyGroup>
<ItemGroup Condition="'$(Platform)'=='OSX64'"/>
<ItemGroup Condition="'$(Platform)'=='Win32'">
<DeployFile Include="Win32\Debug\puzzle2.exe" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2\</RemoteDir>
<RemoteName>puzzle2.exe</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='OSXARM64'">
<DeployFile Include="OSXARM64\Debug\puzzle2" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2.app\Contents\MacOS\</RemoteDir>
<RemoteName>puzzle2</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
<DeployFile Include="OSXARM64\Debug\puzzle2.dSYM" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2.app\..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF\</RemoteDir>
<RemoteName>puzzle2</RemoteName>
<DeployClass>ProjectOSXDebug</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="OSXARM64\Release\puzzle2.info.plist" Condition="'$(Config)'=='Release'">
<RemoteDir>puzzle2.app\Contents\</RemoteDir>
<RemoteName>Info.plist</RemoteName>
<DeployClass>ProjectOSXInfoPList</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="$(BDS)\Redist\osx64\libcgsqlite3.dylib" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2.app\Contents\MacOS\</RemoteDir>
<RemoteName>libcgsqlite3.dylib</RemoteName>
<DeployClass>File</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="$(BDS)\Redist\osx64\libcgsqlite3.dylib" Condition="'$(Config)'=='Release'">
<RemoteDir>puzzle2.app\Contents\MacOS\</RemoteDir>
<RemoteName>libcgsqlite3.dylib</RemoteName>
<DeployClass>File</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="OSXARM64\Release\puzzle2" Condition="'$(Config)'=='Release'">
<RemoteDir>puzzle2.app\Contents\MacOS\</RemoteDir>
<RemoteName>puzzle2</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
<DeployFile Include="OSXARM64\Debug\puzzle2.info.plist" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2.app\Contents\</RemoteDir>
<RemoteName>Info.plist</RemoteName>
<DeployClass>ProjectOSXInfoPList</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="$(BDS)\bin\delphi_PROJECTICNS.icns" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2.app\Contents\Resources\</RemoteDir>
<RemoteName>puzzle2.icns</RemoteName>
<DeployClass>ProjectOSXResource</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="$(BDS)\bin\delphi_PROJECTICNS.icns" Condition="'$(Config)'=='Release'">
<RemoteDir>puzzle2.app\Contents\Resources\</RemoteDir>
<RemoteName>puzzle2.icns</RemoteName>
<DeployClass>ProjectOSXResource</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="OSXARM64\Debug\puzzle2.entitlements" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2.app\..\</RemoteDir>
<RemoteName>puzzle2.entitlements</RemoteName>
<DeployClass>ProjectOSXEntitlements</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="C:\Program Files (x86)\Embarcadero\Studio\23.0\binosx64\libcgsqlite3.dylib" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2.app\Contents\Resources\StartUp\</RemoteDir>
<RemoteName>libcgsqlite3.dylib</RemoteName>
<DeployClass>File</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="OSXARM64\Release\puzzle2.entitlements" Condition="'$(Config)'=='Release'">
<RemoteDir>puzzle2.app\..\</RemoteDir>
<RemoteName>puzzle2.entitlements</RemoteName>
<DeployClass>ProjectOSXEntitlements</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='Android'"/>
<ItemGroup Condition="'$(Platform)'=='Win64'">
<DeployFile Include="Win64\Debug\puzzle2.exe" Condition="'$(Config)'=='Debug'">
<RemoteDir>puzzle2\</RemoteDir>
<RemoteName>puzzle2.exe</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='Android64'"/>
<ItemGroup Condition="'$(Platform)'=='iOSDevice64'"/>
<ItemGroup Condition="'$(Platform)'=='iOSSimARM64'"/>
<ItemGroup Condition="'$(Platform)'=='Win64x'"/>
<ItemGroup Condition="'$(Platform)'=='Linux64'"/>
</Project>
...@@ -5,11 +5,10 @@ ...@@ -5,11 +5,10 @@
<FrameworkType>FMX</FrameworkType> <FrameworkType>FMX</FrameworkType>
<Base>True</Base> <Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config> <Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win64</Platform> <Platform Condition="'$(Platform)'==''">OSXARM64</Platform>
<TargetedPlatforms>163842</TargetedPlatforms> <TargetedPlatforms>163842</TargetedPlatforms>
<AppType>Application</AppType> <AppType>Application</AppType>
<MainSource>puzzle2.dpr</MainSource> <MainSource>puzzle2.dpr</MainSource>
<ProjectName Condition="'$(ProjectName)'==''">puzzle2</ProjectName>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base> <Base>true</Base>
...@@ -109,6 +108,7 @@ ...@@ -109,6 +108,7 @@
<AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE> <AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
<AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE> <AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
<AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE> <AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
<FeatureFilesAdded>SQLite</FeatureFilesAdded>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''"> <PropertyGroup Condition="'$(Base_Android)'!=''">
<VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=;minSdkVersion=23;targetSdkVersion=34</VerInfo_Keys> <VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=;minSdkVersion=23;targetSdkVersion=34</VerInfo_Keys>
...@@ -380,6 +380,70 @@ ...@@ -380,6 +380,70 @@
<Overwrite>true</Overwrite> <Overwrite>true</Overwrite>
</Platform> </Platform>
</DeployFile> </DeployFile>
<DeployFile LocalName="$(BDS)\Redist\osx64\libcgsqlite3.dylib" Configuration="Debug" Class="File">
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS\</RemoteDir>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\osx64\libcgsqlite3.dylib" Configuration="Release" Class="File">
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS\</RemoteDir>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\bin\delphi_PROJECTICNS.icns" Configuration="Debug" Class="ProjectOSXResource">
<Platform Name="OSXARM64">
<RemoteName>puzzle2.icns</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\bin\delphi_PROJECTICNS.icns" Configuration="Release" Class="ProjectOSXResource">
<Platform Name="OSXARM64">
<RemoteName>puzzle2.icns</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="C:\Program Files (x86)\Embarcadero\Studio\23.0\binosx64\libcgsqlite3.dylib" Configuration="Debug" Class="File">
<Platform Name="OSXARM64">
<RemoteName>libcgsqlite3.dylib</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="OSXARM64\Debug\puzzle2.entitlements" Configuration="Debug" Class="ProjectOSXEntitlements">
<Platform Name="OSXARM64">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="OSXARM64\Debug\puzzle2.info.plist" Configuration="Debug" Class="ProjectOSXInfoPList">
<Platform Name="OSXARM64">
<RemoteName>Info.plist</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="OSXARM64\Debug\puzzle2" Configuration="Debug" Class="ProjectOutput">
<Platform Name="OSXARM64">
<RemoteName>puzzle2</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="OSXARM64\Release\puzzle2.entitlements" Configuration="Release" Class="ProjectOSXEntitlements">
<Platform Name="OSXARM64">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="OSXARM64\Release\puzzle2.info.plist" Configuration="Release" Class="ProjectOSXInfoPList">
<Platform Name="OSXARM64">
<RemoteName>Info.plist</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="OSXARM64\Release\puzzle2" Configuration="Release" Class="ProjectOutput">
<Platform Name="OSXARM64">
<RemoteName>puzzle2</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Win32\Debug\puzzle2.exe" Configuration="Debug" Class="ProjectOutput"> <DeployFile LocalName="Win32\Debug\puzzle2.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32"> <Platform Name="Win32">
<RemoteName>puzzle2.exe</RemoteName> <RemoteName>puzzle2.exe</RemoteName>
...@@ -392,12 +456,6 @@ ...@@ -392,12 +456,6 @@
<Overwrite>true</Overwrite> <Overwrite>true</Overwrite>
</Platform> </Platform>
</DeployFile> </DeployFile>
<DeployFile LocalName="Win64\Debug\puzzle2.rsm" Configuration="Debug" Class="DebugSymbols">
<Platform Name="Win64">
<RemoteName>puzzle2.rsm</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols"> <DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator"> <Platform Name="iOSSimulator">
<Operation>1</Operation> <Operation>1</Operation>
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment