if(ENABLE_HETERO_GALOIS)
  # for debugging 
  if(CMAKE_BUILD_TYPE MATCHES "Debug")
    add_definitions(-D__GALOIS_CUDA_CHECK_ERROR__)
    set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}; -lineinfo)

    add_definitions(-D__GALOIS_DEBUG_WORKLIST__)
  endif()
endif()

include_directories(../include)
include_directories(${CMAKE_SOURCE_DIR}/libgluon/include)
include_directories(${CMAKE_SOURCE_DIR}/libdist/include)
include_directories(${CMAKE_SOURCE_DIR}/libgalois/include)

function(distApp name)
  app(${name} ${name}/gen.cpp DISTSAFE)
  target_link_libraries(${name} galois_gluon distbench)
  target_include_directories(${name} PUBLIC ${CMAKE_SOURCE_DIR}/libgluon/include)
  #target_compile_definitions(${name} PRIVATE MORE_COMM_STATS=1)

  if(ENABLE_HETERO_GALOIS)
    target_compile_definitions(${name} PRIVATE __GALOIS_HET_CUDA__=1)
    target_link_libraries(${name} ${name}_cuda distbench)
    cuda_add_library(${name}_cuda ${name}/gen_cuda.cu)
    target_include_directories(${name}_cuda PUBLIC ${CMAKE_SOURCE_DIR}/libgluon/include)
    target_link_libraries(${name}_cuda ggrt distbench)
  endif()
endfunction()

distApp(bfs_push_lb)
distApp(cc_push_lb)
distApp(sssp_push_lb)

#distAppNoGPU(bfs_do)
#distApp(bfs_push_wl)
#distApp(sssp_push_wl)
#distApp(pagerank_push_wl)
#distApp(bfs_push_od)
#distApp(pagerank_pull_od)
#distAppNoGPU(bc_pull)
#distAppNoGPU(sgd_pull)

distAppNoGPU(pr_bc)
distAppNoGPU(pr_bc_v2)
distAppNoGPU(pr_bc_opt)
distAppNoGPU(pr_bc_opt_v3)
distAppNoGPU(pr_bc_opt_v4)
distAppNoGPU(pr_bc_opt_v5)
distAppNoGPU(pr_bc_opt_v6)
distAppNoGPU(pr_bc_opt_v7)
distAppNoGPU(pr_bc_opt_v8)
distAppNoGPU(pr_bc_opt_v9)

distAppNoGPU(debug_bc_level)

distAppNoGPU(vector_map_micro)

# inefficient version of prbc where entire vector is synchronized
#app(pr_bc_vecsync pr_bc/gen.cpp DISTSAFE)
#target_link_libraries(pr_bc_vecsync distbench)
#target_include_directories(pr_bc_vecsync PUBLIC ${CMAKE_SOURCE_DIR}/libgluon/include)
#target_compile_definitions(pr_bc_vecsync PRIVATE _VECTOR_SYNC_)
#if(USE_BARE_MPI)
#  target_compile_definitions(pr_bc_vecsync PRIVATE __GALOIS_BARE_MPI_COMMUNICATION__=1)
#endif()

# Various tools (TODO move to a tools directory or get rid of some)
distAppNoGPU(findhighdegree)
distAppNoGPU(print_nodes_with_edges)
distAppNoGPU(plain_reader)
distAppNoGPU(threaded_reader)
#distAppNoGPU(graph_reader)
#distAppNoGPU(toy_read)
#distAppNoGPU(toyinspect)
#distAppNoGPU(transposecheck)
#distAppNoGPU(weightcheck)
#distAppNoGPU(samenesscheck)
