COMP: CMake, add INCLUDE_DIRS for swig to work#5
Conversation
Also re-arranges to avoid duplication
7e8a942 to
9a4a689
Compare
Add itk-module-init.cmake WIP: Remove debug CMake messages SWIG is not reading the TotalVariationTargets.cmake file, where proxTV library is set, with include dirs, interface libraries and compile definitions. This creates erorrs, the first sign is missing the INCLUDE_DIRSs. (TVopt.h not found). This can be solved hacking the INCLUDE_DIRS of the ITK Module TotalVariation_INCLUDE_DIRS. Once that's fixed, the next error is missing mex.h file, this is because the compile definition NO_MATLAB is not applied. In Eigen3 I faced the same problems, but because it is header only, fixing INCLUDE_DIRS and adding the compile definitions in the Eigen3-ITK Header (itkEigen3.h) was enough. In this case, the compile definitions of proxTV (NO_MATLAB, USE_LAPACK=0) are ignored.
|
Related: InsightSoftwareConsortium/ITK#650 |
|
Example error: [1/8] Generating ../../../../../../ITK-cp37-cp37m-manylinux1_x64/Wrapping/itkProxTVImageFilter.xml
FAILED: ../../../ITK-cp37-cp37m-manylinux1_x64/Wrapping/itkProxTVImageFilter.xml
cd /work/_skbuild/linux-x86_64-3.7/cmake-build/Wrapping/Modules/TotalVariation && /work/_skbuild/linux-x86_64-3.7/cmake-build/Wrapping/Generators/CastXML/castxml/bin/castxml -o /work/ITK-cp37-cp37m-manylinux1_x64/Wrapping/itkProxTVImageFilter.xml --castxml-gccxml --target=x86_64-linux-gnu --castxml-start _wrapping_ --castxml-cc-gnu "(" /opt/rh/devtoolset-2/root/usr/bin/g++ -Wno-array-bounds -w -Wno-array-bounds -std=c++11 ")" -w -c @/work/ITK-cp37-cp37m-manylinux1_x64/Wrapping/TotalVariation.castxml.inc /work/ITK-cp37-cp37m-manylinux1_x64/Wrapping/itkProxTVImageFilter.cxx
In file included from /work/ITK-cp37-cp37m-manylinux1_x64/Wrapping/itkProxTVImageFilter.cxx:16:
In file included from /work/include/itkProxTVImageFilter.h:22:
In file included from /work/_skbuild/linux-x86_64-3.7/cmake-build/_deps/proxtv_fetch-build/src/include/TVopt.h:15:
In file included from /work/_skbuild/linux-x86_64-3.7/cmake-build/_deps/proxtv_fetch-build/src/include/general.h:22:
/work/_skbuild/linux-x86_64-3.7/cmake-build/_deps/proxtv_fetch-build/src/include/lapackFunctionsWrap.h:16:10: fatal error: 'mex.h' file not found
#include "mex.h"
|
|
Merging but the problem where castxml does not read the ModuleTargets.cmake is still there. |
|
I will take a look... 👀 |
|
I am trying to compile this external package and I am experiencing this error:
I see that the most recent commit of the TV sources that get pulled at /path-to-ITKbuild/_deps/proxtv_fetch-src is from April 11th commit 187f868861f53b74fd00eeb40eb7ba83c2b7809d (HEAD -> use_eigen, origin/use_eigen) When I look for these changes by typing git log --all --grep='swig to work' I dont have any commits coming up. Has this commit been fully integrated into ITK? Thank you! 🙏 |
|
Hi @bpaniagua, |
|
Yes, it looks like ITK does (If i grep the log in my ITKsources - not the tv sources - I can see that commit) |
|
ITK version: |
|
yeah, I can reproduce it, it seems that the compile definition is not added to castxml. The compile definition is added here: https://github.com/InsightSoftwareConsortium/ITKTotalVariation/blob/master/CMakeLists.txt#L26 . But castxml is ignoring it, even though compile definitions are added there. I will have a look. |
|
The hacky solution works, @phcerdan Thank you so so much! |
itk_wrap_module_castxml now gets the COMPILE_DEFINITIONS of the module top directory, instead of the wrapping directory. The old behavior wasn't respecting the add_compile_definitions set in the CMakeLists of the module. Triggered by: InsightSoftwareConsortium/ITKTotalVariation#5 This is a follow on from: e3a908b
|
@bpaniagua I created a PR in ITK to fix this 1079, not sure why the add_compile_definitions set in the top CMakeLists.txt of the modules are not propagated to the That PR just gets the COMPILE_DEFINITIONS of the parent module directory (instead of the wrapping folder). It would be great if you are able to give it a test! |
itk_wrap_module_castxml now gets the COMPILE_DEFINITIONS of the module top directory, instead of the wrapping directory. The old behavior wasn't respecting the add_compile_definitions set in the CMakeLists of the module. Triggered by: InsightSoftwareConsortium/ITKTotalVariation#5 This is a follow on from: e3a908b
itk_wrap_module_castxml now gets the COMPILE_DEFINITIONS of the module top directory, instead of the wrapping directory. The old behavior wasn't respecting the add_compile_definitions set in the CMakeLists of the module. Triggered by: InsightSoftwareConsortium/ITKTotalVariation#5 This is a follow on from: e3a908b
itk_wrap_module_castxml now gets the COMPILE_DEFINITIONS of the module top directory, instead of the wrapping directory. The old behavior wasn't respecting the add_compile_definitions set in the CMakeLists of the module. Triggered by: InsightSoftwareConsortium/ITKTotalVariation#5 This is a follow on from: e3a908b
itk_wrap_module_castxml now gets the COMPILE_DEFINITIONS of the module top directory, instead of the wrapping directory. The old behavior wasn't respecting the add_compile_definitions set in the CMakeLists of the module. Triggered by: InsightSoftwareConsortium/ITKTotalVariation#5 This is a follow on from: 8c922bb
itk_wrap_module_castxml now gets the COMPILE_DEFINITIONS of the module top directory, instead of the wrapping directory. The old behavior wasn't respecting the add_compile_definitions set in the CMakeLists of the module. Triggered by: InsightSoftwareConsortium/ITKTotalVariation#5 This is a follow on from: 8c922bb
itk_wrap_module_castxml now gets the COMPILE_DEFINITIONS of the module top directory, instead of the wrapping directory. The old behavior wasn't respecting the add_compile_definitions set in the CMakeLists of the module. Triggered by: InsightSoftwareConsortium/ITKTotalVariation#5 This is a follow on from: 5d2f0ed
itk_wrap_module_castxml now gets the COMPILE_DEFINITIONS of the module top directory, instead of the wrapping directory. The old behavior wasn't respecting the add_compile_definitions set in the CMakeLists of the module. Triggered by: InsightSoftwareConsortium/ITKTotalVariation#5 This is a follow on from: 5d2f0ed

WIP: Fix TotalVariation_INCLUDE_DIRS
Add itk-module-init.cmake
WIP: Remove debug CMake messages
SWIG is not reading the TotalVariationTargets.cmake file, where proxTV
library is set, with include dirs, interface libraries and compile
definitions.
This creates erorrs, the first sign is missing the INCLUDE_DIRSs.
(TVopt.h not found).
This can be solved hacking the INCLUDE_DIRS of the ITK Module TotalVariation_INCLUDE_DIRS.
Once that's fixed, the next error is missing mex.h file, this is because
the compile definition NO_MATLAB is not applied.
In Eigen3 I faced the same problems, but because it is header only,
fixing INCLUDE_DIRS and adding the compile definitions in the
Eigen3-ITK Header (itkEigen3.h) was enough.
In this case, the compile definitions of proxTV (NO_MATLAB, USE_LAPACK=0)
are ignored.