Skip to content
Snippets Groups Projects
Select Git revision
  • 9587b8b152e445eeaa3f819d3ab0e726aa6b6e96
  • master default
  • develop
  • SELX-351-Fix-ComposeDisplacementFieldComponent
  • SELX-366-Fix-NiftyReg-ANTS-Hybrid-component
  • SELX-351-Add-ComposeDisplacementFieldComponent
  • Windows-make_shell_scripts-support
  • Add-StringConverterTest
  • Replace-stof-stoi-stoull-ItkSyNImageRegistrationMethodComponent
  • Add-StringConverter
  • double-quotes-datasets
  • SELX-342-Improve-brain-registrations
  • SELX190-Debug-build-on-Windows-out-of-memory-link-error
  • SELX-339-Add-cropping-component
  • SELX-34-Blueprint-composition-and-usage
  • SELX-276-Fix-leaderboard-generation
  • SELX-331-Add-support-for-hyperparameter-optimization
  • SELX-294-duplicate-keys-in-blueprint-format
  • SELX-324-tune-hybrid-blueprints
  • SELX-324-tune-NiftyRegAffineITKBSplineHybrid-blueprint
  • SELX-307-FixTeamElastixANTs
  • SELX-325-tune-niftyreg-blueprints
  • v1.0.0
23 results

CMakeLists.txt

Blame
  • CMakeLists.txt 2.19 KiB
    # ---------------------------------------------------------------------
    # To add a test to the build system, append it to the list below. 
    # Any GoogleTests in these files are automatically added to CTest and
    # the elastix dashboard. 
    
    set( ElastixUnitTestFilenames
      elxBlueprintTest.cxx
      elxElastixFilterTest.cxx
      elxComponentFactoryTest.cxx
      elxComponentInterfaceTest.cxx
    )         
    
    # ---------------------------------------------------------------------
    # Options
    if( SUPERELASTIX_RUN_LONG_TESTS )
      add_definitions( -DSUPERELASTIX_RUN_LONG_TESTS )
    endif()
    
    # ---------------------------------------------------------------------
    # Set data directories
    set( SUPERELASTIX_UNITTEST_INPUT_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/Data/Input )
    set( SUPERELASTIX_UNITTEST_OUTPUT_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/Data/Output )
    set( SUPERELASTIX_UNITTEST_BASELINE_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/Data/Baseline )
    
    if( NOT EXISTS ${SUPERELASTIX_UNITTEST_OUTPUT_DATA_DIR} )
      file( MAKE_DIRECTORY ${SUPERELASTIX_UNITTEST_OUTPUT_DATA_DIR} )
    endif()
    
    if( NOT EXISTS ${SUPERELASTIX_UNITTEST_OUTPUT_DATA_DIR} )
      message( FATAL_ERROR 
        "Could not create directory for output data. Make sure elastix has permission to write to disk."
      )
    endif()
    
    # ---------------------------------------------------------------------
    # Build test data manager
    configure_file(
      ${CMAKE_CURRENT_SOURCE_DIR}/elxDataDirectories.h.in
      ${CMAKE_CURRENT_BINARY_DIR}/elxDataDirectories.h
      ESCAPE_QUOTES
    )
    
    include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
    add_library( DataManager elxDataManager.cxx )
    
    list( APPEND TEST_LIBRARIES 
      DataManager
    )
    
    # ---------------------------------------------------------------------
    # Build tests
    foreach( ElastixUnitTestFilename ${ElastixUnitTestFilenames} )
      # Build tests executables
      string( REPLACE ".cxx" "" ElastixUnitTest ${ElastixUnitTestFilename} )
      add_executable( ${ElastixUnitTest} ${ElastixUnitTestFilename} )
      target_link_libraries( "${ElastixUnitTest}" ${SUPERELASTIX_LIBRARIES} ${ITK_LIBRARIES} ${TEST_LIBRARIES} )
    
      # Add GoogleTest to CTest
      GTEST_ADD_TESTS( ${ElastixUnitTest} "--gtest_output=xml:${CMAKE_BINARY_DIR}/Testing/Unit/${ElastixUnitTest}.xml" ${ElastixUnitTestFilename} )
    endforeach()