Hi Mike, thanks for the reply! That's a nice solution, it's a bit cleaner than what I came up with and I might end up using it. The solution I came up with is to copy the internals of the !cc macro and have it compile the files without specifying them as inputs. I think it should still pick up changes outside the project with updater.full_deps set.
: |> @(CC) $(CFLAGS) /usr/src/gtest/src/gtest-all.cc \ -I /usr/src/gtest -o gtest-all.o |> gtest-all.o : |> @(CC) $(CFLAGS) /usr/src/gtest/src/gtest_main.cc \ -I /usr/src/gtest -o gtest_main.o |> gtest_main.o I think the most general and desirable solution to something like this would be to invoke the foreign project's build system if it has one. It happens that gtest/gmock (installed from .deb packages) have cmake scripts so I tried to hook up with those: # Generate a Makefile for gtest in this directory : |> cmake /usr/src/gtest |> But tup isn't happy about all of the stuff that gets generated: tup error: Directory '/home/elliott/projects/Project/build-gcc_dbg/CMakeFiles/2.8.12.1' was created, but not subsequently removed. Only temporary directories can be created by commands. ... It's actually close to 10 files in various directories that get generated by this command so I wouldn't want to list them as outputs; there's a good chance they would change in the future. I wonder if this approach has any more potential? Would tup be happy if the generated files went outside of the local project? On Thursday, January 9, 2014 1:54:42 PM UTC-8, [email protected] wrote: > > Hi Elliott, > > On Tue, Jan 7, 2014 at 1:07 AM, Elliott Conant > <[email protected]<javascript:> > > wrote: > >> I have a project where I used to include the entire source of gtest and >> gmock, and I'm trying to refactor it so gtest and gmock are treated as >> external projects but still built. Is this possible? I'd prefer not to >> add new tupfiles outside of ~/projects/Project. >> I also set the option updater.full_deps = 'true' which tracks >> dependencies outside of the project dir, but it doesn't seem to help this >> case. >> >> So I have: >> >> /usr/src/gtest/src/gtest-all.cc >> /usr/src/gmock/src/gmock-all.cc >> >> ~/projects/Project >> Tupfile >> *.cc >> *.h >> >> ~/projects/Project/Tupfile: >> : /usr/src/gtest/src/gtest-all.cc |> !cc |> >> : /usr/src/gmock/src/gmock-all.cc |> !cc |> >> ... >> >> And I'm getting an error from Tup: >> tup error: Failed to find directory ID for dir >> '/usr/src/gtest/src/gtest-all.cc' relative to 35 >> tup error: Error parsing Tupfile line 2 >> Line was: ': /usr/src/gtest/src/gtest-all.cc |> !cc |>' >> > > Tup is trying to convert the path to a database node, and this part of the > code doesn't account for full deps. It's just expecting all inputs to be > inside the .tup hierarchy. The easiest thing you can probably do is just > add symlinks to gtest-all.cc and gmock-all.cc inside your project: > > cd ~/projects/Project > ln -s /usr/src/gmock/src/gmock-all.cc > > Then in the Tupfile: > > : foreach *.cc |> !cc |> > > Since you have full_deps enabled, a change to > /usr/src/gmock/src/gmock-all.cc should get picked up and cause it to be > rebuilt: > > $ tup upd > [ tup ] [0.000s] Scanning filesystem... > External file has changed: /home/marf/test-fulldep/src/gmock-all.c > [ tup ] [0.030s] Reading in new environment variables... > [ tup ] [0.030s] No Tupfiles to parse. > [ tup ] [0.030s] No files to delete. > [ tup ] [0.030s] Executing Commands... > 1) [0.022s] gcc -c gmock-all.c -o > gmock-all.o > [ ] 100% > [ tup ] [0.070s] Updated. > > Does that help? If not we can try some other options. > > -Mike > -- -- 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/groups/opt_out.
