Skip to content

[flang] Add FLANG_PARALLEL_COMPILE_JOBS option #95672

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

Merged
merged 2 commits into from
Jun 18, 2024
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
12 changes: 12 additions & 0 deletions flang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,18 @@ if (APPLE)
endif()
endif()

# Set up job pools for flang. Some of the flang sources take a lot of memory to
# compile, so allow users to limit the number of parallel flang jobs. This is
# useful for building flang alongside several other projects since you can use
# the maximum number of build jobs for the other projects while limiting the
# number of flang compile jobs.
#
# We want this set to infinity by default
set(FLANG_PARALLEL_COMPILE_JOBS 0 CACHE STRING
"The maximum number of concurrent compilation jobs (Ninja only)")

set_property(GLOBAL APPEND PROPERTY JOB_POOLS flang_compile_job_pool=${FLANG_PARALLEL_COMPILE_JOBS})

include(CMakeParseArguments)
include(AddFlang)

Expand Down
1 change: 1 addition & 0 deletions flang/cmake/modules/AddFlang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function(add_flang_library name)
set_property(GLOBAL APPEND PROPERTY FLANG_LIBS ${name})
endif()
set_property(GLOBAL APPEND PROPERTY FLANG_EXPORTS ${name})
set_property(TARGET obj.${name} PROPERTY JOB_POOL_COMPILE flang_compile_job_pool)
else()
# Add empty "phony" target
add_custom_target(${name})
Expand Down
Loading