swig test needs to check version
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Hugin |
Fix Released
|
Critical
|
Unassigned |
Bug Description
According to 2011.2.0_beta1 README hsi has specific version requirements on swig:
SWIG >=2.0 - If Python >=3.2, SWIG must be >=2.0.4
However the CMake setup does not do any version checks.
FindPythonLibs seems to be one of the (imho very broken) cmake modules that does return any versioning info, making it impossible to completely express the abovementioned dependency without trickery. However FindSWIG can do version checks, making part1 (swig >= 2.0) easy as pie:
--- CMakeLists.txt.orig 2011-06-25 09:03:31.000000000 +0200
+++ CMakeLists.txt 2011-06-25 09:03:54.000000000 +0200
@@ -295,7 +295,7 @@
OPTION(BUILD_HSI "Python Scripting Interface" OFF)
IF(BUILD_HSI)
find_
- FIND_PACKAGE(SWIG REQUIRED)
+ FIND_PACKAGE(SWIG 2.0 REQUIRED)
INCLUDE(
FIND_
Changed in hugin: | |
status: | Fix Committed → Fix Released |
can you try with something along the following please? sorry I do not have time right now to do it myself.
OPTION(BUILD_HSI "Python Scripting Interface" OFF)
IF(BUILD_HSI)
# find Python first because the version of SWIG required depends on the version of Python available
FIND_ PACKAGE( PythonLibs REQUIRED) DIRECTORIES( ${PYTHON_ INCLUDE_ PATH}) NS(-DHUGIN_ HSI)
INCLUDE_
ADD_DEFINITIO
# get version of Python libs
FILE(STRINGS "${PYTHON_ INCLUDE_ DIRS}/patchleve l.h" MAJOR_VERSION. *$")
PY_DEF_MAJOR
REGEX "#define[ \t]+PY_
FILE(STRINGS "${PYTHON_ INCLUDE_ DIRS}/patchleve l.h" MINOR_VERSION. *$")
PY_DEF_MINOR
REGEX "#define[ \t]+PY_
FILE(STRINGS "${PYTHON_ INCLUDE_ DIRS}/patchleve l.h" MICRO_VERSION. *$")
PY_DEF_MICRO
REGEX "#define[ \t]+PY_
STRING(REGEX
PYTHON_ VERSION_ MAJOR
"${PY_ DEF_MAJOR} ")
REPLACE "^.*VERSION[ \t]+([0-9]+).*" "\\1"
STRING(REGEX
PYTHON_ VERSION_ MINOR
"${PY_ DEF_MINOR} ")
REPLACE "^.*VERSION[ \t]+([0-9]+).*" "\\1"
STRING(REGEX
PYTHON_ VERSION_ PATCH
"${PY_ DEF_MICRO} ")
REPLACE "^.*VERSION[ \t]+([0-9]+).*" "\\1"
# now we can find the right SWIG version PROGRAM( SWIG_EXECUTABLE NAMES swig2.0 swig) PYTHON_ VERSION_ MAJOR}= =3)&&($ {PYTHON_ VERSION_ MINOR}> =2)) PACKAGE( SWIG 2.0.4 REQUIRED) PACKAGE( SWIG 2.0 REQUIRED) ${SWIG_ USE_FILE} )
FIND_
# unclean to test for Python 3, but the assumption is that by the time we have Python 4 this issue is long gone
IF(${
FIND_
ELSE()
FIND_
ENDIF()
INCLUDE(
ENDIF()