1CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2PROJECT(phosphor)
3
4INCLUDE(CTest)
5
6IF (${CMAKE_MAJOR_VERSION} GREATER 2)
7    CMAKE_POLICY(SET CMP0042 NEW)
8ENDIF ()
9
10IF(NOT DEFINED COUCHBASE_SERVER_BUILD)
11    INCLUDE(NonServerBuild.cmake)
12ENDIF ()
13
14INCLUDE_DIRECTORIES(BEFORE
15        ${phosphor_SOURCE_DIR}/include
16        ${phosphor_SOURCE_DIR}/src
17        ${phosphor_SOURCE_DIR}/thirdparty/dvyukov/include)
18
19SET(phosphor_HEADER_FILES
20        ${phosphor_SOURCE_DIR}/include/phosphor/category_registry.h
21        ${phosphor_SOURCE_DIR}/include/phosphor/chunk_lock.h
22        ${phosphor_SOURCE_DIR}/include/phosphor/inline_zstring.h
23        ${phosphor_SOURCE_DIR}/include/phosphor/phosphor.h
24        ${phosphor_SOURCE_DIR}/include/phosphor/phosphor-internal.h
25        ${phosphor_SOURCE_DIR}/include/phosphor/relaxed_atomic.h
26        ${phosphor_SOURCE_DIR}/include/phosphor/scoped_event_guard.h
27        ${phosphor_SOURCE_DIR}/include/phosphor/stats_callback.h
28        ${phosphor_SOURCE_DIR}/include/phosphor/trace_argument.h
29        ${phosphor_SOURCE_DIR}/include/phosphor/trace_buffer.h
30        ${phosphor_SOURCE_DIR}/include/phosphor/trace_config.h
31        ${phosphor_SOURCE_DIR}/include/phosphor/trace_context.h
32        ${phosphor_SOURCE_DIR}/include/phosphor/trace_event.h
33        ${phosphor_SOURCE_DIR}/include/phosphor/trace_log.h
34        ${phosphor_SOURCE_DIR}/include/phosphor/tracepoint_info.h
35        ${phosphor_SOURCE_DIR}/include/phosphor/platform/core.h
36        ${phosphor_SOURCE_DIR}/include/phosphor/platform/thread.h
37        ${phosphor_SOURCE_DIR}/include/phosphor/platform/visibility.h
38        ${phosphor_SOURCE_DIR}/include/phosphor/tools/export.h)
39
40SET(phosphor_SOURCE_FILES
41        ${phosphor_SOURCE_DIR}/src/category_registry.cc
42        ${phosphor_SOURCE_DIR}/src/chunk_lock.cc
43        ${phosphor_SOURCE_DIR}/src/trace_buffer.cc
44        ${phosphor_SOURCE_DIR}/src/trace_config.cc
45        ${phosphor_SOURCE_DIR}/src/trace_context.cc
46        ${phosphor_SOURCE_DIR}/src/trace_event.cc
47        ${phosphor_SOURCE_DIR}/src/trace_log.cc
48        ${phosphor_SOURCE_DIR}/src/platform/thread.cc
49        ${phosphor_SOURCE_DIR}/src/tools/export.cc
50        ${phosphor_SOURCE_DIR}/src/utils/memory.cc
51        ${phosphor_SOURCE_DIR}/src/utils/string_utils.cc)
52
53ADD_LIBRARY(phosphor SHARED
54        ${phosphor_HEADER_FILES}
55        ${phosphor_SOURCE_FILES})
56
57INSTALL(TARGETS phosphor
58        RUNTIME DESTINATION bin
59        LIBRARY DESTINATION lib
60        ARCHIVE DESTINATION lib)
61
62SET(PHOSPHOR_LIB phosphor)
63GET_DIRECTORY_PROPERTY(hasParent PARENT_DIRECTORY)
64IF(hasParent)
65    SET(PHOSPHOR_LIB phosphor PARENT_SCOPE)
66ENDIF()
67
68ADD_SUBDIRECTORY(tests)
69
70option(PHOSPHOR_BUILD_EXAMPLES "Enable building the examples" OFF)
71IF(PHOSPHOR_BUILD_EXAMPLES)
72    ADD_SUBDIRECTORY(examples)
73ENDIF ()
74
75ENABLE_CODE_COVERAGE_REPORT()
76