Bug 400607

Summary: Problem with building with parallel jobs in the README
Product: [Applications] krita Reporter: Bill Messenger <BillMess8>
Component: DocumentationAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: halla
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Bill Messenger 2018-11-03 01:51:42 UTC
In krita/3rdparty/README.md, it states:

If you want to build Qt and some other dependencies with parallel jobs, add -DSUBMAKE_JOBS=<n> to the cmake command where is the number of jobs to run (if your PC has 4 CPU cores, you might want to set it to 5).

Isn't this the correct way to do this like " -- -j <n>" ?

When I run this

cmake --build . --config RelWithDebInfo --target ext_boost -DSUBMAKE_JOBS=8

it says it is an unrecognized argument. But when I run

cmake --build . --config RelWithDebInfo --target ext_boost -- -j 8

it runs correctly with all 8 threads. Maybe it's just a problem on Windows, or maybe I'm missing something?
Comment 1 Bill Messenger 2018-11-03 01:55:35 UTC
Oh whoops. I just realized it meant to add it to the cmake command that was above it. That was a bit unclear. Maybe add the word "above" to that sentence.
Comment 2 Bill Messenger 2018-11-03 03:23:43 UTC
Actually, I tried it the correct way by adding "-DSUBMAKE_JOBS=8" to the cmake command, but it is still only using 1 of my cpu threads. I have to add "-- -j 8" to the end of each build target to get it to use all 8.
Comment 3 Halla Rempt 2018-11-15 09:34:43 UTC
The submake_jobs variable is only used for some subprojects:

CMakeLists.txt:if(NOT SUBMAKE_JOBS)
CMakeLists.txt: set(SUBMAKE_JOBS 1)
README.md:  `-DSUBMAKE_JOBS=<n>` to the cmake command where <n> is the number of jobs to
ext_boost/CMakeLists.txt:       BUILD_COMMAND <SOURCE_DIR>/b2.exe -j${SUBMAKE_JOBS} linkflags=${SECURITY_SHARED_LINKER_FLAGS} --with-system --build-dir=build-dir --prefix=${PREFIX_ext_boost} toolset=gcc variant=release link=shared  threading=multi architecture=x86 variant=release install
ext_boost/CMakeLists.txt:               BUILD_COMMAND <SOURCE_DIR>/b2 -j${SUBMAKE_JOBS} install
ext_pyqt/CMakeLists.txt:        BUILD_COMMAND mingw32-make -j${SUBMAKE_JOBS} CXXFLAGS=-D_hypot=hypot LDFLAGS=${SECURITY_SHARED_LINKER_FLAGS}
ext_pyqt/CMakeLists.txt:        INSTALL_COMMAND mingw32-make -j${SUBMAKE_JOBS} install
ext_qt/CMakeLists.txt:      BUILD_COMMAND mingw32-make -j${SUBMAKE_JOBS}
ext_qt/CMakeLists.txt:      INSTALL_COMMAND mingw32-make -j${SUBMAKE_JOBS} install
ext_sip/CMakeLists.txt:        BUILD_COMMAND mingw32-make -j${SUBMAKE_JOBS} LDFLAGS=${SECURITY_SHARED_LINKER_FLAGS}
ext_sip/CMakeLists.txt:        INSTALL_COMMAND mingw32-make -j${SUBMAKE_JOBS} install
Comment 4 Halla Rempt 2018-11-15 09:35:21 UTC
Git commit 5ba4657eee10ae46add6a4fbc39110a95d8bdfe6 by Boudewijn Rempt.
Committed on 15/11/2018 at 09:34.
Pushed by rempt into branch 'master'.

M  +4    -3    3rdparty/README.md

https://commits.kde.org/krita/5ba4657eee10ae46add6a4fbc39110a95d8bdfe6