From 3cc4617f0dada9452b9ea6e13b336a3da257f28a Mon Sep 17 00:00:00 2001 From: Macoy Madson Date: Fri, 17 Feb 2017 23:07:29 -0800 Subject: [PATCH] Fixed Jam Library rebuilding Fixed is a strong word - I hacked around a strange problem I was encountering where Jam would always fail to scan libraries for object dependencies. This would result in library rebuilds every time Jam was run, which is super shitty. Now, jam will leave the .o files alongside the .a files so it doesn't have to scan the archive. This isn't a true fix, but it gets the job done. Building when you've only changed a few files is now massively faster. I also found out how to enable parallel compiliation, so even full rebuilds are much quicker ('jam -j4'). --- Jamrules | 29 +++++++++++++++++++++++++---- README.md | 2 ++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Jamrules b/Jamrules index 9f8561d..1abb70c 100644 --- a/Jamrules +++ b/Jamrules @@ -1,4 +1,3 @@ - ## ## Compiler ## @@ -28,9 +27,31 @@ LINK = clang++ ; #C++FLAGS = -std=c++11 -stdlib=libc++ -fPIC -g -Og -Wall -Wextra ; # Required arguments for Unreal C++FLAGS = -std=c++11 -fPIC -g -Og -Wall -Wextra ; # Required arguments for tests -OBJECTC++FLAGS = -std=c++11 -lstdc++ -g -Og ; - HDRS = thirdParty/flatbuffers/include ; # TODO: add project-specific filetype rules for things like flatbuffer .json compilation (see "UserObject rule": -# https://swarm.workshop.perforce.com/view/guest/perforce_software/jam/src/Jamfile.html ) ? \ No newline at end of file +# https://swarm.workshop.perforce.com/view/guest/perforce_software/jam/src/Jamfile.html ) ? + +# TODO: Add variable that allows user to swap between compiling Unreal +# and compiling testse on the command line (see above page under "Variables +# used in Building Executables and Libraries) + +# TODO: [Hacked done] Calling jam -dc indicates that it thinks many unmodified files are newer, +# which is why it's building way more than it should be. Further investigation is needed, as if it +# has nothing to build it should complete almost instantly +# +# The problem was Library deletes .o files, preventing Jam from knowing what needs rebuilt +# (see https://swarm.workshop.perforce.com/view/guest/perforce_software/jam/src/Jambase.html) +# Actually, because I'm moving libs to lib/, Jam doesn't know to look there for .o +# (see http://maillist.perforce.com/pipermail/jamming/2004-November/004235.html) +# Motherfucker seems to be broken no matter fucking what (see src/Jamfile commented lines) +# +# Update: Something seems fucked with the Library or LibraryFromObjects rules. Instead of diving +# deeper, I'm going to just add this flag which will guarantee Jam won't rely on reading the libs +# to find "missing" objects +# (as an aside, https://swarm.workshop.perforce.com/view/guest/perforce_software/jam/src/Jam.html +# was helpful, esp 'jam -dx') +KEEPOBJS = true ; # This doesn't actually fix anything, though it seems like it should +NOARSCAN = true ; # This actually fixes the problem +#AR = ar rUu ; # I was thinking maybe the AR command was wrong (always outputting deterministically) + # It doesn't seem like this is the problem though \ No newline at end of file diff --git a/README.md b/README.md index f755026..e78e5d0 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ To build with jam, first install jam: `sudo apt-get install jam` Then run jam (in galavant/ is fine): `jam` +For vastly faster build times, add `-j` plus the number of CPU cores on your machine, e.g.: +`jam -j4` ## Dependencies