mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
fix macOS build
This commit is contained in:
+1
-1
@@ -116,8 +116,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCATSerialThread.TryOpenPort: Boolean;
|
function TCATSerialThread.TryOpenPort: Boolean;
|
||||||
var
|
|
||||||
{$IFNDEF CAT_SERIAL_STUB}
|
{$IFNDEF CAT_SERIAL_STUB}
|
||||||
|
var
|
||||||
cfg: TCATSerialConfig;
|
cfg: TCATSerialConfig;
|
||||||
h: TSerialHandle;
|
h: TSerialHandle;
|
||||||
par: TParityType;
|
par: TParityType;
|
||||||
|
|||||||
+5
-2
@@ -8,7 +8,7 @@ unit ChannelStore;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Classes, Math, fpJSON, jsonparser, jsonscanner;
|
SysUtils, Classes, Math, fpJSON, jsonparser, jsonscanner, PlatformUtils;
|
||||||
|
|
||||||
const
|
const
|
||||||
CHANNELS_FILE = 'channels.json';
|
CHANNELS_FILE = 'channels.json';
|
||||||
@@ -36,7 +36,7 @@ type
|
|||||||
function JB(O: TJSONObject; const K: string; Def: Boolean): Boolean;
|
function JB(O: TJSONObject; const K: string; Def: Boolean): Boolean;
|
||||||
function JS(O: TJSONObject; const K: string; const Def: string): string;
|
function JS(O: TJSONObject; const K: string; const Def: string): string;
|
||||||
public
|
public
|
||||||
constructor Create(const AFilePath: string = CHANNELS_FILE);
|
constructor Create(const AFilePath: string = '');
|
||||||
procedure Load;
|
procedure Load;
|
||||||
procedure Save;
|
procedure Save;
|
||||||
function Count: Integer;
|
function Count: Integer;
|
||||||
@@ -69,6 +69,9 @@ end;
|
|||||||
constructor TChannelStore.Create(const AFilePath: string);
|
constructor TChannelStore.Create(const AFilePath: string);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
if AFilePath = '' then
|
||||||
|
FFilePath := GetAppCfgDir + CHANNELS_FILE
|
||||||
|
else
|
||||||
FFilePath := AFilePath;
|
FFilePath := AFilePath;
|
||||||
SetLength(FChannels, 0);
|
SetLength(FChannels, 0);
|
||||||
end;
|
end;
|
||||||
|
|||||||
+5
-5
@@ -7,10 +7,10 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, FlatButton, FlatEdit, FlatListBox, AppTheme, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FlatButton, FlatEdit, FlatListBox, AppTheme, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, ExtCtrls, ComCtrls, IniFiles,
|
StdCtrls, ExtCtrls, ComCtrls, IniFiles,
|
||||||
BoardUtils;
|
BoardUtils, PlatformUtils;
|
||||||
|
|
||||||
const
|
const
|
||||||
DEVICE_CFG_FILE = 'hpsdr_devices.ini';
|
DEVICE_CFG_NAME = 'hpsdr_devices.ini';
|
||||||
|
|
||||||
type
|
type
|
||||||
// Запись о сохранённом устройстве
|
// Запись о сохранённом устройстве
|
||||||
@@ -355,9 +355,9 @@ var
|
|||||||
Section: string;
|
Section: string;
|
||||||
begin
|
begin
|
||||||
FSavedCount := 0;
|
FSavedCount := 0;
|
||||||
if not FileExists(DEVICE_CFG_FILE) then Exit;
|
if not FileExists(GetAppCfgDir + DEVICE_CFG_NAME) then Exit;
|
||||||
|
|
||||||
Ini := TIniFile.Create(DEVICE_CFG_FILE);
|
Ini := TIniFile.Create(GetAppCfgDir + DEVICE_CFG_NAME);
|
||||||
try
|
try
|
||||||
N := Ini.ReadInteger('Devices', 'Count', 0);
|
N := Ini.ReadInteger('Devices', 'Count', 0);
|
||||||
SetLength(FSavedDevices, N);
|
SetLength(FSavedDevices, N);
|
||||||
@@ -381,7 +381,7 @@ var
|
|||||||
I: Integer;
|
I: Integer;
|
||||||
Section: string;
|
Section: string;
|
||||||
begin
|
begin
|
||||||
Ini := TIniFile.Create(DEVICE_CFG_FILE);
|
Ini := TIniFile.Create(GetAppCfgDir + DEVICE_CFG_NAME);
|
||||||
try
|
try
|
||||||
Ini.WriteInteger('Devices', 'Count', FSavedCount);
|
Ini.WriteInteger('Devices', 'Count', FSavedCount);
|
||||||
for I := 0 to FSavedCount - 1 do
|
for I := 0 to FSavedCount - 1 do
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ interface
|
|||||||
function QtPlatformAllowsOpenGLControls: Boolean;
|
function QtPlatformAllowsOpenGLControls: Boolean;
|
||||||
function HasOpenGLSpectrumSwitch: Boolean;
|
function HasOpenGLSpectrumSwitch: Boolean;
|
||||||
function CurrentScreenDPI: Integer;
|
function CurrentScreenDPI: Integer;
|
||||||
|
// Возвращает каталог для хранения конфигурации (с завершающим разделителем).
|
||||||
|
// macOS: ~/Library/Application Support/ewsdr/
|
||||||
|
// Linux: ~/.config/ewsdr/
|
||||||
|
// Windows: каталог исполняемого файла
|
||||||
|
function GetAppCfgDir: string;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -61,4 +66,15 @@ begin
|
|||||||
if Result <= 0 then Result := 96;
|
if Result <= 0 then Result := 96;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetAppCfgDir: string;
|
||||||
|
begin
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
|
Result := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)));
|
||||||
|
{$ELSE}
|
||||||
|
Result := IncludeTrailingPathDelimiter(GetAppConfigDir(False));
|
||||||
|
if not DirectoryExists(Result) then
|
||||||
|
ForceDirectories(Result);
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
+5
-2
@@ -6,7 +6,7 @@ unit Settings;
|
|||||||
}
|
}
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
interface
|
interface
|
||||||
uses SysUtils, Classes, Math, fpJSON, jsonparser, jsonscanner;
|
uses SysUtils, Classes, Math, fpJSON, jsonparser, jsonscanner, PlatformUtils;
|
||||||
|
|
||||||
const
|
const
|
||||||
SETTINGS_FILE = 'hpsdr_settings.json';
|
SETTINGS_FILE = 'hpsdr_settings.json';
|
||||||
@@ -268,7 +268,7 @@ type
|
|||||||
procedure JW(O: TJSONObject; const K: string; V: Boolean); overload;
|
procedure JW(O: TJSONObject; const K: string; V: Boolean); overload;
|
||||||
procedure JWS(O: TJSONObject; const K: string; const V: string);
|
procedure JWS(O: TJSONObject; const K: string; const V: string);
|
||||||
public
|
public
|
||||||
constructor Create(const FilePath: string = SETTINGS_FILE);
|
constructor Create(const FilePath: string = '');
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Load;
|
procedure Load;
|
||||||
procedure Save;
|
procedure Save;
|
||||||
@@ -428,6 +428,9 @@ end;
|
|||||||
constructor TSettingsManager.Create(const FilePath: string);
|
constructor TSettingsManager.Create(const FilePath: string);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
if FilePath = '' then
|
||||||
|
FFilePath := GetAppCfgDir + SETTINGS_FILE
|
||||||
|
else
|
||||||
FFilePath := FilePath;
|
FFilePath := FilePath;
|
||||||
FRoot := TJSONObject.Create;
|
FRoot := TJSONObject.Create;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ unit WDSP;
|
|||||||
|
|
||||||
// Если wdsp.dll / libwdsp.so отсутствует — функции будут nil вместо краша.
|
// Если wdsp.dll / libwdsp.so отсутствует — функции будут nil вместо краша.
|
||||||
// WDSPEngine.Open вернёт False и программа продолжит работу в демо-режиме.
|
// WDSPEngine.Open вернёт False и программа продолжит работу в демо-режиме.
|
||||||
{$IFDEF FPC}
|
|
||||||
{$WEAKEXTERNALSYMBOLS ON}
|
{$IFDEF DARWIN}
|
||||||
|
{$linklib wdsp}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@@ -28,9 +29,13 @@ uses
|
|||||||
const
|
const
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
WDSP_LIB = 'wdsp.dll';
|
WDSP_LIB = 'wdsp.dll';
|
||||||
{$ELSE}
|
{$ENDIF}
|
||||||
|
{$IFDEF LINUX}
|
||||||
WDSP_LIB = 'libwdsp.so';
|
WDSP_LIB = 'libwdsp.so';
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
WDSP_LIB = 'libwdsp.dylib';
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
// Analyzer detector modes
|
// Analyzer detector modes
|
||||||
DETECTOR_MODE_PEAK = 0;
|
DETECTOR_MODE_PEAK = 0;
|
||||||
|
|||||||
+3
-2
@@ -990,12 +990,13 @@ begin
|
|||||||
FLastError := '';
|
FLastError := '';
|
||||||
if FInitialized then Exit;
|
if FInitialized then Exit;
|
||||||
|
|
||||||
if not Assigned(@OpenChannel) then
|
if not Assigned(@OpenChannel) or not Assigned(@XCreateAnalyzer) or
|
||||||
|
not Assigned(@SetAnalyzer) then
|
||||||
begin
|
begin
|
||||||
FInitialized := False;
|
FInitialized := False;
|
||||||
DllPath := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + WDSP_LIB;
|
DllPath := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + WDSP_LIB;
|
||||||
if FileExists(DllPath) then
|
if FileExists(DllPath) then
|
||||||
FLastError := Format('Symbols from %s are not resolved. Check architecture (x64/x86) and dependencies.', [DllPath])
|
FLastError := Format('Symbols from %s are not resolved. Check architecture and library version (need WDSP with analyzer API).', [DllPath])
|
||||||
else
|
else
|
||||||
FLastError := Format('WDSP library not found: %s', [DllPath]);
|
FLastError := Format('WDSP library not found: %s', [DllPath]);
|
||||||
Exit;
|
Exit;
|
||||||
|
|||||||
@@ -44,6 +44,9 @@
|
|||||||
</Debugging>
|
</Debugging>
|
||||||
<LinkSmart Value="True"/>
|
<LinkSmart Value="True"/>
|
||||||
</Linking>
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CustomOptions Value="-k-L/usr/local/lib"/>
|
||||||
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
</Item>
|
</Item>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
@@ -283,5 +286,8 @@
|
|||||||
<DebugInfoType Value="dsDwarf3"/>
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</Linking>
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CustomOptions Value="-k-L/usr/local/lib"/>
|
||||||
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
|||||||
Reference in New Issue
Block a user