-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #621 from ANTsX/nanobuild-v2
ENH: move c++ wrapping from pybind11 to nanobind
- Loading branch information
Showing
140 changed files
with
3,181 additions
and
3,900 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"files.associations": { | ||
"iosfwd": "cpp", | ||
"__bit_reference": "cpp", | ||
"__bits": "cpp", | ||
"__config": "cpp", | ||
"__debug": "cpp", | ||
"__errc": "cpp", | ||
"__functional_base": "cpp", | ||
"__hash_table": "cpp", | ||
"__locale": "cpp", | ||
"__mutex_base": "cpp", | ||
"__node_handle": "cpp", | ||
"__nullptr": "cpp", | ||
"__split_buffer": "cpp", | ||
"__string": "cpp", | ||
"__threading_support": "cpp", | ||
"__tuple": "cpp", | ||
"algorithm": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"bitset": "cpp", | ||
"cctype": "cpp", | ||
"chrono": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"complex": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"deque": "cpp", | ||
"exception": "cpp", | ||
"fstream": "cpp", | ||
"functional": "cpp", | ||
"initializer_list": "cpp", | ||
"iomanip": "cpp", | ||
"ios": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"iterator": "cpp", | ||
"limits": "cpp", | ||
"locale": "cpp", | ||
"memory": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"optional": "cpp", | ||
"ostream": "cpp", | ||
"ratio": "cpp", | ||
"sstream": "cpp", | ||
"stack": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"string": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"typeinfo": "cpp", | ||
"unordered_map": "cpp", | ||
"utility": "cpp", | ||
"vector": "cpp", | ||
"random": "cpp", | ||
"__tree": "cpp", | ||
"any": "cpp", | ||
"cfenv": "cpp", | ||
"condition_variable": "cpp", | ||
"csetjmp": "cpp", | ||
"csignal": "cpp", | ||
"future": "cpp", | ||
"list": "cpp", | ||
"map": "cpp", | ||
"numeric": "cpp", | ||
"queue": "cpp", | ||
"regex": "cpp", | ||
"set": "cpp", | ||
"unordered_set": "cpp", | ||
"valarray": "cpp", | ||
"variant": "cpp", | ||
"*.in": "cpp", | ||
"*.inc": "cpp", | ||
"*.tmpl": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
cmake_minimum_required(VERSION 3.16.3...3.26) | ||
|
||
project(ants LANGUAGES CXX) | ||
|
||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
||
# Try to import all Python components potentially needed by nanobind | ||
find_package(Python 3.8 | ||
REQUIRED COMPONENTS Interpreter Development.Module | ||
OPTIONAL_COMPONENTS Development.SABIModule) | ||
|
||
# Import nanobind through CMake's find_package mechanism | ||
find_package(nanobind CONFIG REQUIRED) | ||
|
||
# TODO: make this run only if ITK + ANTs are not already built | ||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||
execute_process(COMMAND cmd /c ${PROJECT_SOURCE_DIR}/scripts/configure_ITK.bat) | ||
execute_process(COMMAND cmd /c ${PROJECT_SOURCE_DIR}/scripts/configure_ANTs.bat) | ||
else() | ||
execute_process(COMMAND bash ${PROJECT_SOURCE_DIR}/scripts/configure_ITK.sh) | ||
execute_process(COMMAND bash ${PROJECT_SOURCE_DIR}/scripts/configure_ANTs.sh) | ||
endif() | ||
|
||
# ITK | ||
set(ITK_DIR "./itkbuild") | ||
find_package(ITK REQUIRED) | ||
include(${ITK_USE_FILE}) | ||
|
||
# ANTS | ||
add_library(antsUtilities STATIC src/antscore/antsUtilities.cxx src/antscore/antsCommandLineOption.cxx src/antscore/antsCommandLineParser.cxx src/antscore/ReadWriteData.cxx src/antscore/ANTsVersion.cxx) | ||
add_library(registrationUtilities STATIC src/antscore/antsRegistrationTemplateHeader.cxx | ||
src/antscore/antsRegistration2DDouble.cxx src/antscore/antsRegistration2DFloat.cxx | ||
src/antscore/antsRegistration3DDouble.cxx src/antscore/antsRegistration3DFloat.cxx | ||
src/antscore/antsRegistration4DDouble.cxx src/antscore/antsRegistration4DFloat.cxx) | ||
|
||
|
||
add_library(imageMathUtilities STATIC src/antscore/ImageMathHelper2D.cxx src/antscore/ImageMathHelper3D.cxx src/antscore/ImageMathHelper4D.cxx) | ||
|
||
# this may not be needed | ||
target_link_libraries(antsUtilities ${ITK_LIBRARIES}) | ||
target_link_libraries(registrationUtilities ${ITK_LIBRARIES}) | ||
target_link_libraries(imageMathUtilities ${ITK_LIBRARIES}) | ||
|
||
nanobind_add_module( | ||
lib | ||
STABLE_ABI | ||
NB_STATIC | ||
src/main.cpp | ||
src/antscore/antsAffineInitializer.cxx | ||
src/antscore/antsApplyTransforms.cxx | ||
src/antscore/antsApplyTransformsToPoints.cxx | ||
src/antscore/antsJointFusion.cxx | ||
src/antscore/antsRegistration.cxx | ||
src/antscore/Atropos.cxx | ||
src/antscore/AverageAffineTransform.cxx | ||
src/antscore/AverageAffineTransformNoRigid.cxx | ||
src/antscore/CreateJacobianDeterminantImage.cxx | ||
src/antscore/DenoiseImage.cxx | ||
src/antscore/iMath.cxx | ||
src/antscore/KellyKapowski.cxx | ||
src/antscore/LabelClustersUniquely.cxx | ||
src/antscore/LabelGeometryMeasures.cxx | ||
src/antscore/N3BiasFieldCorrection.cxx | ||
src/antscore/N4BiasFieldCorrection.cxx | ||
src/antscore/ResampleImage.cxx | ||
src/antscore/ThresholdImage.cxx | ||
src/antscore/TileImages.cxx | ||
) | ||
target_link_libraries(lib PRIVATE ${ITK_LIBRARIES} antsUtilities registrationUtilities imageMathUtilities) | ||
|
||
# Install directive for scikit-build-core | ||
install(TARGETS lib LIBRARY DESTINATION ants) |
Oops, something went wrong.