Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
sudo apt-get install -y rsync ninja-build ccache
sudo pip install --upgrade pip
sudo pip install scikit-ci-addons
ci_addons circle/install_cmake.py 3.7.2
ci_addons circle/install_cmake.py 3.8.2
- run:
name: CCache initialization
command: |
Expand Down
9 changes: 7 additions & 2 deletions CMake/ITKModuleAPI.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#-----------------------------------------------------------------------------
# Private helper macros.

Expand All @@ -19,6 +17,13 @@ macro(_itk_module_use_recurse mod)
endif()
endmacro()

# _itk_module_config_recurse(<namespace> <module>)
#
# Internal macro to recursively load module information into the supplied
# namespace, this is called from itk_module_config. It should be noted that
# _${ns}_${mod}_USED must be cleared if this macro is to work correctly on
# subsequent invocations. The macro will load the module files using the
# itk_module_load, making all of its variables available in the local scope.
macro(_itk_module_config_recurse ns mod)
if(NOT _${ns}_${mod}_USED)
set(_${ns}_${mod}_USED 1)
Expand Down
2 changes: 2 additions & 0 deletions CMake/ITKModuleRemote.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function(itk_fetch_module _name _description)
option(Module_${_name} "${_description}" OFF)
mark_as_advanced(Module_${_name})


# Fetch_$_remote_module} is deprecated. To maintain backward compatibility:
if(Fetch_${_name})
message(WARNING "Fetch_${_name} is deprecated, please use Module_${_name} to download and enable the remote module.")
Expand All @@ -136,6 +137,7 @@ function(itk_fetch_module _name _description)
itk_download_attempt_check(Module_${_name})
include(CMakeParseArguments)
cmake_parse_arguments(_fetch_options "" "GIT_REPOSITORY;GIT_TAG" "" ${ARGN})
find_package(Git)
if(NOT GIT_EXECUTABLE)
message(FATAL_ERROR "error: could not find git for clone of ${_name}")
endif()
Expand Down
19 changes: 19 additions & 0 deletions CMake/itkApple.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Objective-C++ compile flags.
# CMake has no equivalent of CMAKE_CXX_FLAGS for Objective-C++ (bug #4756)
# so we provide this in case the user needs to specify flags specifically
# for Objective-C++ source files. For example, to build with garbage
# collection support, the -fobjc-gc flag would be used.
set(ITK_OBJCXX_FLAGS_DEFAULT "")
set(ITK_REQUIRED_OBJCXX_FLAGS ${ITK_OBJCXX_FLAGS_DEFAULT} CACHE STRING "Extra flags for Objective-C++ compilation")
mark_as_advanced(ITK_REQUIRED_OBJCXX_FLAGS)

mark_as_advanced(
CMAKE_OSX_ARCHITECTURES
CMAKE_OSX_DEPLOYMENT_TARGET
CMAKE_OSX_SYSROOT)

# OSX SDK 10.6 is the standard SDK for Python
if (CMAKE_OSX_DEPLOYMENT_TARGET AND
CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.6")
message(FATAL_ERROR "Minimum OS X deployment target is 10.6, please update CMAKE_OSX_DEPLOYMENT_TARGET.")
endif ()
45 changes: 45 additions & 0 deletions CMake/itkCompilerChecks.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Minimum compiler version check: GCC >= 4.8
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
message(FATAL_ERROR "GCC 4.8 or later is required.")
endif ()

# Minimum compiler version check: LLVM Clang >= 3.3
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3)
message(FATAL_ERROR "LLVM Clang 3.3 or later is required.")
endif ()

# Minimum compiler version check: Apple Clang >= 5.0 (Xcode 5.0)
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "Apple Clang 5.0 or later is required.")
endif ()

# Minimum compiler version check: Microsoft C/C++ >= 18.0 (aka VS 2013 aka VS 12.0)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
message(FATAL_ERROR "Microsoft Visual Studio 2013 or later is required.")
endif ()

# Minimum compiler version check: Intel C++ (ICC) >= 14
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0)
message(FATAL_ERROR "Intel C++ (ICC) 14.0 or later is required.")
endif ()

# Make sure we have C++11 enabled.
if(NOT ITK_IGNORE_CMAKE_CXX11_CHECKS)
# Needed to make sure libraries and executables not built by the
# itkModuleMacros still have the C++11 compiler flags enabled
# Wrap this in an escape hatch for unknown compilers
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11) # Supported values are ``11``, ``14``, and ``17``.
endif()
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(NOT CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
endif()
30 changes: 30 additions & 0 deletions CMake/itkSupportMacros.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
macro (itk_set_with_default var value)
if (NOT ${var})
set(${var} "${value}")
endif ()
endmacro ()

# Bridge an old, deprecated, setting to a new replacement setting.
#
# Use this function when a user-visible flag is being renamed or otherwise
# replaced. If the old value is set, it will be given as the default value,
# otherwise the given default value will be used. This returned value should
# then be used in the ``set(CACHE)`` or ``option()`` call for the new value.
#
# If the old value is set, it will warn that it is deprecated for the new name.
#
# If replacing the setting ``OLD_SETTING`` with ``NEW_SETTING``, its usage
# would look like:
#
# itk_deprecated_setting(default_setting NEW_SETTING OLD_SETTING "default value")
# set(NEW_SETTING "${default_setting}"
# CACHE STRING "Documentation for the setting.")
function (itk_deprecated_setting output_default new old intended_default)
set(default "${intended_default}")
if (DEFINED "${old}")
message(WARNING "The '${old}' variable is deprecated for '${new}'.")
set(default "${${old}}")
endif ()

set("${output_default}" "${default}" PARENT_SCOPE)
endfunction ()
8 changes: 6 additions & 2 deletions CMake/itkTargetLinkLibrariesWithDynamicLookup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ add_library(foo SHARED \"foo.c\")
extern int bar(void);
int foo(void) {return bar()+1;}
")
# ITK requires CMake >= 2.8.12. Before that, on APPLE, no flag should be passed.
set( _rpath_arg "-DCMAKE_MACOSX_RPATH='${CMAKE_MACOSX_RPATH}'" )
# APPLE: the CMAKE_MACOSX_RPATH flag should be passed.
if(APPLE)
set( _rpath_arg "-DCMAKE_MACOSX_RPATH='${CMAKE_MACOSX_RPATH}'" )
else()
set( _rpath_arg )
endif()

try_compile(${VARIABLE}
"${test_project_dir}"
Expand Down
4 changes: 4 additions & 0 deletions CMake/itkVersion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ITK version number components.
set(ITK_VERSION_MAJOR "5")
set(ITK_VERSION_MINOR "0")
set(ITK_VERSION_PATCH "0")
39 changes: 18 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)

foreach(p
CMP0025 # CMake 3.0
CMP0028
CMP0042 # CMake 3.0
CMP0054 # CMake 3.1
CMP0056 # CMake 3.2
CMP0058 # CMake 3.3
CMP0063 # CMake 3.3.2
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
cmake_minimum_required(VERSION 3.8.2 FATAL_ERROR)
if(CMAKE_CXX_STANDARD EQUAL "98" )
MESSAGE(FATAL_ERROR "CMAKE_CXX_STANDARD:STRING=98 is not supported in ITK version 5 and greater.")
endif()

project(ITK NONE)

set(ITK_CMAKE_DIR "${ITK_SOURCE_DIR}/CMake")
set(CMAKE_MODULE_PATH ${ITK_CMAKE_DIR} ${CMAKE_MODULE_PATH})

if (APPLE)
include(itkApple)
endif ()

include(itkCompilerChecks)
include(itkVersion)
set(ITK_VERSION
"${ITK_MAJOR_VERSION}.${ITK_MINOR_VERSION}.${ITK_BUILD_VERSION}")
include(itkSupportMacros)

# Configure CMake variables that will be used in the module macros
# ITK_USE_FILE is used when a remote module includes an example directory
# that can be configured as an independent project.
Expand Down Expand Up @@ -79,8 +82,6 @@ endif()
include(CTest)
mark_as_advanced(CLEAR BUILD_TESTING)

set(ITK_CMAKE_DIR ${ITK_SOURCE_DIR}/CMake)
set(CMAKE_MODULE_PATH ${ITK_CMAKE_DIR} ${CMAKE_MODULE_PATH})
include(ITKDownloadSetup)
include(PreventInSourceBuilds)
include(PreventInBuildInstalls)
Expand All @@ -93,10 +94,6 @@ include(itkCheckSourceTree)
set(main_project_name ${_ITKModuleMacros_DEFAULT_LABEL})

#-----------------------------------------------------------------------------
# ITK version number.
set(ITK_VERSION_MAJOR "5")
set(ITK_VERSION_MINOR "0")
set(ITK_VERSION_PATCH "0")
configure_file(CMake/ITKConfigVersion.cmake.in ITKConfigVersion.cmake @ONLY)

if(NOT ITK_INSTALL_RUNTIME_DIR)
Expand Down
2 changes: 1 addition & 1 deletion Examples/DataRepresentation/Mesh/Mesh2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ int main(int, char *[])
{
MeshType::CellType * cellptr = cellIterator.Value();
LineType * line = dynamic_cast<LineType *>( cellptr );
if(line == ITK_NULLPTR)
if(line == nullptr)
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/DataRepresentation/Mesh/MeshCellVisitor2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class CustomVertexVisitor
class CustomLineVisitor
{
public:
CustomLineVisitor():m_Mesh( 0 ) {}
CustomLineVisitor():m_Mesh( nullptr ) {}
virtual ~CustomLineVisitor() {}

void SetMesh( MeshType * mesh ) { m_Mesh = mesh; }
Expand Down
4 changes: 2 additions & 2 deletions Examples/Filtering/CompositeFilterExample.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class CompositeExampleImageFilter :
typedef RescaleIntensityImageFilter< ImageType, ImageType > RescalerType;
// Software Guide : EndCodeSnippet

virtual void GenerateData() ITK_OVERRIDE;
void GenerateData() override;

/** Display */
void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
void PrintSelf( std::ostream& os, Indent indent ) const override;

private:
ITK_DISALLOW_COPY_AND_ASSIGN(CompositeExampleImageFilter);
Expand Down
6 changes: 3 additions & 3 deletions Examples/Filtering/DigitallyReconstructedRadiograph1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ void usage()

int main( int argc, char *argv[] )
{
char *input_name = ITK_NULLPTR;
char *output_name = ITK_NULLPTR;
char *input_name = nullptr;
char *output_name = nullptr;

bool ok;
bool verbose = false;
Expand Down Expand Up @@ -232,7 +232,7 @@ int main( int argc, char *argv[] )
if (ok == false)
{

if (input_name == ITK_NULLPTR)
if (input_name == nullptr)
{
input_name = argv[1];
argc--;
Expand Down
2 changes: 1 addition & 1 deletion Examples/Filtering/OtsuMultipleThresholdImageFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "itkNumericTraits.h"

#include <iomanip>
#include <stdio.h>
#include <cstdio>

int main( int argc, char * argv[] )
{
Expand Down
2 changes: 1 addition & 1 deletion Examples/Filtering/ScaleSpaceGenerator2D.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "itkImageFileWriter.h"
#include "itkLaplacianRecursiveGaussianImageFilter.h"

#include <stdio.h>
#include <cstdio>
#include <iomanip>

int main( int argc, char * argv[] )
Expand Down
2 changes: 1 addition & 1 deletion Examples/IO/XML/DOMFindDemo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int main( int argc, char* argv[] )
{
std::cout << "query = \"" << query << "\"" << std::endl;
itk::DOMNode::Pointer dom2 = dom1->Find( query );
if ( (itk::DOMNode*)dom2 == 0 )
if ( (itk::DOMNode*)dom2 == nullptr )
{
std::cout << "invalid query!" << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/IO/XML/itkParticleSwarmOptimizerDOMReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ParticleSwarmOptimizerDOMReader::GenerateData( const DOMNodeType* inputdom, cons
LoggerType* logger = this->GetLogger();

OutputType* output = this->GetOutput();
if ( output == ITK_NULLPTR )
if ( output == nullptr )
{
logger->Info( "creating the output PSO object ...\n" );
OutputType::Pointer object = OutputType::New();
Expand Down
2 changes: 1 addition & 1 deletion Examples/IO/XML/itkParticleSwarmOptimizerDOMReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ParticleSwarmOptimizerDOMReader : public DOMReader<ParticleSwarmOptimizer>
* This function is called automatically when update functions are performed.
* It should fill the contents of the output object by pulling information from the intermediate DOM object.
*/
virtual void GenerateData( const DOMNodeType* inputdom, const void* ) ITK_OVERRIDE;
void GenerateData( const DOMNodeType* inputdom, const void* ) override;

private:
ITK_DISALLOW_COPY_AND_ASSIGN(ParticleSwarmOptimizerDOMReader);
Expand Down
2 changes: 1 addition & 1 deletion Examples/IO/XML/itkParticleSwarmOptimizerDOMWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ParticleSwarmOptimizerDOMWriter : public DOMWriter<ParticleSwarmOptimizer>
* This function is called automatically when update functions are performed.
* It should fill the contents of the intermediate DOM object by pulling information from the input object.
*/
virtual void GenerateData( DOMNodeType* outputdom, const void* ) const ITK_OVERRIDE;
void GenerateData( DOMNodeType* outputdom, const void* ) const override;

private:
ITK_DISALLOW_COPY_AND_ASSIGN(ParticleSwarmOptimizerDOMWriter);
Expand Down
14 changes: 7 additions & 7 deletions Examples/IO/XML/itkParticleSwarmOptimizerSAXReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ void ParticleSwarmOptimizerSAXReader::StartElement( const char* name, const char
}
else if ( itksys::SystemTools::Strucmp( name, "bound" ) == 0 && this->ContextIs( "/optimizer" ) )
{
std::vector<double>* bound = 0;
std::vector<double>* bound = nullptr;

const char* id = this->GetAttribute( atts, "id" );
if ( id == 0 )
if ( id == nullptr )
{
itkExceptionMacro( "Bound ID is missing!\n" );
}
Expand Down Expand Up @@ -156,7 +156,7 @@ int ParticleSwarmOptimizerSAXReader::ReadFile()
throw e;
}

if ( this->m_OutputObject == 0 )
if ( this->m_OutputObject == nullptr )
{
itkExceptionMacro( "Object to be read is null!\n" );
}
Expand All @@ -178,7 +178,7 @@ int ParticleSwarmOptimizerSAXReader::ReadFile()
void ParticleSwarmOptimizerSAXReader::ProcessOptimizerAttributes( const char** atts, ParticleSwarmOptimizer* opt )
{
// go over all the attribute-value pairs
for ( size_t i = 0; atts[i] != 0; i += 2 )
for ( size_t i = 0; atts[i] != nullptr; i += 2 )
{
if ( itksys::SystemTools::Strucmp( atts[i], "NumberOfParticles" ) == 0 )
{
Expand Down Expand Up @@ -236,7 +236,7 @@ void ParticleSwarmOptimizerSAXReader::ProcessOptimizerAttributes( const char** a
void ParticleSwarmOptimizerSAXReader::ProcessBoundAttributes( const char** atts, std::vector<double>& bound )
{
// go over all the attribute-value pairs
for ( size_t i = 0; atts[i] != 0; i += 2 )
for ( size_t i = 0; atts[i] != nullptr; i += 2 )
{
if ( itksys::SystemTools::Strucmp( atts[i], "value" ) == 0 )
{
Expand All @@ -260,14 +260,14 @@ void ParticleSwarmOptimizerSAXReader::ProcessBoundAttributes( const char** atts,
const char* ParticleSwarmOptimizerSAXReader::GetAttribute( const char** atts, const char* key )
{
// go over all the attribute-value pairs
for ( size_t i = 0; atts[i] != 0; i += 2 )
for ( size_t i = 0; atts[i] != nullptr; i += 2 )
{
if ( itksys::SystemTools::Strucmp( atts[i], key ) == 0 )
{
return atts[i+1];
}
}
return 0;
return nullptr;
}

/** Check the current tags to see whether it matches a user input. */
Expand Down
Loading