summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt9
-rw-r--r--Core/CMakeLists.txt68
-rw-r--r--Wrappers/CMakeLists.txt14
-rwxr-xr-xWrappers/Matlab/CMakeLists.txt68
-rw-r--r--Wrappers/Python/CMakeLists.txt52
-rw-r--r--Wrappers/Python/conda-recipe/bld.bat2
6 files changed, 107 insertions, 106 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index df596e7..d9a0f5a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,10 @@ set (CIL_VERSION '${CIL_VERSION_MAJOR}.${CIL_VERSION_MINOR}.${CIL_VERSION_PATCH}
# set the Python variables for the Conda environment
#include(${CMAKE_SOURCE_DIR}/CMake/FindAnacondaEnvironment.cmake)
+option (BUILD_MATLAB_WRAPPERS "Build Matlab Wrappers" OFF)
+option (BUILD_PYTHON_WRAPPERS "Build Python Wrappers" OFF)
+option (CONDA_BUILD "Conda Build" OFF)
+option (BUILD_CUDA "Build the CUDA modules" ON)
+
add_subdirectory(Core)
-if (BUILD_WRAPPERS)
- add_subdirectory(Wrappers)
-endif() \ No newline at end of file
+add_subdirectory(Wrappers)
diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt
index 2665277..5df55f1 100644
--- a/Core/CMakeLists.txt
+++ b/Core/CMakeLists.txt
@@ -11,8 +11,7 @@ project(RGL_core)
# conda orchestrated build
message("CIL_VERSION ${CIL_VERSION}")
#include (GenerateExportHeader)
-option (BUILD_WRAPPERS "Build Wrappers" ON)
-option (CONDA_BUILD "Conda Build" OFF)
+
find_package(OpenMP)
if (OPENMP_FOUND)
@@ -96,35 +95,36 @@ message ("I'd install into ${CMAKE_INSTALL_PREFIX} lib bin")
endif()
# GPU Regularisers
-
-find_package(CUDA)
-if (CUDA_FOUND)
- set(CUDA_NVCC_FLAGS "-Xcompiler -fPIC -shared -D_FORCE_INLINES")
- message("CUDA FLAGS ${CUDA_NVCC_FLAGS}")
- CUDA_ADD_LIBRARY(cilregcuda SHARED
- ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/TV_ROF_GPU_core.cu
- ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/TV_FGP_GPU_core.cu
- ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/TV_SB_GPU_core.cu
- ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/LLT_ROF_GPU_core.cu
- ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/TGV_GPU_core.cu
- ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/dTV_FGP_GPU_core.cu
- ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/NonlDiff_GPU_core.cu
- ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/Diffus_4thO_GPU_core.cu
- )
- if (UNIX)
- message ("I'd install into ${CMAKE_INSTALL_PREFIX}/lib")
- install(TARGETS cilregcuda
- LIBRARY DESTINATION lib
- CONFIGURATIONS ${CMAKE_BUILD_TYPE}
- )
- elseif(WIN32)
- message ("I'd install into ${CMAKE_INSTALL_PREFIX} lib bin")
- install(TARGETS cilregcuda
- RUNTIME DESTINATION bin
- ARCHIVE DESTINATION lib
- CONFIGURATIONS ${CMAKE_BUILD_TYPE}
- )
- endif()
-else()
- message("CUDA NOT FOUND")
-endif()
+if (BUILD_CUDA)
+ find_package(CUDA)
+ if (CUDA_FOUND)
+ set(CUDA_NVCC_FLAGS "-Xcompiler -fPIC -shared -D_FORCE_INLINES")
+ message("CUDA FLAGS ${CUDA_NVCC_FLAGS}")
+ CUDA_ADD_LIBRARY(cilregcuda SHARED
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/TV_ROF_GPU_core.cu
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/TV_FGP_GPU_core.cu
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/TV_SB_GPU_core.cu
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/LLT_ROF_GPU_core.cu
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/TGV_GPU_core.cu
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/dTV_FGP_GPU_core.cu
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/NonlDiff_GPU_core.cu
+ ${CMAKE_CURRENT_SOURCE_DIR}/regularisers_GPU/Diffus_4thO_GPU_core.cu
+ )
+ if (UNIX)
+ message ("I'd install into ${CMAKE_INSTALL_PREFIX}/lib")
+ install(TARGETS cilregcuda
+ LIBRARY DESTINATION lib
+ CONFIGURATIONS ${CMAKE_BUILD_TYPE}
+ )
+ elseif(WIN32)
+ message ("I'd install into ${CMAKE_INSTALL_PREFIX} lib bin")
+ install(TARGETS cilregcuda
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ CONFIGURATIONS ${CMAKE_BUILD_TYPE}
+ )
+ endif()
+ else()
+ message("CUDA NOT FOUND")
+ endif()
+endif() \ No newline at end of file
diff --git a/Wrappers/CMakeLists.txt b/Wrappers/CMakeLists.txt
index 9ae1be1..8d02df6 100644
--- a/Wrappers/CMakeLists.txt
+++ b/Wrappers/CMakeLists.txt
@@ -11,13 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
-find_package(Matlab)
-if (MATLAB_FOUND)
- message(Matlab)
- add_subdirectory(Matlab)
-else()
- message("Matlab not found")
+if (BUILD_MATLAB_WRAPPERS)
+ add_subdirectory(Matlab)
endif()
-
-add_subdirectory(Python) \ No newline at end of file
+if (BUILD_PYTHON_WRAPPERS)
+ add_subdirectory(Python)
+endif() \ No newline at end of file
diff --git a/Wrappers/Matlab/CMakeLists.txt b/Wrappers/Matlab/CMakeLists.txt
index 012bf96..e9cc6a8 100755
--- a/Wrappers/Matlab/CMakeLists.txt
+++ b/Wrappers/Matlab/CMakeLists.txt
@@ -75,41 +75,43 @@ endforeach()
add_custom_target(MatlabWrapper DEPENDS ${CPU_MEX_TARGETS})
-find_package(CUDA)
-if (CUDA_FOUND)
- file(GLOB GPU_MEX_FILES
- "${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/regularisers_GPU/*.c"
- )
+if (BUILD_CUDA)
+ find_package(CUDA)
+ if (CUDA_FOUND)
+ file(GLOB GPU_MEX_FILES
+ "${CMAKE_SOURCE_DIR}/Wrappers/Matlab/mex_compile/regularisers_GPU/*.c"
+ )
- list(LENGTH GPU_MEX_FILES num)
+ list(LENGTH GPU_MEX_FILES num)
- MATH(EXPR num "${num}-1")
-#set(num "-1")
+ MATH(EXPR num "${num}-1")
+ #set(num "-1")
- foreach(tgt RANGE ${num})
- message("number " ${tgt})
- #list(GET CPU_TARGETS ${tgt} current_target)
- list(GET GPU_MEX_FILES ${tgt} current_file)
- get_filename_component(current_target ${current_file} NAME)
- message("matlab_add_mex " ${current_target})
- matlab_add_mex(
- NAME ${current_target}
- SRC
- ${current_file}
- LINK_TO cilreg ${Matlab_LIBRARIES}
- )
-
- target_include_directories(${current_target}
- PUBLIC ${CMAKE_SOURCE_DIR}/Core/regularisers_CPU
- ${CMAKE_SOURCE_DIR}/Core/regularisers_GPU
- ${CMAKE_SOURCE_DIR}/Core/inpainters_CPU
- ${CMAKE_SOURCE_DIR}/Core/
- ${MATLAB_INCLUDE_DIR})
-
- list(APPEND CPU_MEX_TARGETS ${current_target})
- endforeach()
-
- add_custom_target(MatlabWrapperGPU DEPENDS ${GPU_MEX_TARGETS})
+ foreach(tgt RANGE ${num})
+ message("number " ${tgt})
+ #list(GET CPU_TARGETS ${tgt} current_target)
+ list(GET GPU_MEX_FILES ${tgt} current_file)
+ get_filename_component(current_target ${current_file} NAME)
+ message("matlab_add_mex " ${current_target})
+ matlab_add_mex(
+ NAME ${current_target}
+ SRC
+ ${current_file}
+ LINK_TO cilreg ${Matlab_LIBRARIES}
+ )
+
+ target_include_directories(${current_target}
+ PUBLIC ${CMAKE_SOURCE_DIR}/Core/regularisers_CPU
+ ${CMAKE_SOURCE_DIR}/Core/regularisers_GPU
+ ${CMAKE_SOURCE_DIR}/Core/inpainters_CPU
+ ${CMAKE_SOURCE_DIR}/Core/
+ ${MATLAB_INCLUDE_DIR})
+
+ list(APPEND CPU_MEX_TARGETS ${current_target})
+ endforeach()
+
+ add_custom_target(MatlabWrapperGPU DEPENDS ${GPU_MEX_TARGETS})
-endif()
+ endif()
+endif() \ No newline at end of file
diff --git a/Wrappers/Python/CMakeLists.txt b/Wrappers/Python/CMakeLists.txt
index 464c916..52f3f39 100644
--- a/Wrappers/Python/CMakeLists.txt
+++ b/Wrappers/Python/CMakeLists.txt
@@ -41,33 +41,33 @@ elseif(UNIX)
endif()
# GPU regularisers
-
-find_package(CUDA)
-if (CUDA_FOUND)
- message("CUDA FOUND")
- set (SETUP_GPU_WRAPPERS "extra_libraries += ['cilregcuda']\n\
-setup( \n\
- name='ccpi', \n\
- description='CCPi Core Imaging Library - Image regularisers GPU',\n\
- version=cil_version,\n\
- cmdclass = {'build_ext': build_ext},\n\
- ext_modules = [Extension('ccpi.filters.gpu_regularisers',\n\
- sources=[ \n\
- os.path.join('.' , 'src', 'gpu_regularisers.pyx' ),\n\
- ],\n\
- include_dirs=extra_include_dirs, \n\
- library_dirs=extra_library_dirs, \n\
- extra_compile_args=extra_compile_args, \n\
- libraries=extra_libraries ), \n\
- ],\n\
- zip_safe = False, \n\
- packages = {'ccpi','ccpi.filters'},\n\
-)")
-else()
- message("CUDA NOT FOUND")
- set(SETUP_GPU_WRAPPERS "#CUDA NOT FOUND")
+if (BUILD_CUDA)
+ find_package(CUDA)
+ if (CUDA_FOUND)
+ message("CUDA FOUND")
+ set (SETUP_GPU_WRAPPERS "extra_libraries += ['cilregcuda']\n\
+ setup( \n\
+ name='ccpi', \n\
+ description='CCPi Core Imaging Library - Image regularisers GPU',\n\
+ version=cil_version,\n\
+ cmdclass = {'build_ext': build_ext},\n\
+ ext_modules = [Extension('ccpi.filters.gpu_regularisers',\n\
+ sources=[ \n\
+ os.path.join('.' , 'src', 'gpu_regularisers.pyx' ),\n\
+ ],\n\
+ include_dirs=extra_include_dirs, \n\
+ library_dirs=extra_library_dirs, \n\
+ extra_compile_args=extra_compile_args, \n\
+ libraries=extra_libraries ), \n\
+ ],\n\
+ zip_safe = False, \n\
+ packages = {'ccpi','ccpi.filters'},\n\
+ )")
+ else()
+ message("CUDA NOT FOUND")
+ set(SETUP_GPU_WRAPPERS "#CUDA NOT FOUND")
+ endif()
endif()
-
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/setup-regularisers.py.in" "${CMAKE_CURRENT_BINARY_DIR}/setup-regularisers.py")
diff --git a/Wrappers/Python/conda-recipe/bld.bat b/Wrappers/Python/conda-recipe/bld.bat
index e58808b..6c84355 100644
--- a/Wrappers/Python/conda-recipe/bld.bat
+++ b/Wrappers/Python/conda-recipe/bld.bat
@@ -10,7 +10,7 @@ ROBOCOPY /E "%RECIPE_DIR%\..\..\..\Core" "%SRC_DIR%\Core"
cd %SRC_DIR%
:: issue cmake to create setup.py
-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"
+cmake -G "NMake Makefiles" %RECIPE_DIR%\..\..\..\ -DBUILD_PYTHON_WRAPPERS=ON -DCONDA_BUILD=ON -DBUILD_CUDA=OFF -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