<commit_before>cmake_minimum_required(VERSION 2.8)
project(MLPACK C CXX)

#find_package(BLAS REQUIRED)
#find_package(LAPACK REQUIRED)

## Global compiler flags (dep. on platform TODO)
#set(CMAKE_CXX_FLAGS "-g -Wall")
add_definitions( -DDISABLE_DISK_MATRIX )

## Location of fastlib headers & lib
set(FASTLIB_BASE_DIR /usr/local CACHE PATH
  "Directory where fastlib is installed." )
set(FASTLIB_LIB_DIR ${FASTLIB_BASE_DIR}/lib )
set(FASTLIB_INCLUDE_DIR ${FASTLIB_BASE_DIR}/include )
# set(FASTLIB_LIB_DIR ${FASTLIB_BASE_DIR}/lib CACHE PATH
#   "Directory where the fastlib library is installed." )
# set(FASTLIB_INCLUDE_DIR ${FASTLIB_BASE_DIR}/include CACHE PATH
#   "Directory where the fastlib headers are installed." )
#     
# mark_as_advanced(FASTLIB_LIB_DIR FASTLIB_INCLUDE_DIR) 

##? add_library ?
find_library(FASTLIB_LIB fastlib ${FASTLIB_LIB_DIR})

## include dirs
include_directories( ${FASTLIB_INCLUDE_DIR} )
include_directories( .. )  # mlpack
include_directories( ../include/ )

## link directories
link_directories( ${FASTLIB_LIB_DIR} )

## standard libs
set(MLPACK_STD_LIBS fastlib lapack blas )  ##! this ordering matters :(

## recurse
set(DIRS
#    allkfn
#    allknn
    allnn
#    disk_allnn  # does not compile, perhaps due to an API change
    core
    emst
    fastica
    hmm
    infomax_ica
#    isonmf  ## nothing here yet
    kalman
    kde
#    kernel_pca  # requires sparse 
    #mog # requires optimization
#    mlpackdemo  ## matlab routines
    #mvu # requires optimization
    naive_bayes
    neighbor_search
    nnsvm
    quicsvd
    # range_search  ##! uses contrib code
    regression
    series_expansion
    svm
)

if(WITH_SPARSE)
#   Don't compile this because sparse support in this branch is not really
#   existent
#   set(DIRS ${DIRS} kernel_pca)
endif()

if(WITH_OPTIMIZERS)
#  set(DIRS ${DIRS} mvu)
endif()

foreach(dir ${DIRS})
    add_subdirectory(${dir})
endforeach()

# MLPACK_SRCS is set in the subdirectories
add_library(mlpack ${MLPACK_SRCS})
add_dependencies(mlpack fastlib)
target_link_libraries(mlpack
  fastlib
  armadillo
  lapack
  blas
)

if(WITH_SPARSE)
   target_link_libraries(mlpack
      ${TRILINOS_LIBS}
   )
endif()

# move header files to the right directory
file(GLOB_RECURSE INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
add_custom_command(TARGET mlpack POST_BUILD
   COMMENT "Moving header files to include/mlpack/"
   COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/include/mlpack/)
foreach(incl_file ${INCLUDE_FILES})
   add_custom_command(TARGET mlpack POST_BUILD
      COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${incl_file} ${CMAKE_BINARY_DIR}/include/mlpack/${incl_file} )
endforeach()

# set installation rules for include files
#install(FILES ${CMAKE_BINARY_DIR}/include/mlpack/
#   DESTINATION include/mlpack)

# set installation rules for mlpack programs
#install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/
#   DESTINATION bin)

install(TARGETS mlpack
   RUNTIME DESTINATION bin
   LIBRARY DESTINATION lib
   ARCHIVE DESTINATION lib)

## installation
<commit_msg>AllkFN has not been transitioned to NeighborSearch yet.<commit_after>cmake_minimum_required(VERSION 2.8)
project(MLPACK C CXX)

#find_package(BLAS REQUIRED)
#find_package(LAPACK REQUIRED)

## Global compiler flags (dep. on platform TODO)
#set(CMAKE_CXX_FLAGS "-g -Wall")
add_definitions( -DDISABLE_DISK_MATRIX )

## Location of fastlib headers & lib
set(FASTLIB_BASE_DIR /usr/local CACHE PATH
  "Directory where fastlib is installed." )
set(FASTLIB_LIB_DIR ${FASTLIB_BASE_DIR}/lib )
set(FASTLIB_INCLUDE_DIR ${FASTLIB_BASE_DIR}/include )
# set(FASTLIB_LIB_DIR ${FASTLIB_BASE_DIR}/lib CACHE PATH
#   "Directory where the fastlib library is installed." )
# set(FASTLIB_INCLUDE_DIR ${FASTLIB_BASE_DIR}/include CACHE PATH
#   "Directory where the fastlib headers are installed." )
#     
# mark_as_advanced(FASTLIB_LIB_DIR FASTLIB_INCLUDE_DIR) 

##? add_library ?
find_library(FASTLIB_LIB fastlib ${FASTLIB_LIB_DIR})

## include dirs
include_directories( ${FASTLIB_INCLUDE_DIR} )
include_directories( .. )  # mlpack
include_directories( ../include/ )

## link directories
link_directories( ${FASTLIB_LIB_DIR} )

## standard libs
set(MLPACK_STD_LIBS fastlib lapack blas )  ##! this ordering matters :(

## recurse
set(DIRS
    allkfn
#    allknn
    allnn
#    disk_allnn  # does not compile, perhaps due to an API change
    core
    emst
    fastica
    hmm
    infomax_ica
#    isonmf  ## nothing here yet
    kalman
    kde
#    kernel_pca  # requires sparse 
    #mog # requires optimization
#    mlpackdemo  ## matlab routines
    #mvu # requires optimization
    naive_bayes
    neighbor_search
    nnsvm
    quicsvd
    # range_search  ##! uses contrib code
    regression
    series_expansion
    svm
)

if(WITH_SPARSE)
#   Don't compile this because sparse support in this branch is not really
#   existent
#   set(DIRS ${DIRS} kernel_pca)
endif()

if(WITH_OPTIMIZERS)
#  set(DIRS ${DIRS} mvu)
endif()

foreach(dir ${DIRS})
    add_subdirectory(${dir})
endforeach()

# MLPACK_SRCS is set in the subdirectories
add_library(mlpack ${MLPACK_SRCS})
add_dependencies(mlpack fastlib)
target_link_libraries(mlpack
  fastlib
  armadillo
  lapack
  blas
)

if(WITH_SPARSE)
   target_link_libraries(mlpack
      ${TRILINOS_LIBS}
   )
endif()

# move header files to the right directory
file(GLOB_RECURSE INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
add_custom_command(TARGET mlpack POST_BUILD
   COMMENT "Moving header files to include/mlpack/"
   COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/include/mlpack/)
foreach(incl_file ${INCLUDE_FILES})
   add_custom_command(TARGET mlpack POST_BUILD
      COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${incl_file} ${CMAKE_BINARY_DIR}/include/mlpack/${incl_file} )
endforeach()

# set installation rules for include files
#install(FILES ${CMAKE_BINARY_DIR}/include/mlpack/
#   DESTINATION include/mlpack)

# set installation rules for mlpack programs
#install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/
#   DESTINATION bin)

install(TARGETS mlpack
   RUNTIME DESTINATION bin
   LIBRARY DESTINATION lib
   ARCHIVE DESTINATION lib)

## installation

{'fraction_non_alphanumeric': 0.08943220202670098, 'fraction_numerical': 0.0006433971368827409, 'mean_word_length': 4.72033118675253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5707399', 'n_tokens_mistral': 2296, 'n_tokens_neox': 2181, 'n_words': 517}