summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2018-01-20 22:41:24 +0000
committerEdoardo Pasca <edo.paskino@gmail.com>2018-01-23 22:45:21 +0000
commitba6c5455f4095dcd8a3a2262aa253fac9bb9ba09 (patch)
tree0995d71aa7fd79ea96405091c063c4c485c0574e
parent514a10a8adf935f9254b9c25da200b4317277171 (diff)
downloadregularization-ba6c5455f4095dcd8a3a2262aa253fac9bb9ba09.tar.gz
regularization-ba6c5455f4095dcd8a3a2262aa253fac9bb9ba09.tar.bz2
regularization-ba6c5455f4095dcd8a3a2262aa253fac9bb9ba09.tar.xz
regularization-ba6c5455f4095dcd8a3a2262aa253fac9bb9ba09.zip
work for conda recipes
-rw-r--r--Core/CMakeLists.txt10
-rw-r--r--Wrappers/Python/conda-recipe/bld.bat4
-rw-r--r--Wrappers/Python/conda-recipe/meta.yaml18
-rw-r--r--Wrappers/Python/setup.py79
4 files changed, 101 insertions, 10 deletions
diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt
index 67505dd..5f443b7 100644
--- a/Core/CMakeLists.txt
+++ b/Core/CMakeLists.txt
@@ -40,7 +40,7 @@ message("CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}")
set(CMAKE_BUILD_TYPE "Release")
if(WIN32)
- set (FLAGS "/DWIN32 /EHsc /DBOOST_ALL_NO_LIB /openmp /DCCPiReconstructionIterative_EXPORTS")
+ set (FLAGS "/DWIN32 /EHsc /DBOOST_ALL_NO_LIB /openmp /DCCPiCore_EXPORTS")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT.lib")
set (EXTRA_LIBRARIES
@@ -73,10 +73,13 @@ add_library(cilreg SHARED
${CMAKE_CURRENT_SOURCE_DIR}/regularizers_CPU/TGV_PD_core.c
${CMAKE_CURRENT_SOURCE_DIR}/regularizers_CPU/utils.c
)
-
+target_link_libraries(cilreg ${EXTRA_LIBRARIES} )
+include_directories(cilreg PUBLIC
+ ${LIBRARY_INC}/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularizers_CPU/ )
if (UNIX)
message ("I'd install into ${CMAKE_INSTALL_PREFIX}/lib")
-install(TARGETS cilreg
+install(TARGETS cilreg
LIBRARY DESTINATION lib
CONFIGURATIONS ${CMAKE_BUILD_TYPE}
)
@@ -89,6 +92,7 @@ message ("I'd install into ${CMAKE_INSTALL_PREFIX} lib bin")
)
endif()
+
#add_executable(regularizer_test ${CMAKE_CURRENT_SOURCE_DIR}/test/test_regularizer.cpp)
#target_link_libraries (regularizer_test LINK_PUBLIC regularizers_lib) \ No newline at end of file
diff --git a/Wrappers/Python/conda-recipe/bld.bat b/Wrappers/Python/conda-recipe/bld.bat
index 69491de..fe3ddae 100644
--- a/Wrappers/Python/conda-recipe/bld.bat
+++ b/Wrappers/Python/conda-recipe/bld.bat
@@ -4,8 +4,8 @@ exit 1
)
mkdir "%SRC_DIR%\ccpi"
-xcopy /e "%RECIPE_DIR%\..\.." "%SRC_DIR%\ccpi"
-
+ROBOCOPY /E "%RECIPE_DIR%\..\.." "%SRC_DIR%\ccpi"
+ROBOCOPY /E "%RECIPE_DIR%\..\..\..\Core" "%SRC_DIR%\Core"
cd %SRC_DIR%\ccpi\Python
%PYTHON% setup.py build_ext
diff --git a/Wrappers/Python/conda-recipe/meta.yaml b/Wrappers/Python/conda-recipe/meta.yaml
index 7068e9d..c451b37 100644
--- a/Wrappers/Python/conda-recipe/meta.yaml
+++ b/Wrappers/Python/conda-recipe/meta.yaml
@@ -1,5 +1,5 @@
package:
- name: ccpi-regularizers
+ name: ccpi-regularizer
version: {{ environ['CIL_VERSION'] }}
@@ -11,17 +11,25 @@ build:
requirements:
build:
- - python
+ - python ==2.7 # [py27]
+ - python ==3.5 # [py35]
- numpy
- setuptools
- - boost ==1.64
- - boost-cpp ==1.64
+ - boost ==1.64.0
+ - boost-cpp ==1.64.0
- cython
+ - cil_regularizer
+ - vc 14 # [win and py35]
+ - vc 9 # [win and py27]
run:
- - python
+ - python ==2.7 # [py27]
+ - python ==3.5 # [py35]
- numpy
- boost ==1.64
+ - cil_regularizer
+ - vc 14 # [win and py35]
+ - vc 9 # [win and py27]
about:
diff --git a/Wrappers/Python/setup.py b/Wrappers/Python/setup.py
new file mode 100644
index 0000000..ef20a27
--- /dev/null
+++ b/Wrappers/Python/setup.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+import setuptools
+from distutils.core import setup
+from distutils.extension import Extension
+from Cython.Distutils import build_ext
+
+import os
+import sys
+import numpy
+import platform
+
+cil_version=os.environ['CIL_VERSION']
+if cil_version == '':
+ print("Please set the environmental variable CIL_VERSION")
+ sys.exit(1)
+
+library_include_path = ""
+library_lib_path = ""
+try:
+ library_include_path = os.environ['LIBRARY_INC']
+ library_lib_path = os.environ['LIBRARY_LIB']
+except:
+ library_include_path = os.environ['PREFIX']+'/include'
+ pass
+
+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_compile_args = []
+extra_link_args = []
+extra_libraries = ['cilreg']
+
+extra_include_dirs += [os.path.join(".." , ".." , "Core", "regularizers_CPU"),
+ os.path.join(".." , ".." , "Core", "regularizers_GPU") ,
+ "."]
+
+if platform.system() == 'Windows':
+
+
+ extra_compile_args[0:] = ['/DWIN32','/EHsc','/DBOOST_ALL_NO_LIB' , '/openmp' ]
+
+ if sys.version_info.major == 3 :
+ extra_libraries += ['boost_python3-vc140-mt-1_64', 'boost_numpy3-vc140-mt-1_64']
+ else:
+ extra_libraries += ['boost_python-vc90-mt-1_64', 'boost_numpy-vc90-mt-1_64']
+else:
+ extra_compile_args = ['-fopenmp','-O2', '-funsigned-char', '-Wall', '-std=c++0x']
+ if sys.version_info.major == 3:
+ extra_libraries += ['boost_python3', 'boost_numpy3','gomp']
+ else:
+ extra_libraries += ['boost_python', 'boost_numpy','gomp']
+
+setup(
+ name='ccpi',
+ description='CCPi Core Imaging Library - Image Regularizers',
+ version=cil_version,
+ cmdclass = {'build_ext': build_ext},
+ ext_modules = [Extension("ccpi.imaging.cpu_regularizers",
+ sources=[os.path.join("." , "fista_module.cpp" ),
+ # os.path.join("@CMAKE_SOURCE_DIR@" , "main_func" , "regularizers_CPU", "FGP_TV_core.c"),
+ # os.path.join("@CMAKE_SOURCE_DIR@" , "main_func" , "regularizers_CPU", "SplitBregman_TV_core.c"),
+ # os.path.join("@CMAKE_SOURCE_DIR@" , "main_func" , "regularizers_CPU", "LLT_model_core.c"),
+ # os.path.join("@CMAKE_SOURCE_DIR@" , "main_func" , "regularizers_CPU", "PatchBased_Regul_core.c"),
+ # os.path.join("@CMAKE_SOURCE_DIR@" , "main_func" , "regularizers_CPU", "TGV_PD_core.c"),
+ # os.path.join("@CMAKE_SOURCE_DIR@" , "main_func" , "regularizers_CPU", "utils.c")
+ ],
+ include_dirs=extra_include_dirs,
+ library_dirs=extra_library_dirs,
+ extra_compile_args=extra_compile_args,
+ libraries=extra_libraries ),
+
+ ],
+ zip_safe = False,
+ packages = {'ccpi','ccpi.imaging'},
+)
+
+