Hi,

I'm trying to set up *tup* for a project organized (that is currently using 
*cmake* with broken and hard to maintain *CMakeLists.txt*) in modules.
The project directory tree is :

    ├── char
    │   ├── include
    │   └── src
    ├── core
    │   ├── include
    │   ├── obj
    │   └── src
    ├── login
    │   ├── include
    │   └── src
    ├── map
    │   ├── include
    │   └── src
    ├── proto
    └── rosecommon
        ├── include
        └── src


    

Each directory (*proto* excepted) is a module and is compiled into a static 
library. Those modules may use different flags. Each module depend on 
protobuf C++ file generated from the source file in *proto*.

I've tried two solution:


   - (solution 1) a root *Tupfile* that generate the protobuf C++ file and 
   a *Tupfile* by module that compile the C++ source code. With this 
   solution, *tup* complains that the module depends on file not generated 
   by *tup*
   - (solution 2) a *Tupfile* by module which generate the protobuf C++ 
   file and compile the module. With this solution, *tup* complains that it 
   can't find the protobuf files.



The *Tupfiles* for the solutions that I've tried:

The link part of the compilation (into the static library and into the 
final executable) is not in the *Tupfiles* presented but it does not affect 
the issue.


*Solution 1*

*Tuprules.tup*

 PROTOC      = protoc
 CC          = g++
    
 ROOT        = $(TUP_PWD)
    
 COREDIR     = $(ROOT)/core
 PROTOSRCDIR = $(ROOT)/proto




*Root Tupfile*

include_rules
: foreach proto/*.proto |> $(PROTOC) -I=$(PROTOSRCDIR) 
--cpp_out=$(COREDIR)/src %f |> $(COREDIR)/src/%B.pb.h 
$(COREDIR)/src/%B.pb.cc
# Same for the other modules



*Core tupfile (the other are the same, with some difference in the CFLAGS)*

include_rules
: foreach src/*.cpp | src/*.pb.c src/*.pb.h |> $(CC) $(CFLAGS) -o obj/%B.o 
-c %f |> obj/%B.o obj/%B.gcno




*Solution 2*

*Tuprules.tup*

PROTOC      = protoc
CC          = g++
    
ROOT        = $(TUP_PWD)

COREDIR     = $(ROOT)/core
PROTOSRCDIR = $(ROOT)/proto



*Core tupfile (the other are the same, with some difference in the CFLAGS)*

include_rules
: foreach proto/*.proto |> $(PROTOC) -I=$(PROTOSRCDIR) 
--cpp_out=$(COREDIR)/src %f |> $(COREDIR)/src/%B.pb.h 
$(COREDIR)/src/%B.pb.cc
: foreach src/*.cpp | src/*.pb.c src/*.pb.h |> $(CC) $(CFLAGS) -o obj/%B.o 
-c %f |> obj/%B.o obj/%B.gcno



How sould I organize *tup* for this project ?

Thank you for your answers.

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to