<commit_before>#=========================================================================
#
#  Copyright Leiden University Medical Center, Erasmus University Medical 
#  Center and contributors
#
#  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.
#
#=========================================================================

# This file allows the SuperElastix command line interface to be
# built as an external project. 

# ---------------------------------------------------------------------

# Collect header files for Visual Studio Project 
# http://stackoverflow.com/questions/8316104/specify-how-cmake-creates-visual-studio-project
file(GLOB COMMANDLINE_HEADER_FILES "${COMMANDLINE_SOURCE_DIR}/*/include/*.*")

set( COMMANDLINE_SOURCE_FILES
  ${CMAKE_CURRENT_SOURCE_DIR}/src/selxSuperElastix.cxx
  ${CMAKE_CURRENT_SOURCE_DIR}/src/selxConfigurationReader.cxx
)

#set(Boost_DEBUG ON )
set(Boost_USE_STATIC_LIBS ON) 
set(Boost_USE_MULTITHREADED ON)  
set(Boost_USE_STATIC_RUNTIME    OFF)

find_package(Boost COMPONENTS program_options filesystem system regex REQUIRED QUIET ) 
include_directories( ${Boost_INCLUDE_DIR} )

# Compile executable
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/include" )
add_executable( SuperElastix ${COMMANDLINE_SOURCE_FILES} ${COMMANDLINE_HEADER_FILES} )
target_link_libraries( SuperElastix ${SUPERELASTIX_LIBRARIES} ${Boost_LIBRARIES} ${ITK_LIBRARIES} )

# demo copies SuperElastix executable, image data, configuration files and bat/bash scripts to the DEMO_PREFIX directory
set( DEMO_PREFIX ${PROJECT_BINARY_DIR}/Demo CACHE PATH "Demo files will be copied to this directory" )

# Download demo data
include( ExternalData )

# Get the demo image data: from superelastix-build or otherwise download 
list( APPEND ExternalData_URL_TEMPLATES
  "file://${PROJECT_BINARY_DIR}/../SuperElastix-build/ExternalData/Objects/%(algo)/%(hash)"
  "http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)"
  "https://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)"
)

file( GLOB_RECURSE DemoDataContentLinks "*.md5" )
foreach( DemoDataContentLink ${DemoDataContentLinks} )
  string( REGEX REPLACE "\\.md5$" "" DemoDataContentLink ${DemoDataContentLink} )
  ExternalData_Expand_Arguments( demo
    demoFileName
    DATA{${DemoDataContentLink}}
  )
  list( APPEND demoFileNames ${demoFileName} )
endforeach()

# Create target and reference the external data
ExternalData_Add_Target( demo )
add_dependencies( demo SuperElastix )
set_target_properties( demo PROPERTIES EXCLUDE_FROM_ALL TRUE ) 
<commit_msg>CMAKE: Link SuperElastix command line application with elastix libraries<commit_after>#=========================================================================
#
#  Copyright Leiden University Medical Center, Erasmus University Medical 
#  Center and contributors
#
#  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.
#
#=========================================================================

# This file allows the SuperElastix command line interface to be
# built as an external project. 

# ---------------------------------------------------------------------

# Collect header files for Visual Studio Project 
# http://stackoverflow.com/questions/8316104/specify-how-cmake-creates-visual-studio-project
file(GLOB COMMANDLINE_HEADER_FILES "${COMMANDLINE_SOURCE_DIR}/*/include/*.*")

set( COMMANDLINE_SOURCE_FILES
  ${CMAKE_CURRENT_SOURCE_DIR}/src/selxSuperElastix.cxx
  ${CMAKE_CURRENT_SOURCE_DIR}/src/selxConfigurationReader.cxx
)

#set(Boost_DEBUG ON )
set(Boost_USE_STATIC_LIBS ON) 
set(Boost_USE_MULTITHREADED ON)  
set(Boost_USE_STATIC_RUNTIME    OFF)

find_package(Boost COMPONENTS program_options filesystem system regex REQUIRED QUIET ) 
include_directories( ${Boost_INCLUDE_DIR} )

# Compile executable
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/include" )
add_executable( SuperElastix ${COMMANDLINE_SOURCE_FILES} ${COMMANDLINE_HEADER_FILES} )
target_link_libraries( SuperElastix ${SUPERELASTIX_LIBRARIES} ${Boost_LIBRARIES} ${ITK_LIBRARIES} ${ELASTIX_LIBRARIES} )

# demo copies SuperElastix executable, image data, configuration files and bat/bash scripts to the DEMO_PREFIX directory
set( DEMO_PREFIX ${PROJECT_BINARY_DIR}/Demo CACHE PATH "Demo files will be copied to this directory" )

# Download demo data
include( ExternalData )

# Get the demo image data: from superelastix-build or otherwise download 
list( APPEND ExternalData_URL_TEMPLATES
  "file://${PROJECT_BINARY_DIR}/../SuperElastix-build/ExternalData/Objects/%(algo)/%(hash)"
  "http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)"
  "https://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)"
)

file( GLOB_RECURSE DemoDataContentLinks "*.md5" )
foreach( DemoDataContentLink ${DemoDataContentLinks} )
  string( REGEX REPLACE "\\.md5$" "" DemoDataContentLink ${DemoDataContentLink} )
  ExternalData_Expand_Arguments( demo
    demoFileName
    DATA{${DemoDataContentLink}}
  )
  list( APPEND demoFileNames ${demoFileName} )
endforeach()

# Create target and reference the external data
ExternalData_Add_Target( demo )
add_dependencies( demo SuperElastix )
set_target_properties( demo PROPERTIES EXCLUDE_FROM_ALL TRUE ) 

{'fraction_non_alphanumeric': 0.15420854271356785, 'fraction_numerical': 0.004711055276381909, 'mean_word_length': 5.369, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2394869', 'n_tokens_mistral': 1961, 'n_tokens_neox': 1854, 'n_words': 487}