diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2018-08-05 15:56:52 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2018-08-05 15:58:49 +0100 |
commit | a490e0a75e810591f87c73e41965fad9187f6cd1 (patch) | |
tree | 68cd2f4bfe4e2ea5c9e31c6b2072f579fb929855 /Wrappers | |
parent | 2a2eb0e083991753a8d9247b63fea8f37559a6d7 (diff) | |
download | regularization-a490e0a75e810591f87c73e41965fad9187f6cd1.tar.gz regularization-a490e0a75e810591f87c73e41965fad9187f6cd1.tar.bz2 regularization-a490e0a75e810591f87c73e41965fad9187f6cd1.tar.xz regularization-a490e0a75e810591f87c73e41965fad9187f6cd1.zip |
added BUILD_PYTHON_WRAPPERS BUILD_MATLAB_WRAPPERS BUILD_CUDA options
Diffstat (limited to 'Wrappers')
-rw-r--r-- | Wrappers/CMakeLists.txt | 14 | ||||
-rwxr-xr-x | Wrappers/Matlab/CMakeLists.txt | 68 | ||||
-rw-r--r-- | Wrappers/Python/CMakeLists.txt | 52 | ||||
-rw-r--r-- | Wrappers/Python/conda-recipe/bld.bat | 2 |
4 files changed, 67 insertions, 69 deletions
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 |