Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add concurrent level option for make while ninja is used #2701

Merged
merged 5 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ endif()

if(CMAKE_GENERATOR STREQUAL "Ninja")
set(MAKE_COMMAND make)
set(NINJA_MAKE_JOBS 4 CACHE STRING "specify concurrent level while ninja calling make")
set(NINJA_MAKE_JOBS_FLAG -j${NINJA_MAKE_JOBS})
else()
set(MAKE_COMMAND $(MAKE))
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/jemalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if(NOT jemalloc_POPULATED)
WORKING_DIRECTORY ${jemalloc_BINARY_DIR}
)
add_custom_target(make_jemalloc
COMMAND ${MAKE_COMMAND}
COMMAND ${MAKE_COMMAND} ${NINJA_MAKE_JOBS_FLAG}
WORKING_DIRECTORY ${jemalloc_BINARY_DIR}
BYPRODUCTS ${jemalloc_BINARY_DIR}/lib/libjemalloc.a
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/lua.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(NOT lua_POPULATED)
set(LUA_CFLAGS "${LUA_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
endif()

add_custom_target(make_lua COMMAND ${MAKE_COMMAND} "CC=${LUA_CXX}" "CFLAGS=${LUA_CFLAGS}" liblua.a
add_custom_target(make_lua COMMAND ${MAKE_COMMAND} "CC=${LUA_CXX}" "CFLAGS=${LUA_CFLAGS}" ${NINJA_MAKE_JOBS_FLAG} liblua.a
WORKING_DIRECTORY ${lua_SOURCE_DIR}/src
BYPRODUCTS ${lua_SOURCE_DIR}/src/liblua.a
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/luajit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if (NOT lua_POPULATED)
set(MACOSX_TARGET "MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif ()

add_custom_target(make_luajit COMMAND ${MAKE_COMMAND} libluajit.a
add_custom_target(make_luajit COMMAND ${MAKE_COMMAND} libluajit.a ${NINJA_MAKE_JOBS_FLAG}
"CFLAGS=${LUA_CFLAGS}" ${MACOSX_TARGET}
WORKING_DIRECTORY ${luajit_SOURCE_DIR}/src
BYPRODUCTS ${luajit_SOURCE_DIR}/src/libluajit.a
Expand Down
2 changes: 1 addition & 1 deletion cmake/lz4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if(NOT lz4_POPULATED)
set(APPLE_FLAG "CFLAGS=-isysroot ${CMAKE_OSX_SYSROOT}")
endif()

add_custom_target(make_lz4 COMMAND ${MAKE_COMMAND} CC=${CMAKE_C_COMPILER} ${APPLE_FLAG} liblz4.a
add_custom_target(make_lz4 COMMAND ${MAKE_COMMAND} CC=${CMAKE_C_COMPILER} ${NINJA_MAKE_JOBS_FLAG} ${APPLE_FLAG} liblz4.a
WORKING_DIRECTORY ${lz4_SOURCE_DIR}/lib
BYPRODUCTS ${lz4_SOURCE_DIR}/lib/liblz4.a
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/zstd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if(NOT zstd_POPULATED)
set(APPLE_FLAG "CFLAGS=-isysroot ${CMAKE_OSX_SYSROOT}")
endif()

add_custom_target(make_zstd COMMAND ${MAKE_COMMAND} CC=${CMAKE_C_COMPILER} ${APPLE_FLAG} libzstd.a
add_custom_target(make_zstd COMMAND ${MAKE_COMMAND} ${NINJA_MAKE_JOBS_FLAG} CC=${CMAKE_C_COMPILER} ${APPLE_FLAG} libzstd.a
WORKING_DIRECTORY ${zstd_SOURCE_DIR}/lib
BYPRODUCTS ${zstd_SOURCE_DIR}/lib/libzstd.a
)
Expand Down
Loading