-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
26 additions
and
49 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
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 |
---|---|---|
@@ -1,50 +1,30 @@ | ||
option (BUILD_PYTHON_WRAPPER "Build Python Wrapper" ON) | ||
find_package(Python COMPONENTS Interpreter REQUIRED) | ||
|
||
if (BUILD_PYTHON_WRAPPER) | ||
find_package(PythonInterp REQUIRED) | ||
|
||
#set(PYTHON_DEST_DIR "" CACHE PATH "Directory of the Python wrappers") | ||
if (PYTHON_DEST_DIR) | ||
file(TO_CMAKE_PATH "${PYTHON_DEST_DIR}" TMP) | ||
set(PYTHON_DEST "${TMP}") | ||
unset(TMP) | ||
endif() | ||
|
||
message("CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}") | ||
if(NOT DEFINED) | ||
set(CMAKE_BUILD_TYPE "RelWithDebInfo") | ||
endif() | ||
if(PYTHON_DEST_DIR) | ||
file(TO_CMAKE_PATH "${PYTHON_DEST_DIR}" PYTHON_DEST) | ||
endif() | ||
|
||
find_package(PythonLibs) | ||
if (PYTHONINTERP_FOUND) | ||
message(STATUS "Found PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}") | ||
message(STATUS "Python version ${PYTHON_VERSION_STRING}") | ||
endif() | ||
if (PYTHONLIBS_FOUND) | ||
message(STATUS "Found PYTHON_INCLUDE_DIRS=${PYTHON_INCLUDE_DIRS}") | ||
message(STATUS "Found PYTHON_LIBRARIES=${PYTHON_LIBRARIES}") | ||
endif() | ||
message("CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}") | ||
if(NOT DEFINED) | ||
set(CMAKE_BUILD_TYPE "RelWithDebInfo") | ||
endif() | ||
|
||
if (PYTHONINTERP_FOUND) | ||
message("Python found " ${PYTHON_EXECUTABLE}) | ||
# TODO: add to add_custom_command DEPENDS the list of python files of the project. | ||
# file(GLOB_RECURSE DEPS ${CMAKE_CURRENT_SOURCE_DIR}/cil/*.py ) | ||
message("SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CIL: $ENV{SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CIL}") | ||
message("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") | ||
if(PYTHON_DEST_DIR) | ||
message(STATUS "CIL install using ${PYTHON_EXECUTABLE} -m pip install -t ${PYTHON_DEST}") | ||
add_custom_target(pythonsetup ALL | ||
COMMAND ${PYTHON_EXECUTABLE} -m pip install ${CMAKE_SOURCE_DIR} -t ${PYTHON_DEST} --upgrade | ||
DEPENDS cilacc) | ||
else() | ||
message(STATUS "CIL install using ${PYTHON_EXECUTABLE} -m pip install") | ||
add_custom_target(pythonsetup ALL | ||
COMMAND ${PYTHON_EXECUTABLE} -m pip install ${CMAKE_SOURCE_DIR} --upgrade | ||
DEPENDS cilacc) | ||
endif() | ||
# install the data if not a conda build. With conda the data is in the dependency package cil-data | ||
if (NOT CONDA_BUILD) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cil) | ||
endif() | ||
endif() | ||
# TODO: add to add_custom_command DEPENDS the list of python files of the project. | ||
# file(GLOB_RECURSE DEPS ${CMAKE_CURRENT_SOURCE_DIR}/cil/*.py ) | ||
message("SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CIL: $ENV{SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CIL}") | ||
message("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") | ||
if(PYTHON_DEST_DIR) | ||
message(STATUS "CIL install using ${Python_EXECUTABLE} -m pip install -t ${PYTHON_DEST}") | ||
add_custom_target(pythonsetup ALL | ||
COMMAND ${Python_EXECUTABLE} -m pip install ${CMAKE_SOURCE_DIR} -t ${PYTHON_DEST} --upgrade | ||
DEPENDS cilacc) | ||
else() | ||
message(STATUS "CIL install using ${Python_EXECUTABLE} -m pip install") | ||
add_custom_target(pythonsetup ALL | ||
COMMAND ${Python_EXECUTABLE} -m pip install ${CMAKE_SOURCE_DIR} --upgrade | ||
DEPENDS cilacc) | ||
endif() | ||
# install the data if not a conda build. With conda the data is in the dependency package cil-data | ||
if (NOT CONDA_BUILD) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cil) | ||
endif() |