build.lunar: Changing the cmake functions to be more inline with normal#187
build.lunar: Changing the cmake functions to be more inline with normal#187dagbrown merged 2 commits intolunar-linux:masterfrom
Conversation
usage. While the default Makefile generator defaults to Unix Makefiles, using Ninja streamlines things a bit. One item being cmake -B will create the out of source directory and no cd required and all operations are done at TLD of source. I have tested this on many, many modules and encountered no issues. If such is encountered then do something like this in $OPTS; -G "Unix Makefiles". The cmake_build_target function can be removed. Also I got tired of seeing invalid switches like BUILD_TESTING and SYSCONF_INSTALL_DIR during a compile. Besides, its my itch.
| verbose_msg "running \"default_cmake_build\"" | ||
| default_cmake_config && | ||
| default_make | ||
| cmake --build $MODULE-$VERSION && |
There was a problem hiding this comment.
@stumbles This change looks ok to me overall. However, I think one thing we need to confirm is whether this change breaks the parallel build or not. default_make() handles adding -j$MAKES, I don't think cmake handles this by default. Could you double-check that and adjust if necessary?
There was a problem hiding this comment.
This should satisfy things;
cmake --build $MODULE-$VERSION -j$(nproc) &&
There was a problem hiding this comment.
What you want is:
cmake --build $MODULE-$VERSION ${MAKES:+-j${MAKES}} &&
The number of parallel builds should be up to the user to choose. They don't necessarily want as many makes as there are processors. Me, I like to set the number of makes to be twice the number of cores, to take advantage of in-memory caching.
There was a problem hiding this comment.
That works for me dagbrown.
|
There is a small issue with this PR which was actually an issue with the previous cmake build: if some module required an out-of-source build (the one I discovered was libjpeg-turbo), the old cmake build makes a directory to build stuff in, and then changes into that directory. Which means that anything in a module's BUILD script after default_cmake_build might be in a different working directory after the default_cmake_build function finishes, which I think is clearly a bug. So this PR actually fixes that bug, which is good! But that also means we need to find any other cmake modules which might work around this bug and fix them if they do before we can merge. |
usage. While the default Makefile generator defaults to Unix Makefiles, using Ninja streamlines things a bit. One item being cmake -B will create the out of source directory and no cd required and all operations are done at TLD of source. I have tested this on many, many modules and encountered no issues.
If such is encountered then do something like this in $OPTS; -G "Unix Makefiles".
The cmake_build_target function can be removed. Also I got tired of seeing invalid switches like BUILD_TESTING and SYSCONF_INSTALL_DIR during a compile.
Besides, its my itch.