-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rui Chen <[email protected]>
- Loading branch information
1 parent
64f11fe
commit 86b624c
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |