Skip to content

Commit

Permalink
Retain backwards compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Francois Panisset <[email protected]>
  • Loading branch information
jfpanisset committed Feb 28, 2024
1 parent 6005f60 commit e81e9c5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ set(OpenGL_GL_PREFERENCE GLVND)
find_package(Threads REQUIRED)
find_package(GLUT REQUIRED)
find_package(OpenGL REQUIRED)
find_package(Python COMPONENTS Interpreter Development)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
find_package(Python COMPONENTS Interpreter Development)
else()
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
endif()
find_package(ZLIB)
if (ZLIB_FOUND)
add_definitions(-DPARTIO_USE_ZLIB)
Expand Down
6 changes: 5 additions & 1 deletion src/py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ target_include_directories(
)
target_link_libraries(partio_mod PRIVATE ${PYTHON_LIBRARIES} partio)

set(PYTHON_DEST "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages" )
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
set(PYTHON_DEST "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages" )
else()
set(PYTHON_DEST "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages" )
endif()

install(TARGETS partio_mod DESTINATION ${PYTHON_DEST})
install(FILES partio.i DESTINATION ${CMAKE_INSTALL_DATADIR}/swig)
Expand Down
6 changes: 5 additions & 1 deletion src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ else()
endforeach(item)

foreach(item testpartjson testpartio)
add_test(NAME ${item} COMMAND ${Python_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/${item}.py)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
add_test(NAME ${item} COMMAND ${Python_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/${item}.py)
else()
add_test(NAME ${item} COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/${item}.py)
endif()
install(PROGRAMS ${item}.py DESTINATION ${CMAKE_INSTALL_PARTIO_TESTDIR} RENAME ${item})
endforeach(item)
endif()
6 changes: 5 additions & 1 deletion src/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,9 @@ install(PROGRAMS partedit.py DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME partedit
install(PROGRAMS partjson.py DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME partjson)
install(PROGRAMS partinspect.py DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME partinspect)

set(PYTHON_DEST "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages" )
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")
set(PYTHON_DEST "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages" )
else()
set(PYTHON_DEST "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages" )
endif()
install(FILES partedit.py partjson.py partinspect.py DESTINATION ${PYTHON_DEST})

0 comments on commit e81e9c5

Please sign in to comment.