Skip to content

Commit

Permalink
[common-artifacts] Support ubuntu 24.04 (#14203)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
hseok-oh authored Oct 14, 2024
1 parent 0665747 commit 7fd5a43
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions compiler/common-artifacts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7fd5a43

Please sign in to comment.