File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ if(ITKPythonPackage_USE_TBB)
2929 )
3030endif ()
3131
32+ if (${CMAKE_GENERATOR} STREQUAL "Ninja" )
33+ include (ProcessorCount)
34+ ProcessorCount(n_processors)
35+ set (ep_build_command BUILD_COMMAND ${CMAKE_COMMAND} --build <BUILD_DIR> -- -j${n_processors} -l${n_processors} )
36+ endif ()
37+
3238if (ITKPythonPackage_SUPERBUILD)
3339
3440 #-----------------------------------------------------------------------------
@@ -117,6 +123,7 @@ if(ITKPythonPackage_SUPERBUILD)
117123 ExternalProject_add(oneTBB
118124 URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.9.0.tar.gz
119125 URL_HASH SHA256=1ce48f34dada7837f510735ff1172f6e2c261b09460e3bf773b49791d247d24e
126+ ${ep_build_command}
120127 CMAKE_ARGS
121128 -DTBB_TEST:BOOL =OFF
122129 -DCMAKE_BUILD_TYPE:STRING =Release
@@ -265,6 +272,7 @@ if(ITKPythonPackage_SUPERBUILD)
265272
266273 ExternalProject_add(ITK
267274 DOWNLOAD_COMMAND ""
275+ ${ep_build_command}
268276 SOURCE_DIR ${ITK_SOURCE_DIR}
269277 BINARY_DIR ${ITK_BINARY_DIR}
270278 PREFIX "ITKp"
Original file line number Diff line number Diff line change 6363
6464# Build standalone project and populate archive cache
6565tbb_dir=$PWD /oneTBB-prefix/lib/cmake/TBB
66+ n_processors=$( sysctl -n hw.ncpu)
6667# So delocate can find the libs
6768export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH} :$PWD /oneTBB-prefix/lib
6869mkdir -p ITK-source
@@ -75,7 +76,7 @@ pushd ITK-source > /dev/null 2>&1
7576 -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${osx_target} \
7677 -DCMAKE_OSX_ARCHITECTURES:STRING=${osx_arch} \
7778 ${SCRIPT_DIR} /../
78- ${NINJA_EXECUTABLE}
79+ ${NINJA_EXECUTABLE} -j $n_processors -l $n_processors
7980popd > /dev/null 2>&1
8081
8182SINGLE_WHEEL=0
@@ -170,7 +171,7 @@ for VENV in "${VENVS[@]}"; do
170171 ${CMAKE_OPTIONS} \
171172 -G Ninja \
172173 ${source_path} \
173- && ninja\
174+ && ninja -j $n_processors -l $n_processors \
174175 || exit 1
175176 )
176177
You can’t perform that action at this time.
0 commit comments