diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-06-01 00:17:38 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-06-01 00:17:38 +0100 |
commit | 046cdae1a14a686238ab91b1f883335b2de5a78c (patch) | |
tree | 3fcf031cc9db3d40d65f6ec989b22d97a2dab11e /Jamroot.jam | |
parent | Read test DB connection details from env (diff) | |
download | mygrate-046cdae1a14a686238ab91b1f883335b2de5a78c.tar.bz2 mygrate-046cdae1a14a686238ab91b1f883335b2de5a78c.tar.xz mygrate-046cdae1a14a686238ab91b1f883335b2de5a78c.zip |
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.
Diffstat (limited to 'Jamroot.jam')
-rw-r--r-- | Jamroot.jam | 21 |
1 files changed, 21 insertions, 0 deletions
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 ; |