Skip to content

Commit 0af8baf

Browse files
committed
introduce _NBL_JOBS_AMOUNT_ and increase speed of DXC builds (TODO for future: use it anywhere we have custom commands we can specify jobs amount with)
1 parent 2c58b97 commit 0af8baf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/nbl/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# This file is part of the "Nabla Engine".
44
# For conditions of distribution and use, see copyright notice in nabla.h
55

6+
include(ProcessorCount)
7+
68
#[[
79
macro(FindLibraryAndSONAME _LIB)
810
string(TOUPPER ${_LIB} _UPPERLNAME)
@@ -546,8 +548,15 @@ if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
546548
add_dependencies(Nabla HLSL_NABLA_COMPILE_TEST)
547549
endif()
548550

551+
if(NOT DEFINED _NBL_JOBS_AMOUNT_)
552+
ProcessorCount(_NBL_JOBS_AMOUNT_)
553+
if(_NBL_JOBS_AMOUNT_ EQUAL 0)
554+
set(_NBL_JOBS_AMOUNT_ 1)
555+
endif()
556+
endif()
557+
549558
add_custom_command(OUTPUT "${DXC_LIB}" "${DXC_DLL}"
550-
COMMAND "${CMAKE_COMMAND}" --build "${DXC_BUILD_DIR}" --target dxcompiler --config $<IF:$<CONFIG:Debug>,Debug,Release> -v --clean-first
559+
COMMAND "${CMAKE_COMMAND}" --build "${DXC_BUILD_DIR}" --target dxcompiler --config $<IF:$<CONFIG:Debug>,Debug,Release> -v -j${_NBL_JOBS_AMOUNT_} --clean-first
551560
VERBATIM
552561
COMMAND_EXPAND_LISTS
553562
)

0 commit comments

Comments
 (0)