-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,11 @@ sources: | |
sha256: ce8508e318a01a63d4e8b3090ab2ded3c598a50258cc49e2625b9120d4c03ea5 | ||
|
||
patches: | ||
"13.0.0": | ||
- patch_file: "patches/13x/00-cmake-target-props.patch" | ||
Check warning on line 14 in recipes/llvm-core/all/conandata.yml GitHub Actions / Lint changed files (YAML files)conandata.yml schema warning
|
||
- patch_file: "patches/13x/01-calculate-job-pools.patch" | ||
Check warning on line 15 in recipes/llvm-core/all/conandata.yml GitHub Actions / Lint changed files (YAML files)conandata.yml schema warning
|
||
"12.0.0": | ||
- patch_file: "patches/12x/00-cmake-target-props.patch" | ||
Check warning on line 17 in recipes/llvm-core/all/conandata.yml GitHub Actions / Lint changed files (YAML files)conandata.yml schema warning
|
||
- patch_file: "patches/12x/01-calculate-job-pools.patch" | ||
Check warning on line 18 in recipes/llvm-core/all/conandata.yml GitHub Actions / Lint changed files (YAML files)conandata.yml schema warning
|
||
"11.1.0": | ||
- patch_file: "patches/11x/00-calculate-job-pools.patch" | ||
Check warning on line 20 in recipes/llvm-core/all/conandata.yml GitHub Actions / Lint changed files (YAML files)conandata.yml schema warning
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake | ||
index 5ef22eb493b..7078ae8bc86 100644 | ||
--- a/cmake/modules/HandleLLVMOptions.cmake | ||
+++ b/cmake/modules/HandleLLVMOptions.cmake | ||
@@ -25,8 +25,24 @@ string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO) | ||
|
||
# Ninja Job Pool support | ||
# The following only works with the Ninja generator in CMake >= 3.0. | ||
+if (NOT LLVM_RAM_PER_COMPILE_JOB) | ||
+ set(LLVM_RAM_PER_COMPILE_JOB "2000") | ||
+endif() | ||
set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING | ||
"Define the maximum number of concurrent compilation jobs (Ninja only).") | ||
+cmake_host_system_information(RESULT AVAILABLE_PHYSICAL_MEMORY QUERY AVAILABLE_PHYSICAL_MEMORY) | ||
+cmake_host_system_information(RESULT NUMBER_OF_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES) | ||
+if(LLVM_RAM_PER_COMPILE_JOB) | ||
+ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_COMPILE_JOB}" OUTPUT_FORMAT DECIMAL) | ||
+ if (memory_available_jobs LESS 1) | ||
+ set(memory_available_jobs 1) | ||
+ endif() | ||
+ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) | ||
+ set(LLVM_PARALLEL_COMPILE_JOBS "${memory_available_jobs}") | ||
+ else() | ||
+ set(LLVM_PARALLEL_COMPILE_JOBS "${NUMBER_OF_LOGICAL_CORES}") | ||
+ endif() | ||
+endif() | ||
if(LLVM_PARALLEL_COMPILE_JOBS) | ||
if(NOT CMAKE_GENERATOR STREQUAL "Ninja") | ||
message(WARNING "Job pooling is only available with Ninja generators.") | ||
@@ -36,8 +52,22 @@ if(LLVM_PARALLEL_COMPILE_JOBS) | ||
endif() | ||
endif() | ||
|
||
+if (NOT LLVM_RAM_PER_LINK_JOB) | ||
+ set(LLVM_RAM_PER_LINK_JOB "14000") | ||
+endif() | ||
set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING | ||
"Define the maximum number of concurrent link jobs (Ninja only).") | ||
+if(LLVM_RAM_PER_LINK_JOB) | ||
+ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_LINK_JOB}" OUTPUT_FORMAT DECIMAL) | ||
+ if (memory_available_jobs LESS 1) | ||
+ set(memory_available_jobs 1) | ||
+ endif() | ||
+ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) | ||
+ set(LLVM_PARALLEL_LINK_JOBS "${memory_available_jobs}") | ||
+ else() | ||
+ set(LLVM_PARALLEL_LINK_JOBS "${NUMBER_OF_LOGICAL_CORES}") | ||
+ endif() | ||
+endif() | ||
if(CMAKE_GENERATOR STREQUAL "Ninja") | ||
if(NOT LLVM_PARALLEL_LINK_JOBS AND uppercase_LLVM_ENABLE_LTO STREQUAL "THIN") | ||
message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt | ||
index cdee11412eb..f32a7b7909d 100644 | ||
--- a/lib/Support/CMakeLists.txt | ||
+++ b/lib/Support/CMakeLists.txt | ||
@@ -236,14 +236,7 @@ set(llvm_system_libs ${system_libs}) | ||
# This block is only needed for llvm-config. When we deprecate llvm-config and | ||
# move to using CMake export, this block can be removed. | ||
if(LLVM_ENABLE_ZLIB) | ||
- # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. | ||
- if(CMAKE_BUILD_TYPE) | ||
- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) | ||
- get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type}) | ||
- endif() | ||
- if(NOT zlib_library) | ||
- get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION) | ||
- endif() | ||
+ set(zlib_library ${ZLIB_LIBRARIES}) | ||
get_library_name(${zlib_library} zlib_library) | ||
set(llvm_system_libs ${llvm_system_libs} "${zlib_library}") | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake | ||
index 5d4d692a70a..94717899a02 100644 | ||
--- a/cmake/modules/HandleLLVMOptions.cmake | ||
+++ b/cmake/modules/HandleLLVMOptions.cmake | ||
@@ -25,8 +25,24 @@ string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO) | ||
|
||
# Ninja Job Pool support | ||
# The following only works with the Ninja generator in CMake >= 3.0. | ||
+if (NOT LLVM_RAM_PER_COMPILE_JOB) | ||
+ set(LLVM_RAM_PER_COMPILE_JOB "2000") | ||
+endif() | ||
set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING | ||
"Define the maximum number of concurrent compilation jobs (Ninja only).") | ||
+cmake_host_system_information(RESULT AVAILABLE_PHYSICAL_MEMORY QUERY AVAILABLE_PHYSICAL_MEMORY) | ||
+cmake_host_system_information(RESULT NUMBER_OF_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES) | ||
+if(LLVM_RAM_PER_COMPILE_JOB) | ||
+ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_COMPILE_JOB}" OUTPUT_FORMAT DECIMAL) | ||
+ if (memory_available_jobs LESS 1) | ||
+ set(memory_available_jobs 1) | ||
+ endif() | ||
+ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) | ||
+ set(LLVM_PARALLEL_COMPILE_JOBS "${memory_available_jobs}") | ||
+ else() | ||
+ set(LLVM_PARALLEL_COMPILE_JOBS "${NUMBER_OF_LOGICAL_CORES}") | ||
+ endif() | ||
+endif() | ||
if(LLVM_PARALLEL_COMPILE_JOBS) | ||
if(NOT CMAKE_GENERATOR STREQUAL "Ninja") | ||
message(WARNING "Job pooling is only available with Ninja generators.") | ||
@@ -36,8 +52,22 @@ if(LLVM_PARALLEL_COMPILE_JOBS) | ||
endif() | ||
endif() | ||
|
||
+if (NOT LLVM_RAM_PER_LINK_JOB) | ||
+ set(LLVM_RAM_PER_LINK_JOB "14000") | ||
+endif() | ||
set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING | ||
"Define the maximum number of concurrent link jobs (Ninja only).") | ||
+if(LLVM_RAM_PER_LINK_JOB) | ||
+ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_LINK_JOB}" OUTPUT_FORMAT DECIMAL) | ||
+ if (memory_available_jobs LESS 1) | ||
+ set(memory_available_jobs 1) | ||
+ endif() | ||
+ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) | ||
+ set(LLVM_PARALLEL_LINK_JOBS "${memory_available_jobs}") | ||
+ else() | ||
+ set(LLVM_PARALLEL_LINK_JOBS "${NUMBER_OF_LOGICAL_CORES}") | ||
+ endif() | ||
+endif() | ||
if(CMAKE_GENERATOR STREQUAL "Ninja") | ||
if(NOT LLVM_PARALLEL_LINK_JOBS AND uppercase_LLVM_ENABLE_LTO STREQUAL "THIN") | ||
message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake | ||
index 0c3419390c2..8bcd91e1787 100644 | ||
--- a/cmake/modules/HandleLLVMOptions.cmake | ||
+++ b/cmake/modules/HandleLLVMOptions.cmake | ||
@@ -31,8 +31,24 @@ string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO) | ||
|
||
# Ninja Job Pool support | ||
# The following only works with the Ninja generator in CMake >= 3.0. | ||
+if (NOT LLVM_RAM_PER_COMPILE_JOB) | ||
+ set(LLVM_RAM_PER_COMPILE_JOB "2000") | ||
+endif() | ||
set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING | ||
"Define the maximum number of concurrent compilation jobs (Ninja only).") | ||
+cmake_host_system_information(RESULT AVAILABLE_PHYSICAL_MEMORY QUERY AVAILABLE_PHYSICAL_MEMORY) | ||
+cmake_host_system_information(RESULT NUMBER_OF_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES) | ||
+if(LLVM_RAM_PER_COMPILE_JOB) | ||
+ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_COMPILE_JOB}" OUTPUT_FORMAT DECIMAL) | ||
+ if (memory_available_jobs LESS 1) | ||
+ set(memory_available_jobs 1) | ||
+ endif() | ||
+ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) | ||
+ set(LLVM_PARALLEL_COMPILE_JOBS "${memory_available_jobs}") | ||
+ else() | ||
+ set(LLVM_PARALLEL_COMPILE_JOBS "${NUMBER_OF_LOGICAL_CORES}") | ||
+ endif() | ||
+endif() | ||
if(LLVM_PARALLEL_COMPILE_JOBS) | ||
if(NOT CMAKE_GENERATOR STREQUAL "Ninja") | ||
message(WARNING "Job pooling is only available with Ninja generators.") | ||
@@ -42,8 +58,22 @@ if(LLVM_PARALLEL_COMPILE_JOBS) | ||
endif() | ||
endif() | ||
|
||
+if (NOT LLVM_RAM_PER_LINK_JOB) | ||
+ set(LLVM_RAM_PER_LINK_JOB "14000") | ||
+endif() | ||
set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING | ||
"Define the maximum number of concurrent link jobs (Ninja only).") | ||
+if(LLVM_RAM_PER_LINK_JOB) | ||
+ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_LINK_JOB}" OUTPUT_FORMAT DECIMAL) | ||
+ if (memory_available_jobs LESS 1) | ||
+ set(memory_available_jobs 1) | ||
+ endif() | ||
+ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) | ||
+ set(LLVM_PARALLEL_LINK_JOBS "${memory_available_jobs}") | ||
+ else() | ||
+ set(LLVM_PARALLEL_LINK_JOBS "${NUMBER_OF_LOGICAL_CORES}") | ||
+ endif() | ||
+endif() | ||
if(CMAKE_GENERATOR STREQUAL "Ninja") | ||
if(NOT LLVM_PARALLEL_LINK_JOBS AND uppercase_LLVM_ENABLE_LTO STREQUAL "THIN") | ||
message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.") |