[solved] Disable python wrapping for a specific remote module

Hi,

I’m trying to compile ITK with the remote module RTK and python wrapping.
I’m having issues with building the RTK python wrapper with multiple symbol definition on Windows, I tried tackling it to no avail. In the meantime, I would like to just disable the python wrapping of RTK for now.

My understanding is that if I just added -DRTK_WRAP_PYTHON=OFF when running cmake for ITK, cmake should not generate the wrappers for RTK. ITK/CMakeLists.txt at c2b399eef1248465a848a26231de66a8c9715132 · InsightSoftwareConsortium/ITK · GitHub

What am I doing wrong?

So my current setup is, Windows x64, MSVS 2019. I’m building ITK as part of my cmake project. ITK is being built as an ExternalProject_Add using the ninja generator.

Eric

@simon.rit might offer some advice.

@eric what are the complete parameters for ITK’s ExternalProject_Add? Does a clean build help, i.e. delete the build directory then re-run with -DRTK_WRAP_PYTHON=OFF?

Sorry no. I never use the option RTK_WRAP_PYTHON. Why not just disabling RTK in a separate build for the wrappings only?
The Windows wrapping seems to build fine on the CI, can you report your issue on RTK’s github please?

Thanks for the responses!

@dzenanz
I will try that again. I initially had it as a CMAKE_CACHE_ARG and I tried it, but no luck. I hadn’t tried it with the RTK_WRAP_PYTHON as a CMAKE_ARG. I don’t know if it can make a difference using CMAKE_CACHE_ARG vs CMAKE_ARG.

This is my ExternalProject_Add config:

	ExternalProject_Add(itk_with_rtk
			PREFIX itk_with_rtk
			CMAKE_COMMAND ${ORS_CMAKE_PATH}
			URL "file://${ORS_DEPENDENCIES}/itk/InsightToolkit-5.1.2.tar.gz"
			EXCLUDE_FROM_ALL 1
			SOURCE_DIR  ${ITK_SOURCE_PATH}
			BINARY_DIR  ${ITK_BUILD_PATH}
#			CMAKE_CACHE_ARGS "-DITK_SKIP_PATH_LENGTH_CHECKS:BOOL=ON"
			CMAKE_ARGS "-DRTK_WRAP_PYTHON=OFF"
			 "-DRTKPython_WRAP_PYTHON=OFF"

			CMAKE_CACHE_ARGS ${ITK_LINKER_FLAGS}
			CMAKE_CACHE_ARGS "-DModule_ITKCudaCommon:BOOL=ON"
			CMAKE_CACHE_ARGS "-DModule_SimpleITKFilters:BOOL=ON"
			CMAKE_CACHE_ARGS "-DModule_RTK:BOOL=ON"
			CMAKE_CACHE_ARGS "-DITK_USE_GPU:BOOL=OFF"
			CMAKE_CACHE_ARGS "-DRTK_USE_CUDA:BOOL=ON"
			CMAKE_CACHE_ARGS "-DRTK_BUILD_APPLICATIONS:BOOL=OFF"
			CMAKE_CACHE_ARGS "-DITK_WRAP_PYTHON:BOOL=ON"
			CMAKE_CACHE_ARGS "-DModule_ITKCudaCommon:BOOL=ON"
			CMAKE_CACHE_ARGS "-DBUILD_SHARED_LIBS:BOOL=ON"
			CMAKE_CACHE_ARGS "-DCUDA_TOOLKIT_ROOT_DIR=${CUDA_SDK_ROOT_DIR}"
			CMAKE_CACHE_ARGS "-DOPENCL_ROOT_DIR:PATH=${CUDA_SDK_ROOT_DIR}"
#			CMAKE_CACHE_ARGS "-DOPENCL_INCLUDE_DIR:PATH=/usr/local/cuda/include"
#			CMAKE_CACHE_ARGS "-DOPENCL_LIBRARY:FILE=/usr/local/cuda/lib64/libOpenCL.so"
			CMAKE_CACHE_ARGS "-DOPENCL_LIBRARIES:STRING=${CUDA_OpenCL_LIBRARY}"
			CMAKE_CACHE_ARGS "-DPY_SITE_PACKAGES_PATH:PATH=${PYTHON_INSTALL_FOLDER}"

			CMAKE_CACHE_ARGS "-DPython3_INCLUDE_DIR:PATH=${PYTHON_LIBRARY_INCLUDE_DIR}"
			CMAKE_CACHE_ARGS "-DPython3_LIBRARY_RELEASE:FILEPATH=${PYTHON_LIBRARY}"

			CMAKE_CACHE_ARGS "-DCMAKE_BUILD_TYPE:STRING=${ORS_DEPENDENCY_BUILD_TYPE}"
			CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:PATH=${ORS_ITK_INSTALL_PATH}"
			CMAKE_CACHE_ARGS "-DBOOSTROOT:PATH=${BOOSTROOT}"
			CMAKE_CACHE_ARGS "-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}"
			CMAKE_CACHE_ARGS "-DCMAKE_C_COMPILER_AR:FILEPATH=${CMAKE_C_COMPILER_AR}"
			CMAKE_CACHE_ARGS "-DCMAKE_C_COMPILER_RANLIB:FILEPATH=${CMAKE_C_COMPILER_RANLIB}"
			CMAKE_CACHE_ARGS "-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}"
			CMAKE_CACHE_ARGS "-DCMAKE_CXX_COMPILER_AR:FILEPATH=${CMAKE_CXX_COMPILER_AR}"
			CMAKE_CACHE_ARGS "-DCMAKE_CXX_COMPILER_RANLIB:FILEPATH=${CMAKE_CXX_COMPILER_RANLIB}"
			CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_LIBDIR:STRING=lib"
				"-DCMAKE_EXPORT_COMPILE_COMMANDS:STRING=${CMAKE_EXPORT_COMPILE_COMMANDS}"
				"-DCMAKE_JOB_POOL_COMPILE:STRING=${CMAKE_JOB_POOL_COMPILE}"
				"-DCMAKE_JOB_POOL_LINK:STRING=${CMAKE_JOB_POOL_LINK}"
				"-DCMAKE_JOB_POOLS:STRING=${CMAKE_JOB_POOLS}"
			CMAKE_ARGS  "-DCMAKE_CXX_FLAGS=${EXTERNAL_CXX_COMPILER_FLAGS}"
				        "-DCMAKE_C_FLAGS=${EXTERNAL_C_COMPILER_FLAGS}"
			USES_TERMINAL_BUILD ON
			USES_TERMINAL_CONFIGURE ON
			USES_TERMINAL_INSTALL ON

			#PATCH_COMMAND  "${PATCH_COMMAND}" "<SOURCE_DIR>/Modules/ThirdParty/OpenJPEG/src/openjpeg/opj_includes.h" "${ORSROOT}/cmake/patches/itk_with_rtk/02.patch itk openjpeg.patch"

			BUILD_BYPRODUCTS ${ITK_LIBS_FOR_RTK_WRAPPER}
			STEP_TARGETS configure
	)

@simon.rit
There is an issue already opened for this.
It’s issue #351.
It probably builds on the CI correctly because it’s not wrapping the CUDA objects

For your suggestion about compiling the wrapping separately, is there a smart way of doing it?
My understanding is to compile itk 2 times: once with RTK and no python wrapping, and a second time with the python wrapping, but without RTK. Is that correct? And in my specific case, I would need to have 2 separate ExternalProject_Add config

Oops, sorry.

Yes, that’s what I had in mind. Nothing smarter, sorry.

Alright. That’s a solution.
I don’t know how to mark a thread as resolved, but thanks for the help!

1 Like