From d2c148d10b010d9358e3304382fd156265ce4159 Mon Sep 17 00:00:00 2001 From: Laentir Valetov Date: Fri, 20 Dec 2019 16:03:49 +0400 Subject: [PATCH] First step to Lazarus Signed-off-by: Laentir Valetov --- .gitignore | 14 +++++++------- README.md | 27 ++++++++++++++------------- source/OpenCV.inc | 1 + source/ocv.core_c.pas | 7 +++++-- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 3e9eace..c5cab64 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,14 @@ Debug/ Release/ ipch/ lib/ +packages/Lazarus/ /resource/result/*.* CVAutoInstaller/ -/source/ffmpeg/examples -/source/ffmpeg/headers + +!InitDelphiFFMPEG.cmd +!/CheckCVDep/CheckCVDep.exe +!opencv_classes*.dll +!opencv_classes*.dll #ResourceFiles /resource/stereosample/Aloe/*.png @@ -18,7 +22,6 @@ CVAutoInstaller/ #Files *.exe -!/CheckCVDep/CheckCVDep.exe #*.dll *.ini *.bsc @@ -50,13 +53,10 @@ CVAutoInstaller/ *.local *.identcache *.cmd -!InitDelphiFFMPEG.cmd *.stat *.iobj *.ipdb *.db *.user *.filters -*.user -!opencv_classes*.dll -!opencv_classes*.dll \ No newline at end of file +*.user \ No newline at end of file diff --git a/README.md b/README.md index 9c5b810..f1d839f 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ or from the repository (Delphi-OpenCV\redist\ffmpeg): (4) FFmpeg 64-bit Shared "\x64" ``` * Dynamic library OpenCV need to download [here][4]
-Files: *2413.dll and *2413d.dll -``` +Files: *2413.dll and *2413d.dll
After installing OpenCV: +``` (5) 32-bit in the C:\OpenCV\build\x86\vc14\bin\*.dll (6) 64-bit in the C:\OpenCV\build\x64\vc14\bin\*.dll ``` @@ -35,17 +35,7 @@ or from the repository (Delphi-OpenCV\redist\SDL\1.2 and \2.0): (8) 64-bit - SDL.dll and SDL2.dll "\x64" ``` # How to install: -## 1. Copy dynamic libraries files -OS Windows 64-bit
-``` -Target platform 64-bit: (2),(4),(6),(8) -> "C:\Windows\System32\" -Target platform 32-bit: (1),(3),(5),(7) -> "C:\Windows\SysWOW64\" -``` -OS Windows 32-bit
-``` -Target platform 32-bit: (1),(3),(5),(7) -> "C:\Windows\System32\" -``` -## 2. Delphi environment setting +## 1. Delphi environment setting Download and unzip the [archive][1] or clone repository
``` git clone https://github.com/Laex/Delphi-OpenCV.git @@ -83,6 +73,17 @@ Add the search path for the modules of the project in Delphi IDE
\Delphi-FFMPEG\source ``` where `````` directory, which was unzipped (or cloned) repository.
+## 2. Copy dynamic libraries files +OS Windows 64-bit
+``` +Target platform 64-bit: (2),(4),(6),(8) -> "C:\Windows\System32\" +Target platform 32-bit: (1),(3),(5),(7) -> "C:\Windows\SysWOW64\" +``` +OS Windows 32-bit
+``` +Target platform 32-bit: (1),(3),(5),(7) -> "C:\Windows\System32\" +``` +Alternatively, dynamic libraries can be placed next to an executable file. ## 3. Verify that the environment is configured correctly Run from the repository ``` diff --git a/source/OpenCV.inc b/source/OpenCV.inc index 9d46547..fd64f19 100644 --- a/source/OpenCV.inc +++ b/source/OpenCV.inc @@ -538,6 +538,7 @@ { Set FreePascal to Delphi mode } {$IFDEF FPC} {$mode objfpc} +// {$MODE DELPHI} {$H+} {$modeswitch ADVANCEDRECORDS} {$DEFINE CPUASM} diff --git a/source/ocv.core_c.pas b/source/ocv.core_c.pas index b3afcd8..a9e9981 100644 --- a/source/ocv.core_c.pas +++ b/source/ocv.core_c.pas @@ -2675,10 +2675,13 @@ asm pop ecx // чистим стек mov ecx, edx // сохраняем младшую часть результата _cvGetSize pop edx // восстанавливаем Result +{$IFDEF FPC} + mov DWORD PTR [ebp-$08],eax + mov DWORD PTR [ebp-$04],ecx +{$ELSE} mov Result.width, eax -// mov DWORD PTR [ebp-$08],eax mov Result.height, ecx -// mov DWORD PTR [ebp-$04],ecx +{$ENDIF FPC} end; {$ENDIF CPU32} {$IFDEF CPU64}