# \[solved\] Disable python wrapping for a specific remote module

**URL:** https://discourse.itk.org/t/solved-disable-python-wrapping-for-a-specific-remote-module/4055
**Category:** Engineering
**Tags:** rtk, python
**Created:** [April 20, 2021, 7:18pm UTC](https://discourse.itk.org/t/solved-disable-python-wrapping-for-a-specific-remote-module/4055 "2021-04-20T19:18:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![eric](https://discourse.itk.org/user_avatar/discourse.itk.org/eric/32/2034_2.png) [@eric](https://discourse.itk.org/u/eric)
#### Post date: [April 20, 2021, 7:18pm UTC](https://discourse.itk.org/t/solved-disable-python-wrapping-for-a-specific-remote-module/4055/1 "2021-04-20T19:18:04Z")

</div>

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](https://github.com/InsightSoftwareConsortium/ITK/blob/c2b399eef1248465a848a26231de66a8c9715132/Wrapping/Generators/CMakeLists.txt#L169)

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

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [April 20, 2021, 7:59pm UTC](https://discourse.itk.org/t/solved-disable-python-wrapping-for-a-specific-remote-module/4055/2 "2021-04-20T19:59:06Z")

</div>

@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`?

---

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [April 20, 2021, 8:34pm UTC](https://discourse.itk.org/t/solved-disable-python-wrapping-for-a-specific-remote-module/4055/3 "2021-04-20T20:34:11Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![eric](https://discourse.itk.org/user_avatar/discourse.itk.org/eric/32/2034_2.png) [@eric](https://discourse.itk.org/u/eric)
#### Post date: [April 20, 2021, 9:00pm UTC](https://discourse.itk.org/t/solved-disable-python-wrapping-for-a-specific-remote-module/4055/4 "2021-04-20T21:00:42Z")

</div>

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:

```auto
	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](https://github.com/SimonRit/RTK/issues/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

---

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [April 20, 2021, 9:05pm UTC](https://discourse.itk.org/t/solved-disable-python-wrapping-for-a-specific-remote-module/4055/5 "2021-04-20T21:05:24Z")

</div>

> [@eric](#):
>
> There is an issue already opened for this.

Oops, sorry.

> [@eric](#):
>
> 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

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

---

<div class="post-metadata">

### Author: ![eric](https://discourse.itk.org/user_avatar/discourse.itk.org/eric/32/2034_2.png) [@eric](https://discourse.itk.org/u/eric)
#### Post date: [April 20, 2021, 11:54pm UTC](https://discourse.itk.org/t/solved-disable-python-wrapping-for-a-specific-remote-module/4055/6 "2021-04-20T23:54:22Z")

</div>

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