From 7fd5a431a535131a4193660803f07d22a6a68219 Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Mon, 14 Oct 2024 09:06:39 +0900 Subject: [PATCH] [common-artifacts] Support ubuntu 24.04 (#14203) This commit updates cmake to support ubuntu 24.04. It requires to install python 3.8 explicitly because the default python version is 3.12. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh --- compiler/common-artifacts/CMakeLists.txt | 43 +++++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/compiler/common-artifacts/CMakeLists.txt b/compiler/common-artifacts/CMakeLists.txt index b363a34ff53..501146b351d 100644 --- a/compiler/common-artifacts/CMakeLists.txt +++ b/compiler/common-artifacts/CMakeLists.txt @@ -3,18 +3,43 @@ # Ubuntu18.04; explictly installed python3.8 (default is python3.6) # Ubuntu20.04; default python3.8 # Ubuntu22.04; default python3.10 +# Ubuntu24.04; explictly installed python3.8 (default is python3.12) # refer https://github.com/Samsung/ONE/issues/9962 -find_package(PythonInterp 3.8 QUIET) -find_package(PythonLibs 3.8 QUIET) +if(CMAKE_VERSION VERSION_LESS 3.12) + find_package(PythonInterp 3.8 QUIET) + find_package(PythonLibs 3.8 QUIET) -if(NOT ${PYTHONINTERP_FOUND}) - message(STATUS "Build common-artifacts: FALSE (Python3 is missing)") - return() -endif() + if(NOT ${PYTHONINTERP_FOUND}) + message(STATUS "Build common-artifacts: FALSE (Python3 is missing)") + return() + endif() -if(${PYTHON_VERSION_MINOR} LESS 8) - message(STATUS "Build common-artifacts: FALSE (You need to install Python version higher than 3.8)") - return() + if(${PYTHON_VERSION_MINOR} LESS 8) + message(STATUS "Build common-artifacts: FALSE (You need to install Python version higher than 3.8)") + return() + endif() +else() + find_package(Python 3.8 EXACT COMPONENTS Interpreter QUIET) + if(NOT Python_FOUND) + find_package(Python 3.8 COMPONENTS Interpreter QUIET) + endif() + + # tensorflow 2.12.1 supports Python 3.8 ~ 3.11 + if(Python_VERSION VERSION_GREATER_EQUAL 3.12) + message(STATUS "Build common-artifacts: FALSE (Python version 3.12 or higher is not supported yet)") + return() + endif() + if(Python_VERSION VERSION_LESS 3.8) + message(STATUS "Build common-artifacts: FAILED (Install Python version 3.8 or 3.10)") + return() + endif() + + if(NOT Python_Interpreter_FOUND) + message(STATUS "Build common-artifacts: FAILED (Python3 is missing)") + return() + endif() + + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) endif() # Create python virtual environment with tensorflow 2.12.1