Building
June 12, 2026 · View on GitHub
← Documentation · Structure · Components
Requirements
- Windows 10/11, x64
- Embarcadero Delphi (Win64), tested with Studio 37
- OpenCV 5.0 with modules
dnn,videoio,highgui,objdetect,features,stereo,photo,stitching - Visual Studio / MSVC, CMake ≥ 3.16
- OpenCV DLLs (
opencv_world*.dllor modules) — inbin/orPATH
1. C++ wrapper
cd wrapper
cmake -B build -D OpenCV_DIR=C:/opencv/opencv-5.0/build
cmake --build build --config Release
Or Visual Studio: wrapper/build/opencv_delphi_wrapper.slnx → Release | x64.
Output: wrapper/build/Release/opencv_delphi_wrapper.dll → copy to bin/ together with OpenCV DLLs.
2. Delphi applications
.\build_all.ps1
The script builds the wrapper, copies DLLs, and compiles each .dpr from its folder (required for DemoUtils).
CI:
.\ci.ps1
Manual build (example):
$dcc = "C:\Program Files (x86)\Embarcadero\Studio\37.0\bin\dcc64.exe"
$root = "D:\Work\Delphi\OpenCV\OpenCV 5.0"
$U = "-U""$root\source"""
$N = "-N""$root\samples\common"""
& $dcc -Q -E"$root\bin" $U "$root\samples\TestOpenCV5\TestOpenCV5.dpr"
& $dcc -Q -E"$root\bin" $U $N "$root\samples\DemoDnnPpocr5\DemoDnnPpocr5.dpr"
All executables and opencv_delphi_wrapper.dll go to bin/. Run from bin/ so relative paths to models\ and images work.
See Demos and tests · Models
Delphi packages
.\build_package.ps1
# custom compiler path:
.\build_package.ps1 -Dcc "C:\Program Files (x86)\Embarcadero\Studio\37.0\bin\dcc64.exe"
Build order: OpenCV5 → OpenCV5Vcl / OpenCV5Fmx → OpenCV5Design (design-time; may be skipped on IDE RTL link errors).
| Artifact | Directory |
|---|---|
.bpl | bin\bpl\ |
.dcp | bin\dcp\ |
.dcu (IDE) | dcu\Win64\Release\ |
IDE installation (Win64)
- Tools → Options → Delphi → Library → Library path — add:
…\OpenCV 5.0\source…\OpenCV 5.0\bin\bpl…\OpenCV 5.0\bin\dcp
- Component → Install Packages —
OpenCV5.bpl(required),OpenCV5Design.bpl(Object Inspector), thenOpenCV5Vcl.bpland/orOpenCV5Fmx.bpl.
Applications can use -Usource (as in build_all.ps1) or installed BPLs. Design-time forms require registered components — see Components.
Multiple Delphi versions
- Single
package/directory — shared.dpkand.pasfiles. - Separate build artifacts:
.bpl,.dcp,.dcuare incompatible across compiler versions (Studio 11, 12, 37, …). - One version (Studio 37):
bin\bplandbin\dcpare enough. - Multiple versions: use separate output dirs, e.g.
bin\D37\win64\bpl\, with a dedicated Library path per IDE. opencv_delphi_wrapper.dlldoes not depend on Delphi version.
Components are Win64 only ({$MESSAGE ERROR} on Win32).