From 046cdae1a14a686238ab91b1f883335b2de5a78c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 1 Jun 2021 00:17:38 +0100 Subject: Generate DbStmt templates from .sql files m4 generator and related code. Reshuffles some CTF stuff to avoid pulling in all of CTF and iostream for its fixed_string. Moves CTF out of AdHoc namespace. Add some initial SQL statements. --- Jamroot.jam | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Jamroot.jam') diff --git a/Jamroot.jam b/Jamroot.jam index bb22c83..883aaf0 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -4,6 +4,9 @@ using clang : 12 ; using pkg-config ; import pkg-config ; import testing ; +import type : register ; +import generators : register-standard ; +import regex : replace ; pkg-config.import libmariadb ; pkg-config.import libpq ; @@ -37,3 +40,21 @@ project : requirements build-project main ; build-project test ; + +path-constant root : . ; + +type.register SQL : sql ; + +generators.register-standard embed.sql : SQL : CPP H ; + +actions embed.sql +{ + echo "#include \"$(2:B).h\"" > $(1[1]) + m4 -DSOURCE=$(2) -DNS=$(NS) -DNAME=$(2:B) > $(1[2]) lib/genstmt.m4 +} +rule embed.sql ( targets * : sources * : properties * ) +{ + DEPENDS $(targets) : $(root)/lib/genstmt.m4 ; + NS on $(targets) = [ replace $(sources:D) "/" "::" ] ; +} +IMPORT $(__name__) : embed.sql : : embed.sql ; -- cgit v1.2.3