Skip to content

Commit

Permalink
openvdb/python/CMakeLists.txt: Minor fix and CMake v3.11 compatibility
Browse files Browse the repository at this point in the history
Adding the python version string to finding the python module of
Boost fixes this error: CMake Error at /.../FindBoost.cmake:2044

Remove unneeded python version variables as PythonInterp already
defines them.

PYOPENVDB_INSTALL_DIRECTORY variable cannot be set during configure
phase because it is hard set. Test if it is not defined before
setting it to a default.

Signed-off-by: Jonathan Scruggs <[email protected]>
  • Loading branch information
dracwyrm committed Aug 10, 2018
1 parent 7ad28fe commit 2715fc4
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions openvdb/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PROJECT ( PyOpenVDB )

FIND_PACKAGE ( PythonInterp REQUIRED )
FIND_PACKAGE ( PythonLibs REQUIRED )
FIND_PACKAGE ( Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS python )
FIND_PACKAGE ( Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} )


IF ( NOT OPENVDB_BUILD_CORE )
Expand Down Expand Up @@ -36,15 +36,10 @@ INCLUDE_DIRECTORIES ( SYSTEM ${BLOSC_INCLUDE_DIR} )
INCLUDE_DIRECTORIES ( SYSTEM ${TBB_INCLUDE_DIR} )
INCLUDE_DIRECTORIES ( SYSTEM ${ZLIB_INCLUDE_DIR} )
INCLUDE_DIRECTORIES ( SYSTEM ${PYTHON_INCLUDE_DIR} )
# MESSAGE ( "PYTHONLIBS_VERSION_STRING = ${PYTHONLIBS_VERSION_STRING}" )
# MESSAGE ( "PYTHON_VERSION_STRING = ${PYTHON_VERSION_STRING}" )

STRING(REPLACE "." ";" VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
LIST(GET VERSION_LIST 0 OPENVDB_PYTHON_VERSION_MAJOR)
LIST(GET VERSION_LIST 1 OPENVDB_PYTHON_VERSION_MINOR)
LIST(GET VERSION_LIST 2 OPENVDB_PYTHON_VERSION_PATCH)

# MESSAGE ( "OPENVDB_PYTHON_VERSION_MAJOR = ${OPENVDB_PYTHON_VERSION_MAJOR}" )
# MESSAGE ( "OPENVDB_PYTHON_VERSION_MINOR = ${OPENVDB_PYTHON_VERSION_MINOR}" )
# MESSAGE ( "PYTHON_VERSION_MAJOR = ${PYTHON_VERSION_MAJOR}" )
# MESSAGE ( "PYTHON_VERSION_MINOR = ${PYTHON_VERSION_MINOR}" )
SET ( OPENVDB_PYTHON_MODULE_SOURCE_FILES
pyFloatGrid.cc
pyIntGrid.cc
Expand All @@ -54,10 +49,12 @@ SET ( OPENVDB_PYTHON_MODULE_SOURCE_FILES
pyVec3Grid.cc
)

SET ( PYOPENVDB_INSTALL_DIRECTORY
lib/python${OPENVDB_PYTHON_VERSION_MAJOR}.${OPENVDB_PYTHON_VERSION_MINOR}
CACHE STRING "The directory to install the pyopenvdb.so module."
)
IF ( NOT DEFINED PYOPENVDB_INSTALL_DIRECTORY )
SET ( PYOPENVDB_INSTALL_DIRECTORY
lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
CACHE STRING "The directory to install the pyopenvdb.so module."
)
ENDIF ( NOT DEFINED PYOPENVDB_INSTALL_DIRECTORY )

SET_SOURCE_FILES_PROPERTIES ( ${OPENVDB_PYTHON_MODULE_SOURCE_FILES}
PROPERTIES
Expand Down

0 comments on commit 2715fc4

Please sign in to comment.