Hi, The cmake command to find python executables and libraries has changed in cmake 3.12. As a results hugin doesn't build for example in the current debian/testing.
Attached is a patch to fix this problem. It's tested against linux/cmake 3.13.4. I have not changed the WIN32 branches because I have no way of verifying the correctness. cheers, lukas -- A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ --- You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/c7db332c-2aea-978e-8879-16052dd60a36%40lukas-wirz.de.
diff -r 1f18b1892c5e CMakeLists.txt
--- a/CMakeLists.txt Sun Sep 15 08:25:08 2019 +0200
+++ b/CMakeLists.txt Thu Oct 10 23:05:39 2019 +0300
@@ -454,10 +454,18 @@
FIND_PACKAGE(PythonLibs 3.0 REQUIRED)
else()
# Linux/MacOS
- find_package(PythonInterp 3.0 REQUIRED)
- find_package(PythonLibs ${PYTHON_VERSION_STRING} REQUIRED)
+ if(CMAKE_VERSION VERSION_LESS "3.12.0")
+ find_package(PythonInterp 3.0 REQUIRED)
+ find_package(PythonLibs ${PYTHON_VERSION_STRING} REQUIRED)
+ else()
+ find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
+ endif()
endif()
- INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
+ if(CMAKE_VERSION VERSION_LESS "3.12.0")
+ INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
+ else()
+ INCLUDE_DIRECTORIES(${Python3_INCLUDE_DIRS})
+ endif()
ADD_DEFINITIONS(-DHUGIN_HSI)
FIND_PACKAGE(SWIG 2.0.4 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
diff -r 1f18b1892c5e src/hugin_script_interface/CMakeLists.txt
--- a/src/hugin_script_interface/CMakeLists.txt Sun Sep 15 08:25:08 2019 +0200
+++ b/src/hugin_script_interface/CMakeLists.txt Thu Oct 10 23:05:39 2019 +0300
@@ -4,7 +4,11 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
-MESSAGE(STATUS "Python libs version: ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}")
+if(CMAKE_VERSION VERSION_LESS "3.12.0")
+ MESSAGE(STATUS "Python libs version: ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}")
+else()
+ MESSAGE(STATUS "Python libs version: ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.${Python3_VERSION_PATCH}")
+endif()
# access to the swig runtime code in the hpi module is via
# inclusion of a generated header file, swigpyrun.h:
@@ -48,7 +52,11 @@
ELSE (${HUGIN_SHARED_LIBS})
add_library(hugin_python_interface STATIC ${HUGIN_HPI_SOURCES})
ENDIF (${HUGIN_SHARED_LIBS})
-TARGET_LINK_LIBRARIES(hugin_python_interface huginbase ${PYTHON_LIBRARIES})
+if(CMAKE_VERSION VERSION_LESS "3.12.0")
+ TARGET_LINK_LIBRARIES(hugin_python_interface huginbase ${PYTHON_LIBRARIES})
+else()
+ TARGET_LINK_LIBRARIES(hugin_python_interface huginbase ${Python3_LIBRARIES})
+endif()
# the next section deals with setting up hsi, the hugin scripting
# interface. This part generates the hsi Python module.
@@ -189,7 +197,13 @@
SET_SOURCE_FILES_PROPERTIES(hsi.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_LIBRARY(hsi LANGUAGE python SOURCES hsi.i)
SET_PROPERTY(SOURCE hsi.i PROPERTY COMPILE_OPTIONS -py3)
-SWIG_LINK_LIBRARIES(hsi ${PYTHON_LIBRARIES} ${common_libs})
+if(CMAKE_VERSION VERSION_LESS "3.12.0")
+ SWIG_LINK_LIBRARIES(hsi ${PYTHON_LIBRARIES} ${common_libs})
+else()
+ SWIG_LINK_LIBRARIES(hsi ${Python3_LIBRARIES} ${common_libs})
+endif()
+
+
# The remainder defines where the files are installed.
# TODO this section is incomplete - non-windows install is missing
@@ -202,9 +216,16 @@
# Linux/MacOS
# install Python related files into folder depending on used Python version
- EXECUTE_PROCESS( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))"
- OUTPUT_VARIABLE pyinstalldir
- OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(CMAKE_VERSION VERSION_LESS "3.12.0")
+ EXECUTE_PROCESS( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))"
+ OUTPUT_VARIABLE pyinstalldir
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ EXECUTE_PROCESS( COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))"
+ OUTPUT_VARIABLE pyinstalldir
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+
# replaced by the above EXECUTE_PROCESS command.
#SET(pynstalldir
signature.asc
Description: OpenPGP digital signature
