Skip to content

Commit

Permalink
lensfun: add cmake build patch
Browse files Browse the repository at this point in the history
Signed-off-by: Rui Chen <[email protected]>
  • Loading branch information
chenrui333 committed Aug 28, 2023
1 parent 64f11fe commit 86b624c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lensfun/0.3.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index 2f6f8f1..8e4cf24 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -22,25 +22,23 @@ ENDIF(INSTALL_HELPER_SCRIPTS)
# Inspired by http://bloerg.net/2012/11/10/cmake-and-distutils.html

FIND_PROGRAM(PYTHON "python3")
-IF(PYTHON)
+FIND_PROGRAM(PIP "pip3")
+IF(PYTHON AND PIP)
SET(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
SET(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
SET(DEPS_IN "${CMAKE_CURRENT_SOURCE_DIR}/lensfun/__init__.py.in")
SET(DEPS "${CMAKE_CURRENT_BINARY_DIR}/lensfun/__init__.py")
- SET(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")

CONFIGURE_FILE(${SETUP_PY_IN} ${SETUP_PY})
CONFIGURE_FILE(${DEPS_IN} ${DEPS})

- ADD_CUSTOM_COMMAND(OUTPUT ${OUTPUT}
- COMMAND ${PYTHON} ${SETUP_PY} build
- COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
- DEPENDS ${DEPS_IN})
-
- ADD_CUSTOM_TARGET(python-package ALL DEPENDS ${OUTPUT})
+ ADD_CUSTOM_TARGET(python-package ALL
+ COMMAND ${PIP} install .
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Installing python package using pip")

IF(NOT DEFINED SETUP_PY_INSTALL_PREFIX)
SET(SETUP_PY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
ENDIF()
- INSTALL(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install --prefix=\$ENV{DESTDIR}${SETUP_PY_INSTALL_PREFIX})")
-ENDIF(PYTHON)
+ INSTALL(CODE "execute_process(COMMAND ${PIP} install . --prefix=\$ENV{DESTDIR}${SETUP_PY_INSTALL_PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
+ENDIF(PYTHON AND PIP)

0 comments on commit 86b624c

Please sign in to comment.