Commit 44d4a1ce authored by rarnu's avatar rarnu

add: 增加mac跨平台编译

parent f86b5833
......@@ -7,7 +7,7 @@
*.ppu
*.dcu
*.rsm
*.log
### Mac OS ###
.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 @@
interface
uses
{$IFDEF MSWINDOWS} Winapi.ShellAPI, Winapi.Windows, {$ENDIF}
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
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
TFormAbout = class(TForm)
......@@ -38,7 +39,9 @@ end;
procedure TFormAbout.txtGitlabClick(Sender: TObject);
begin
{$IFDEF WINDOWS}
ShellExecute(0, 'open', 'https://code.moenext.com/rarnu/puzzle-editor', nil, nil, SW_NORMAL);
{$ENDIF}
end;
procedure TFormAbout.txtGitlabMouseEnter(Sender: TObject);
......
......@@ -371,8 +371,10 @@ begin
end;
// debug
{$IFDEF MSWINDOWS}
AMDPro3Path:= ADir + PathDelim + 'MDPro3.exe';
ShellExecute(0, 'open', PChar(AMDPro3Path), PChar(Format('-s %s', [DEBUG_NAME])), PChar(ADir), SW_SHOWNORMAL);
{$ENDIF}
end;
procedure TFormMain.btnDelCardClick(Sender: TObject);
......@@ -876,6 +878,10 @@ begin
FFilePath:= '';
FCurrentCard := nil;
{$IFNDEF MSWINDOWS}
btnDebug.Enabled := False;
{$ENDIF}
// init internal operation objects
BHand[0] := btnP0Hand;
BHand[1] := btnP1Hand;
......
......@@ -3,7 +3,6 @@
interface
uses
{$IFDEF MSWINDOWS} Windows, {$ENDIF}
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Layouts, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Edit,
......@@ -97,7 +96,7 @@ end;
procedure TFormSearchCard.edtCardNameKeyUp(Sender: TObject; var Key: Word;
var KeyChar: WideChar; Shift: TShiftState);
begin
if (Key = VK_RETURN) then begin
if (Key = vkReturn) then begin
btnSearchClick(btnSearch);
end;
end;
......
......@@ -3,7 +3,8 @@
interface
uses
Windows, Classes, SysUtils, Registry, IniFiles;
{$IFDEF MSWINDOWS} Windows, Registry, {$ENDIF}
Classes, SysUtils, IniFiles;
type
TConfig = class
......@@ -29,6 +30,8 @@ var
AToken: String;
begin
AToken := '';
if (not FileExists(FMDConfPath)) then Exit(AToken);
with TStringList.Create do begin
LoadFromFile(FMDConfPath, TEncoding.UTF8);
// MyCardToken->
......@@ -50,6 +53,7 @@ var
begin
APath := '';
// GetMDPro3InstallPath
{$IFDEF MSWINDOWS}
with TRegistry.Create do begin
RootKey:= HKEY_CURRENT_USER;
AOpened := OpenKey('Software\MDPro3\MDPro3Install', False);
......@@ -59,6 +63,10 @@ begin
end;
Free;
end;
{$ENDIF}
// other platform will not have an callable MDPro3 installation.
Exit(APath);
end;
......@@ -77,8 +85,15 @@ end;
class procedure TConfig.Init;
begin
{$IFDEF MSWINDOWS}
FMDConfPath := GetMDPro3InstallPath() + PathDelim + 'Data' + PathDelim + 'config.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;
......@@ -89,7 +104,10 @@ var
begin
AFound:= False;
with TStringList.Create do begin
LoadFromFile(FMDConfPath, TEncoding.UTF8);
if (FileExists(FMDConfPath)) then begin
LoadFromFile(FMDConfPath, TEncoding.UTF8);
end;
for i := 0 to Count - 1 do begin
if Strings[i].StartsWith('MyCardToken->') then begin
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 @@
<FrameworkType>FMX</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win64</Platform>
<Platform Condition="'$(Platform)'==''">OSXARM64</Platform>
<TargetedPlatforms>163842</TargetedPlatforms>
<AppType>Application</AppType>
<MainSource>puzzle2.dpr</MainSource>
<ProjectName Condition="'$(ProjectName)'==''">puzzle2</ProjectName>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
......@@ -109,6 +108,7 @@
<AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
<AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
<AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
<FeatureFilesAdded>SQLite</FeatureFilesAdded>
</PropertyGroup>
<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>
......@@ -380,6 +380,70 @@
<Overwrite>true</Overwrite>
</Platform>
</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">
<Platform Name="Win32">
<RemoteName>puzzle2.exe</RemoteName>
......@@ -392,12 +456,6 @@
<Overwrite>true</Overwrite>
</Platform>
</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">
<Platform Name="iOSSimulator">
<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