[odb-users] Headers organisation and include prefix
    MM 
    finjulhich at gmail.com
       
    Fri Jun  6 06:46:21 EDT 2014
    
    
  
Hello,
As non-intrusive odb is important to me, I have the following headers under
src
trunk (src dir)
|--- dir1--- *f.hpp*  (defines struct F)
                       #include "dir1/g.hpp"
                       struct F { G g; ... };
          --- *g.hpp* (defines class G)
                       class G { ... };
|
|--- dir1_odb --- *f.hpp* (contains odb pragmas for struct F: object )
                      #include <odb/core.hxx>
                      #include "dir1/f.hpp"
                      #include "dir1_odb/g.hpp"
                      // correct namespace
                      #pragma db object(F) definition
                  --- *g.hpp* (contains odb pragmas for class G: value type)
                      #include <odb/core.hxx>
                      #include "dir1/g.hpp"
                      // correct namespace
                      #pragma db value(G) definition
I use cmake and have the following out of src build dir
trunk-build-debug (build dir)
|----dir1 (objects for sources under dir1)
|----dir1_odb (this is where the output of odb compiler goes)
                  ----- f.hxx f.cxx f.ixx
                  ----- g.hxx g.cxx g.ixx
This is the odb command line:
odb -d sqlite --std c++11 --profile boost --generate-query -I<pathTrunk>
-IC:/boost/1_54 --include-prefix dir1_odb   <pathTrunk>/dir1_odb/f.hpp
odb -d sqlite --std c++11 --profile boost --generate-query
-I<pathTrunk> -IC:/boost/1_54 --include-prefix dir1_odb
<pathTrunk>/dir1_odb/g.hpp
This generates:
1) f-odb.hxx under trunk-build-debug/dir1_odb with this bit right after the
End prologue
            #include "dir1_odb/f.hpp" // correct, this comes from the
--include-prefix argument.
but also
           #include "dir1/g-odb.hxx"   //// wrong, this doesn't exist all.
           #include "dir1_odb/g-odb.hxx"   //// Ok, it's the result of
other odb compiler run
2) g-odb.hxx under trunk-build-debug/dir1_odb with this bit right after the
End prologue
            #include "dir1_odb/g.hpp" // correct, this comes from the
--include-prefix argument.
but also
           #include "dir1/g-odb.hxx"   //// wrong, this doesn't exist all.
I am a little confused as to what happens, and would appreciate advise on
reorg of headers if needed,
Thanks
MM
    
    
More information about the odb-users
mailing list