Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STYLE: Minimize cmake configured python files
All of the cmake configured variables should be contained in the minimal number of files. Move cmake configuration options to the itkConfig.py.in file, and convert itkBuildOptions.py.in to a static python file. The itkBuildOptions.py was previously not used internally, so a simple test has been added to exercise the codebase in itkBuildOptions.py.
- Loading branch information
1 parent
1e334c9
commit 98fe9d6
Showing
6 changed files
with
130 additions
and
73 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
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,29 @@ | ||
# ========================================================================== | ||
# | ||
# Copyright NumFOCUS | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0.txt | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# ==========================================================================*/ | ||
|
||
from itk.support.itkBuildOptions import ALL_TYPES, DIMS | ||
|
||
# Simple exercise of types identified during build | ||
print("-------- PRINTING THE BUILD DIMENSIONS -----------") | ||
for build_dims in DIMS: | ||
print(f"ITK Compliled with support for dimension: {build_dims}") | ||
print("---------------------------------------------") | ||
print("-------- PRINTING THE BUILD TYPES -----------") | ||
for build_types_identified in ALL_TYPES: | ||
print(f"ITK Compliled with support for: {build_types_identified}") | ||
print("---------------------------------------------") |
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,60 @@ | ||
import itk | ||
|
||
# Finding the named elements in the templates | ||
# requires that they are force loaded before | ||
# before searching | ||
itk.force_load() | ||
|
||
from itk.support import itkTypes | ||
from itk.support.itkTemplate import itkTemplate | ||
|
||
from typing import List, Union | ||
from itkConfig import ITK_GLOBAL_WRAPPING_BUILD_OPTIONS as _itkwrapbo | ||
|
||
DIMS: List[int] = [int(s) for s in _itkwrapbo["ITK_WRAP_IMAGE_DIMS"] if s] | ||
USIGN_INTS: List[itkTypes.itkCType] = [ | ||
getattr(itkTypes, s) for s in _itkwrapbo["WRAP_ITK_USIGN_INT"] if s | ||
] | ||
SIGN_INTS: List[itkTypes.itkCType] = [ | ||
getattr(itkTypes, s) for s in _itkwrapbo["WRAP_ITK_SIGN_INT"] if s | ||
] | ||
REALS: List[itkTypes.itkCType] = [ | ||
getattr(itkTypes, s) for s in _itkwrapbo["WRAP_ITK_REAL"] if s | ||
] | ||
|
||
VECTOR_REALS: List[itkTemplate] = [ | ||
itkTemplate.__templates__[itkTemplate.normalizeName(s)] | ||
for s in _itkwrapbo["ITK_WRAP_PYTHON_VECTOR_REAL"] | ||
if s | ||
] | ||
COV_VECTOR_REALS: List[itkTemplate] = [ | ||
itkTemplate.__templates__[itkTemplate.normalizeName(s)] | ||
for s in _itkwrapbo["ITK_WRAP_PYTHON_COV_VECTOR_REAL"] | ||
if s | ||
] | ||
RGBS: List[itkTemplate] = [ | ||
itkTemplate.__templates__[itkTemplate.normalizeName(s)] | ||
for s in _itkwrapbo["ITK_WRAP_PYTHON_RGB"] | ||
if s | ||
] | ||
RGBAS: List[itkTemplate] = [ | ||
itkTemplate.__templates__[itkTemplate.normalizeName(s)] | ||
for s in _itkwrapbo["ITK_WRAP_PYTHON_RGBA"] | ||
if s | ||
] | ||
COMPLEX_REALS: List[itkTemplate] = [ | ||
itkTemplate.__templates__[itkTemplate.normalizeName(s)] | ||
for s in _itkwrapbo["ITK_WRAP_PYTHON_COMPLEX_REAL"] | ||
if s | ||
] | ||
|
||
INTS: List[itkTypes.itkCType] = SIGN_INTS + USIGN_INTS | ||
SCALARS: List[itkTypes.itkCType] = INTS + REALS | ||
VECTORS: List[itkTemplate] = VECTOR_REALS + COV_VECTOR_REALS | ||
COLORS: List[itkTemplate] = RGBS + RGBAS | ||
ALL_TYPES: List[ | ||
Union[itkTypes.itkCType, itkTemplate] | ||
] = COLORS + VECTORS + SCALARS + COMPLEX_REALS | ||
|
||
del itkTemplate | ||
del itkTypes |
43 changes: 0 additions & 43 deletions
43
Wrapping/Generators/Python/itk/support/itkBuildOptions.py.in
This file was deleted.
Oops, something went wrong.
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