Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Modules/Bridge/NumPy/wrapping/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
if(ITK_WRAP_PYTHON)
itk_wrap_module(ITKBridgeNumPy)
list(APPEND WRAPPER_LIBRARY_INCLUDE_DIRECTORIES ${Python3_INCLUDE_DIRS})
set(
WRAPPER_SUBMODULE_ORDER
itkPyBuffer
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/wrapping/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
itk_wrap_module(ITKCommon)

list(APPEND WRAPPER_LIBRARY_INCLUDE_DIRECTORIES ${Python3_INCLUDE_DIRS})
set(
WRAPPER_SUBMODULE_ORDER
itkFixedArray
Expand Down
1 change: 0 additions & 1 deletion Wrapping/TypedefMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ macro(itk_wrap_module library_name)
# be linked to the wrapper library.
set(
WRAPPER_LIBRARY_LINK_LIBRARIES
${ITK_LIBRARIES}
${ITK_LIBRARY_NAMESPACE}::${library_name}Module
)

Expand Down
55 changes: 24 additions & 31 deletions Wrapping/macro_files/itk_auto_load_submodules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ function(generate_castxml_commandline_flags)
## ============================

# create the files used to pass the file to include to castxml
get_directory_property(include_dir_list INCLUDE_DIRECTORIES)
list(APPEND include_dir_list ${ITK_INCLUDE_DIRS})
set(include_dir_list ${WRAPPER_LIBRARY_INCLUDE_DIRECTORIES})
list(REMOVE_DUPLICATES include_dir_list)

# CONFIG_CASTXML_INC_CONTENTS - variable used for building contents to write with configure_file()
# CONFIG_CASTXML_INC_CONTENTS - variable used for building contents to write with file(GENERATE)
unset(CONFIG_CASTXML_INC_CONTENTS)
foreach(dir ${include_dir_list})
set(
Expand All @@ -116,6 +115,22 @@ function(generate_castxml_commandline_flags)
endforeach()
unset(include_dir_list)

foreach(_depend IN LISTS WRAPPER_LIBRARY_LINK_LIBRARIES)
if(TARGET ${_depend})
set(
CONFIG_CASTXML_INC_CONTENTS
"${CONFIG_CASTXML_INC_CONTENTS}$<LIST:JOIN,$<LIST:TRANSFORM,$<TARGET_PROPERTY:${_depend},INTERFACE_INCLUDE_DIRECTORIES>,REPLACE,^(.+)$,\"-I\\1\">,\n>\n"
)
set(
CONFIG_CASTXML_INC_CONTENTS
"${CONFIG_CASTXML_INC_CONTENTS}$<LIST:JOIN,$<LIST:TRANSFORM,$<TARGET_PROPERTY:${_depend},INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>,REPLACE,^(.+)$,\"-isystem\" \"\\1\">,\n>\n"
)
set(
CONFIG_CASTXML_INC_CONTENTS
"${CONFIG_CASTXML_INC_CONTENTS}$<LIST:JOIN,$<LIST:TRANSFORM,$<TARGET_PROPERTY:${_depend},INTERFACE_COMPILE_DEFINITIONS>,REPLACE,^(.+)$,\"-D\\1\">,\n>\n"
)
Copy link
Member Author

@blowekamp blowekamp Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zivy @bradking @thewtex This is some pretty cool code going on with CMake here.

endif()
endforeach()
set(
CONFIG_CASTXML_INC_CONTENTS
"${CONFIG_CASTXML_INC_CONTENTS}-Qunused-arguments\n"
Expand All @@ -129,29 +144,6 @@ function(generate_castxml_commandline_flags)
"${CONFIG_CASTXML_INC_CONTENTS}-DITK_MANUAL_INSTANTIATION\n"
)

# Get the compile_definitions of the module added with add_compile_definitions
# From the wrapping folder (current)
get_directory_property(compile_definition_list COMPILE_DEFINITIONS)
# And from the top module folder
set(module_folder "${WRAPPER_LIBRARY_SOURCE_DIR}/..")
get_directory_property(
compile_definition_list_at_module
DIRECTORY "${module_folder}"
COMPILE_DEFINITIONS
)
unset(module_folder)
# Merge and remove duplicates
list(APPEND compile_definition_list ${compile_definition_list_at_module})
unset(compile_definition_list_at_module)
list(REMOVE_DUPLICATES compile_definition_list)

foreach(def ${compile_definition_list})
set(
CONFIG_CASTXML_INC_CONTENTS
"${CONFIG_CASTXML_INC_CONTENTS}\"-D${def}\"\n"
)
endforeach()
unset(compile_definition_list)
foreach(include_file ${WRAPPER_INCLUDE_FILES})
if("${include_file}" MATCHES "<.*>")
string(APPEND CASTXML_INCLUDES "#include ${include_file}\n")
Expand All @@ -160,15 +152,16 @@ function(generate_castxml_commandline_flags)
endif()
endforeach()

#Write compile definitions and include paths to file. @CONFIG_CASTXML_INC_CONTENTS@ expanded in configure_file
#Write compile definitions and include paths to file. Generator expressions evaluated at generation time.
set(
castxml_inc_file
"${WRAPPER_LIBRARY_OUTPUT_DIR}/castxml_inputs/${WRAPPER_LIBRARY_NAME}.castxml.inc"
"${WRAPPER_LIBRARY_OUTPUT_DIR}/castxml_inputs/${_each_submodule_this_module}.castxml.inc"
)
configure_file(
"${ITK_WRAP_CASTXML_SOURCE_DIR}/cast_xml.inc.in"
file(
GENERATE
OUTPUT
"${castxml_inc_file}"
@ONLY
CONTENT "${CONFIG_CASTXML_INC_CONTENTS}"
)
unset(CONFIG_CASTXML_INC_CONTENTS)

Expand Down
14 changes: 1 addition & 13 deletions Wrapping/macro_files/itk_end_wrap_module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -392,19 +392,7 @@ PyModule_AddObject(m, \"_C_API\", cAPIObject);
${DO_NOT_WAIT_FOR_THREADS_CALLS}
"
)
elseif(
"ITKCommon"
IN_LIST
WRAPPER_LIBRARY_LINK_LIBRARIES
OR
"${ITK_LIBRARY_NAMESPACE}::ITKCommon"
IN_LIST
WRAPPER_LIBRARY_LINK_LIBRARIES
OR
"${ITK_LIBRARY_NAMESPACE}::ITKCommonModule"
IN_LIST
WRAPPER_LIBRARY_LINK_LIBRARIES
)
elseif(NOT WRAPPER_LIBRARY_NAME STREQUAL "ITKPyBase")
set(
ITK_WRAP_PYTHON_GLOBAL_TIMESTAMP_DECLS
"
Expand Down
Loading