On 16 September 2011 23:30, Dave Tapley <firstname.lastname@example.org> wrote:I presume everyone has a very long compile time when building wxcore?
Specifically rebuilding everything under src/cpp/ every time..
Has anyone ever looked into avoiding this complete rebuild?
I've just spent a few hours looking deeper in to this and come across two issues:
1. There is a very informative blog post written by Jeremy, which deals with the subject of "Compiling C or C++ code from within Cabal". Unfortunately I can't find any of the code mentioned in the post in the project, specifically I tried to find a "myBuildHook" in "./wxcore/Setup.hs" (I also looked in previous revisions using a trackdown grep) but I didn't find anything. Perhaps someone with better knowledge of the project can comment on if/where/when the code in the post was used?
2. Inspecting the wxdirect code you can see that "System.IO.writeFile" is used to write all the generated code, but no test is performed to see if the output file has actually changed. Thus the file is always opened for write, and so its modification time is changed, and so everything is recompiled every time wxcore is built. I have have written a local patch which replaces the "writeFile" function with one which first checks whether the string to be written differs (aside from date/time stamp) to the current one; it only performs the "writeFile" if there has been a change.
Using this patch none of the Haskell code is re-built, but unfortunately all the C++ code is.