Delete JunctionProjectDefs.cmake; simplify AddSample.cmake and move it to samples
[junction.git] / cmake / modules / FindNBDS.cmake
1 include("${TURF_ROOT}/cmake/Macros.cmake")
2
3 find_path(NBDS_ROOT NAMES
4           include/hashtable.h
5           include/map.h
6           include/rcu.h
7           include/common.h
8           PATHS
9           ~/nbds)
10 if(NBDS_ROOT)
11     set(NBDS_FOUND TRUE)
12     set(NBDS_INCLUDE_DIRS ${NBDS_ROOT}/include)
13     GetFilesWithSourceGroups(GLOB_RECURSE NBDS_FILES ${NBDS_ROOT} ${NBDS_ROOT}/include/*
14         ${NBDS_ROOT}/runtime/runtime.c
15         ${NBDS_ROOT}/runtime/rcu.c
16         ${NBDS_ROOT}/runtime/lwt.c
17         ${NBDS_ROOT}/runtime/random.c
18         ${NBDS_ROOT}/datatype/nstring.c
19         ${NBDS_ROOT}/runtime/hazard.c
20         ${NBDS_ROOT}/map/map.c
21         ${NBDS_ROOT}/map/list.c
22         ${NBDS_ROOT}/map/skiplist.c
23         ${NBDS_ROOT}/map/hashtable.c)
24     if(NBDS_USE_TURF_HEAP)
25         add_definitions(-DUSE_SYSTEM_MALLOC=1)
26     else()
27         GetFilesWithSourceGroups(GLOB NBDS_FILES ${NBDS_ROOT} ${NBDS_ROOT}/runtime/mem.c)
28     endif()
29     # FIXME: This is hacky because it relies on inheriting the same include_directories() as Junction
30     add_library(NBDS ${NBDS_FILES})
31     set(NBDS_LIBRARIES NBDS)
32 else()
33     message("Can't find NBDS!")
34     if(NBDS_FIND_REQUIRED)
35         message(FATAL_ERROR "Missing required package NBDS")
36     endif()
37 endif()