Skip to content

Commit ad26ec6

Browse files
cyyeverpytorchmergebot
authored andcommitted
Use 3.27 as the minimum CMake version (pytorch#153153)
Update the minimum CMake version to 3.27 because of it provides more CUDA targets such as `CUDA::nvperf_host` so that it is possible to remove some of our forked CUDA modules. See pytorch#153783. It's also possible to facilitate future third-party updates such as FBGEMM (its current shipped version requires 3.21). Pull Request resolved: pytorch#153153 Approved by: https://github.com/malfet
1 parent 3e71016 commit ad26ec6

File tree

14 files changed

+65
-27
lines changed

14 files changed

+65
-27
lines changed

.ci/manywheel/build_common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
3131
# Comment out nvidia repositories to prevent them from getting apt-get updated, see https://github.com/pytorch/pytorch/issues/74968
3232
# shellcheck disable=SC2046
3333
sed -i 's/.*nvidia.*/# &/' $(find /etc/apt/ -type f -name "*.list")
34-
3534
retry apt-get update
3635
retry apt-get -y install zip openssl
3736
else
@@ -98,6 +97,7 @@ if [[ -z "$PYTORCH_ROOT" ]]; then
9897
exit 1
9998
fi
10099
pushd "$PYTORCH_ROOT"
100+
retry pip install -q cmake
101101
python setup.py clean
102102
retry pip install -qr requirements.txt
103103
case ${DESIRED_PYTHON} in

.ci/manywheel/build_libtorch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ if [[ -z "$PYTORCH_ROOT" ]]; then
9292
exit 1
9393
fi
9494
pushd "$PYTORCH_ROOT"
95+
retry pip install -q cmake
9596
python setup.py clean
9697
retry pip install -qr requirements.txt
9798
retry pip install -q numpy==2.0.1

.ci/pytorch/windows/arm64/build_libtorch.bat

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
:: environment variables
44
set CMAKE_BUILD_TYPE=%BUILD_TYPE%
5-
set CMAKE_C_COMPILER_LAUNCHER=sccache
6-
set CMAKE_CXX_COMPILER_LAUNCHER=sccache
5+
:: set CMAKE_C_COMPILER_LAUNCHER=sccache
6+
:: set CMAKE_CXX_COMPILER_LAUNCHER=sccache
77
set libuv_ROOT=%DEPENDENCIES_DIR%\libuv\install
88
set MSSdk=1
99
if defined PYTORCH_BUILD_VERSION (
@@ -43,9 +43,10 @@ pip install -r requirements.txt
4343
set DISTUTILS_USE_SDK=1
4444

4545
:: start sccache server and reset sccache stats
46-
sccache --start-server
47-
sccache --zero-stats
48-
sccache --show-stats
46+
:: disable sccache because of debug file bug
47+
:: sccache --start-server
48+
:: sccache --zero-stats
49+
:: sccache --show-stats
4950

5051
:: Prepare the environment
5152
mkdir libtorch
@@ -98,4 +99,4 @@ rmdir /s /q libtorch
9899
if %errorlevel% neq 0 (
99100
echo "Failed on build_libtorch. (exitcode = %errorlevel%)"
100101
exit /b 1
101-
)
102+
)

.github/requirements/pip-requirements-macOS.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
boto3==1.35.42
2-
cmake==3.25.*
2+
cmake==3.27.*
33
expecttest==0.3.0
44
fbscribelogger==0.1.7
55
filelock==3.6.0

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
22
# cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0023 NEW)
33

44
# Use compiler ID "AppleClang" instead of "Clang" for XCode. Not setting this
55
# sometimes makes XCode C compiler gets detected as "Clang", even when the C++
66
# one is detected as "AppleClang".
77
cmake_policy(SET CMP0010 NEW)
88
cmake_policy(SET CMP0025 NEW)
9+
cmake_policy(SET CMP0126 OLD)
910

1011
# Enables CMake to set LTO on compilers other than Intel.
1112
cmake_policy(SET CMP0069 NEW)

aten/src/ATen/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
22
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
33

44
if(NOT MSVC)

aten/src/ATen/native/quantized/cpu/qnnpack/deps/clog/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
7+
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
88

99
include(GNUInstallDirs)
1010

c10/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
22
project(c10 CXX)
33

44
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested to build this target.")

cmake/ProtoBuf.cmake

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,54 @@ macro(custom_protobuf_find)
3434
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
3535

3636
if(MSVC)
37+
foreach(
38+
flag_var
39+
CMAKE_C_FLAGS
40+
CMAKE_C_FLAGS_DEBUG
41+
CMAKE_C_FLAGS_RELEASE
42+
CMAKE_C_FLAGS_MINSIZEREL
43+
CMAKE_C_FLAGS_RELWITHDEBINFO
44+
CMAKE_CXX_FLAGS
45+
CMAKE_CXX_FLAGS_DEBUG
46+
CMAKE_CXX_FLAGS_RELEASE
47+
CMAKE_CXX_FLAGS_MINSIZEREL
48+
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
49+
# Replace /Zi and /ZI with /Z7
50+
if(MSVC_Z7_OVERRIDE)
51+
if(${flag_var} MATCHES "/Z[iI]")
52+
string(REGEX REPLACE "/Z[iI]" "/Z7" ${flag_var} "${${flag_var}}")
53+
endif()
54+
if(${flag_var} MATCHES "[-]Zi")
55+
string(REGEX REPLACE "[-Zi]" "/Z7" ${flag_var} "${${flag_var}}")
56+
endif()
57+
endif(MSVC_Z7_OVERRIDE)
58+
endforeach(flag_var)
59+
3760
foreach(flag_var
3861
CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL
3962
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL)
4063
if(${flag_var} MATCHES "/Z[iI7]")
4164
string(REGEX REPLACE "/Z[iI7]" "" ${flag_var} "${${flag_var}}")
4265
endif()
4366
endforeach(flag_var)
44-
if(MSVC_Z7_OVERRIDE)
45-
foreach(flag_var
46-
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELWITHDEBINFO
47-
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELWITHDEBINFO)
48-
if(${flag_var} MATCHES "/Z[iI]")
49-
string(REGEX REPLACE "/Z[iI]" "/Z7" ${flag_var} "${${flag_var}}")
50-
endif()
51-
endforeach(flag_var)
52-
endif(MSVC_Z7_OVERRIDE)
67+
68+
foreach(
69+
flag_var
70+
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
71+
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
72+
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
73+
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
74+
CMAKE_SHARED_LINKER_FLAGS_DEBUG
75+
CMAKE_STATIC_LINKER_FLAGS_DEBUG
76+
CMAKE_EXE_LINKER_FLAGS_DEBUG
77+
CMAKE_MODULE_LINKER_FLAGS_DEBUG)
78+
# Switch off incremental linking in debug/relwithdebinfo builds
79+
if(${flag_var} MATCHES "/INCREMENTAL" AND NOT ${flag_var} MATCHES
80+
"/INCREMENTAL:NO")
81+
string(REGEX REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" ${flag_var}
82+
"${${flag_var}}")
83+
endif()
84+
endforeach(flag_var)
5385
endif(MSVC)
5486

5587
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0.0")

test/edge/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.15)
1+
cmake_minimum_required(VERSION 3.18)
22

33
set(TORCH_ROOT ${CMAKE_CURRENT_LIST_DIR}/../..)
44
set(TEST_ROOT ${TORCH_ROOT}/test/edge)

0 commit comments

Comments
 (0)