Skip to content

Commit

Permalink
Improve NodeJS build from source.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Feb 21, 2024
1 parent aa1b2a6 commit 4f1ef81
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmake/FindNodeJS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -542,14 +542,17 @@ if(NOT NodeJS_LIBRARY)

message(STATUS "Build NodeJS shared library")

# Create build output directory
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${NodeJS_OUTPUT_PATH}/out)

include(ProcessorCount)

ProcessorCount(N)

if(NOT N EQUAL 0)
execute_process(COMMAND sh -c "make -j${N} -C out BUILDTYPE=${CMAKE_BUILD_TYPE} V=1" WORKING_DIRECTORY "${NodeJS_OUTPUT_PATH}")
if(N GREATER 1)
execute_process(COMMAND sh -c "make -j${N} -C ${NodeJS_OUTPUT_PATH}/out BUILDTYPE=${CMAKE_BUILD_TYPE} V=1" WORKING_DIRECTORY "${NodeJS_OUTPUT_PATH}")
else()
execute_process(COMMAND sh -c "make -C out BUILDTYPE=${CMAKE_BUILD_TYPE} V=1" WORKING_DIRECTORY "${NodeJS_OUTPUT_PATH}")
execute_process(COMMAND sh -c "make -C ${NodeJS_OUTPUT_PATH}/out BUILDTYPE=${CMAKE_BUILD_TYPE} V=1" WORKING_DIRECTORY "${NodeJS_OUTPUT_PATH}")
endif()
endif()
endif()
Expand Down

0 comments on commit 4f1ef81

Please sign in to comment.