Skip to content

Commit

Permalink
[cmake] Proper python3 detection
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Borsuk <me@alex.bio>
  • Loading branch information
biodranik committed Dec 6, 2021
1 parent 478f6eb commit e5a1a3a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ add_compile_options(
"-Wall"
)

find_package(PythonInterp ${PYTHON_VERSION})
if (PYTHONINTERP_FOUND)
message("Found python to use in qt/, shaders/ and 3party/: ${PYTHON_EXECUTABLE}")
find_package(Python3 COMPONENTS Interpreter)
if (Python3_Interpreter_FOUND)
message("Found python to use in qt/, shaders/ and 3party/: ${Python3_EXECUTABLE}")
else()
message(FATAL_ERROR "Could not find python to use in qt/, shaders/ and 3party/.")
message(FATAL_ERROR "Could not find python3 to use in qt/, shaders/ and 3party/.")
endif()

add_subdirectory(base)
Expand Down
4 changes: 2 additions & 2 deletions cmake/BundledBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ function(setup_bundled_boost)
endfunction()

function(setup_bundled_boost_with_python)
if (PYTHON_VERSION)
string(REPLACE "." "" BOOST_PYTHON_LIBNAME ${PYTHON_VERSION})
if (Python3_VERSION)
string(REPLACE "." "" BOOST_PYTHON_LIBNAME ${Python3_VERSION})
# Quote from https://cmake.org/cmake/help/v3.16/module/FindBoost.html:
# "Note that Boost Python components require a Python version
# suffix (Boost 1.67 and later), e.g. python36 or python27 for the
Expand Down
2 changes: 1 addition & 1 deletion qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ if (BUILD_DESIGNER)
elseif (BUILD_STANDALONE)
add_custom_command(TARGET desktop POST_BUILD
COMMAND "${QT_PATH}/bin/macdeployqt" ${BUNDLE_FOLDER}
COMMAND ${PYTHON_EXECUTABLE} "${OMIM_ROOT}/tools/macdeployqtfix/macdeployqtfix.py" -q -nl ${BUNDLE_FOLDER}/Contents/MacOS/${BUNDLE_NAME} ${QT_PATH}
COMMAND ${Python3_EXECUTABLE} "${OMIM_ROOT}/tools/macdeployqtfix/macdeployqtfix.py" -q -nl ${BUNDLE_FOLDER}/Contents/MacOS/${BUNDLE_NAME} ${QT_PATH}
COMMAND echo "Fixing Qt dependencies finished."
VERBATIM
COMMENT "Fixing Qt dependencies for standalone desktop app"
Expand Down
2 changes: 1 addition & 1 deletion shaders/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ add_custom_command(
GL/shader_index.txt
programs.hpp
COMMAND
${PYTHON_EXECUTABLE}
${Python3_EXECUTABLE}
ARGS
gl_shaders_preprocessor.py
GL/
Expand Down
2 changes: 2 additions & 0 deletions shaders/gl_shaders_preprocessor.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import os
import re
import sys
Expand Down

0 comments on commit e5a1a3a

Please sign in to comment.