[odb-users] Integrating ODB into an automake project
per.edin at sequence-point.se
Mon Jan 17 10:43:02 EST 2022
I'm using build2 for building my projects, but I think the same applies to
whatever build system you're using.
Don't "auto-generate" the files during build, instead, create a script that
runs ODB on whatever files are required, then commit those files as part of
the source tree. This allows others to build the project without requiring
the ODB compiler unless they also have to modify the schema.
In addition, ODB generates a changelog of the schema to enable migrations,
this file needs to be committed as well, and could change as a result of
simply building the project if ODB is run automatically.
In conclusion, I would advise against auto-running ODB during builds. I did
try and gave up on it.
See https://git.build2.org/cgit/bdep/tree/bdep/odb.sh for an example (part
of bdep, part of build2).
On Mon, Jan 17, 2022 at 4:35 PM Ali Sherief <ali at notatether.com> wrote:
> I have wrote a fairly large project which utilizes ODB. There are about a
> dozen or so files that need to be preprocessed with the ODB compiler before
> the results can be compiled with the rest of the project.
> My project's build system is a standard ./autogen.sh && ./configure &&
> make process. I am wondering at which stage of the build process I should
> place the ODB compilation commands. My gut feeling tells me in the
> ./autogen.sh script is the most logical place, but then again, I would like
> it to be compiled alongside the rest of the files during the `make` process.
> Kind Regards,
> Ali Sherief
More information about the odb-users