summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'Wrappers')
-rw-r--r--Wrappers/Python/CMakeLists.txt58
-rw-r--r--Wrappers/Python/conda-recipe/bld.bat15
-rw-r--r--Wrappers/Python/conda-recipe/meta.yaml4
-rw-r--r--Wrappers/Python/setup-regularisers.py.in4
4 files changed, 71 insertions, 10 deletions
diff --git a/Wrappers/Python/CMakeLists.txt b/Wrappers/Python/CMakeLists.txt
index fa1a30b..464c916 100644
--- a/Wrappers/Python/CMakeLists.txt
+++ b/Wrappers/Python/CMakeLists.txt
@@ -68,4 +68,60 @@ else()
set(SETUP_GPU_WRAPPERS "#CUDA NOT FOUND")
endif()
-configure_file("setup-regularisers.py.in" "setup-regularisers.py")
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/setup-regularisers.py.in" "${CMAKE_CURRENT_BINARY_DIR}/setup-regularisers.py")
+
+
+find_package(PythonInterp)
+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()
+
+if (PYTHONINTERP_FOUND)
+ message("Python found " ${PYTHON_EXECUTABLE})
+ set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup-regularisers.py.in")
+ set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup-regularisers.py")
+ #set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/module/__init__.py")
+ set (DEPS "${CMAKE_BINARY_DIR}/Core/")
+ set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
+
+ configure_file(${SETUP_PY_IN} ${SETUP_PY})
+
+ message("Core binary dir " ${CMAKE_BINARY_DIR}/Core/${CMAKE_BUILD_TYPE})
+
+ if (CONDA_BUILD)
+ add_custom_command(OUTPUT ${OUTPUT}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/ccpi ${CMAKE_CURRENT_BINARY_DIR}/ccpi
+ COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=${CIL_VERSION}
+ PREFIX=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_INC=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_LIB=${CMAKE_BINARY_DIR}/Core
+ ${PYTHON_EXECUTABLE} ${SETUP_PY} install
+ COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
+ DEPENDS cilreg)
+
+ else()
+ add_custom_command(OUTPUT ${OUTPUT}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/ccpi ${CMAKE_CURRENT_BINARY_DIR}/ccpi
+ COMMAND ${CMAKE_COMMAND} -E env CIL_VERSION=${CIL_VERSION}
+ PREFIX=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_INC=${CMAKE_SOURCE_DIR}/Core
+ LIBRARY_LIB=${CMAKE_BINARY_DIR}/Core/${CMAKE_BUILD_TYPE}
+ ${PYTHON_EXECUTABLE} ${SETUP_PY} build_ext --inplace
+ COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
+ DEPENDS cilreg)
+
+ endif()
+
+
+ add_custom_target(PythonWrapper ALL DEPENDS ${OUTPUT})
+
+ #install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")
+endif() \ No newline at end of file
diff --git a/Wrappers/Python/conda-recipe/bld.bat b/Wrappers/Python/conda-recipe/bld.bat
index e47f8d9..e58808b 100644
--- a/Wrappers/Python/conda-recipe/bld.bat
+++ b/Wrappers/Python/conda-recipe/bld.bat
@@ -6,12 +6,15 @@ exit 1
mkdir "%SRC_DIR%\ccpi"
ROBOCOPY /E "%RECIPE_DIR%\..\.." "%SRC_DIR%\ccpi"
ROBOCOPY /E "%RECIPE_DIR%\..\..\..\Core" "%SRC_DIR%\Core"
-cd %SRC_DIR%\ccpi\Python
+::cd %SRC_DIR%\ccpi\Python
+cd %SRC_DIR%
:: issue cmake to create setup.py
-cmake .
+cmake -G "NMake Makefiles" %RECIPE_DIR%\..\..\..\ -DBUILD_WRAPPERS=ON -DCONDA_BUILD=ON -DCMAKE_BUILD_TYPE="Release" -DLIBRARY_LIB="%CONDA_PREFIX%\lib" -DLIBRARY_INC="%CONDA_PREFIX%" -DCMAKE_INSTALL_PREFIX="%PREFIX%\Library"
-%PYTHON% setup-regularisers.py build_ext
-if errorlevel 1 exit 1
-%PYTHON% setup-regularisers.py install
-if errorlevel 1 exit 1
+::%PYTHON% setup-regularisers.py build_ext
+::if errorlevel 1 exit 1
+::%PYTHON% setup-regularisers.py install
+::if errorlevel 1 exit 1
+nmake install
+if errorlevel 1 exit 1 \ No newline at end of file
diff --git a/Wrappers/Python/conda-recipe/meta.yaml b/Wrappers/Python/conda-recipe/meta.yaml
index ca28bae..115fcf5 100644
--- a/Wrappers/Python/conda-recipe/meta.yaml
+++ b/Wrappers/Python/conda-recipe/meta.yaml
@@ -21,7 +21,7 @@ requirements:
- numpy x.x
- setuptools
- cython
- - cil_regulariser =={{ environ['CIL_VERSION'] }}
+ # - cil_regulariser =={{ environ['CIL_VERSION'] }}
- vc 14 # [win and py36]
- vc 14 # [win and py35]
- vc 9 # [win and py27]
@@ -30,7 +30,7 @@ requirements:
run:
- python
- numpy x.x
- - cil_regulariser =={{ environ['CIL_VERSION'] }}
+ # - cil_regulariser =={{ environ['CIL_VERSION'] }}
- vc 14 # [win and py36]
- vc 14 # [win and py35]
- vc 9 # [win and py27]
diff --git a/Wrappers/Python/setup-regularisers.py.in b/Wrappers/Python/setup-regularisers.py.in
index 7108683..542dcb4 100644
--- a/Wrappers/Python/setup-regularisers.py.in
+++ b/Wrappers/Python/setup-regularisers.py.in
@@ -27,11 +27,13 @@ except:
extra_include_dirs = [numpy.get_include(), library_include_path]
#extra_library_dirs = [os.path.join(library_include_path, "..", "lib")]
extra_compile_args = []
-extra_library_dirs = []
+extra_library_dirs = [library_lib_path]
extra_compile_args = []
extra_link_args = []
extra_libraries = ['cilreg']
+print ("extra_library_dirs " , extra_library_dirs)
+
extra_include_dirs += [os.path.join(".." , ".." , "Core"),
os.path.join(".." , ".." , "Core", "regularisers_CPU"),
os.path.join(".." , ".." , "Core", "inpainters_CPU"),