Hi,<div><br></div><div>I've just started looking into using cook for my build dependency system.</div><div><br></div><div>From what I can tell from the tutorial, it looked like the normal use of cook is to use a single cookbook for the entire project. What I would like to do is have a separate cookbook for each library and each executable.</div>
<div>I can use the #include directive to load in other cookbooks easily enough, but in my case I want the cook files to execute depending on where they are loaded from.</div><div><br></div><div>For instance, say I have a cookbook that builds a zlib library. For my repository its in /libraries/zlib. And say I have a program in /program1 which has a cookbook containing:</div>
<div>#include /libraries/zlib/Howto.cook</div><div><br></div><div>Basically I want that include to execute the zlib cookbook as if cook was called in the /libraries/zlib folder. Right now the /libraries/zlib folder would not be in the search path and thus everything wouldn't build properly.</div>
<div>What I could do is in the zlib cookbook is have this at the beginning:</div><div>old_search_list = [search_list];</div><div>search_list = [__FILEPATH__]\:[search_list];</div><div><br></div><div>where I define __FILEPATH__ to be a built-in which is the full path to the current cook file(like __FILE__ but the full path). Thus searching will begin in the correct directory(and presumably fix some of my issues).</div>
<div>At the end of the cookbook I would add:</div><div>search_list = [old_search_list];</div><div>to return search_list to its original state.</div><div><br></div><div>So this would require me to modify cook (which may be fine, but if I don't have to its better not to) to add the __FILEPATH__ intrinsic. Also this requires the above pattern in every cook file. Instead of doing this manually, I could modify cook to do the updating of search_list automatically.</div>
<div><br></div><div>One thing this wouldn't handle is name collisions. For build rules, the repository path could be hard-coded in, but this wouldn't solve the problem for variables. I haven't see support for namespaces in cook.</div>
<div><br></div><div>So this leads me to a few questions:</div><div>1) Is there something I've missed that lets me build a project easily with a cookbook for each library?</div><div>2) If there isn't, what are your thoughts on the above solution(s)?</div>
<div><br></div><div>Thanks!</div><div><br></div><div>Kyle</div><div><br></div>