|
PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
|
PineForge installs a standard CMake package config. Downstream projects pull it in with one find_package call.
That's it. PineForge::pineforge is an imported static-library target that carries:
<pineforge/pineforge.h>libpineforge.a-ffp-contract=off, so a translation unit that links it (a strategy's generated.cpp above all) rounds every * and + on its own, as libpineforge.a and TradingView's runtime do, instead of fusing them into one FMA on ARM64 or FMA-enabled x86 (PineForge::kernel carries it too)-fbracket-depth=1024, so the deeply nested C++ that codegen emits for deep Pine compilesEigen3::Eigen: the package config calls find_dependency(Eigen3 3.3), so Eigen must be findable by the consumer tooIf you installed to a non-standard prefix:
Or set CMAKE_PREFIX_PATH=/opt/pineforge.
The package config is SameMajorVersion: a minimum pins its major version, so find_package(PineForge 0.14 REQUIRED) does not find a 1.x install, and 1.0 does not find a 0.x one. From 1.0.0, within a major version PineForge guarantees C ABI back-compat — see ABI stability — so a minimum 1.x (any compatible later 1.x.y) is the recommended pin from 1.0.0. The version file is write_basic_package_version_file(... COMPATIBILITY SameMajorVersion) over the numeric MAJOR.MINOR.PATCH: a request is met by an install of its major version at or above it, so against v1.0.0 a minimum 1.0 or 1 finds it and 0.13, 1.1 or 2.0 do not. v1.0.0's tarballs and a -DPINEFORGE_VERSION_SOURCE=FILE build install as the VERSION file, 1.0.0; a git clone with tags configures from git describe (the default AUTO), as 1.0.0 at the v1.0.0 tag and 1.0.0-<n>-g<sha> past it, which find_package compares as 1.0.0.
find_package compares MAJOR.MINOR.PATCH only. A release candidate X.Y.Z-rc.N installs as PineForge_VERSION X.Y.Z with PineForge_VERSION_FULL X.Y.Z-rc.N, so find_package(PineForge X.Y.Z EXACT) accepts the candidate as well; a project that must tell a candidate from its release compares PineForge_VERSION_FULL, the value pf_version_string() returns. Generated strategy code pairs with exactly that full version of the engine (see Public contract).
-lstdc++ (-lc++ on macOS, whose SDK has no libstdc++) is required even from C TUs because the runtime is C++ inside. -lm covers the math.h calls inside the runtime's TA classes. -ffp-contract=off is the option the CMake package hands every consumer; compile a strategy's generated.cpp with it too (CXXFLAGS), and with Clang add -fbracket-depth=1024, the package's other consumer option.
PineForge does not ship a pkg-config .pc file (the CMake config is the canonical surface). If you need one, generate it from the PineForgeConfig.cmake properties at install time, or hand-roll one:
A compiled PineForge strategy is a separate shared object that also exports the public C ABI symbols (strategy_create, run_backtest, …). Each strategy .so statically links libpineforge.a internally; the runtime is not a separate runtime DSO.
You don't need PineForge installed on the target machine to run a prebuilt strategy .so — you only need it to build new strategies.
See Lifecycle for what to do with the handle once you have it.
If PineForge_VERSION_FULL doesn't match what you installed, your CMAKE_PREFIX_PATH or PineForge_DIR is pointing at a different copy.