Removed TSan annotations, tuned memory ordering
[libcds.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.12)
2 cmake_policy(SET CMP0016 NEW)
3
4 project(cds)
5
6 set(PROJECT_VERSION 2.1.0)
7
8 # Options
9 option(WITH_TESTS "Build unit tests" OFF)
10
11 find_package(Threads REQUIRED)
12 find_package(Boost COMPONENTS system thread REQUIRED)
13 include_directories(${Boost_INCLUDE_DIRS})
14
15 set(CDS_SHARED_LIBRARY ${PROJECT_NAME})
16 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
17 set(CMAKE_INCLUDE_CURRENT_DIR ON)
18
19 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
20 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
21
22 if (NOT CMAKE_BUILD_TYPE)
23   set(CMAKE_BUILD_TYPE Debug CACHE STRING "Default build type to Debug" FORCE)
24 endif()
25
26 message("Build type -- ${CMAKE_BUILD_TYPE}")
27
28 if(UNIX)
29   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
30 endif()
31
32 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
33
34 include_directories(${CMAKE_SOURCE_DIR})
35
36 # Component names for separate distribution in rpms, debs etc.
37 set(LIBRARIES_COMPONENT lib)
38 set(HEADERS_COMPONENT devel)
39
40 set(SOURCES src/hp_gc.cpp
41             src/init.cpp
42             src/dhp_gc.cpp
43             src/urcu_gp.cpp
44             src/urcu_sh.cpp
45             src/michael_heap.cpp
46             src/topology_hpux.cpp
47             src/topology_linux.cpp
48             src/topology_osx.cpp
49             src/dllmain.cpp)
50
51 add_library(${CDS_SHARED_LIBRARY} SHARED ${SOURCES})
52 target_link_libraries(${CDS_SHARED_LIBRARY} PRIVATE ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
53
54 install(TARGETS ${CDS_SHARED_LIBRARY} DESTINATION lib COMPONENT ${LIBRARIES_COMPONENT})
55 install(DIRECTORY ${CMAKE_SOURCE_DIR}/cds DESTINATION include COMPONENT ${HEADERS_COMPONENT})
56
57 if(WITH_TESTS)
58   enable_testing()
59   add_subdirectory(${CMAKE_SOURCE_DIR}/tests)
60 endif(WITH_TESTS)
61
62 ### FOR PACKAGING in RPM, TGZ...###############################################################################
63 set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
64 set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
65 set(CPACK_PACKAGE_RELEASE 1)
66 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/install/description.txt")
67 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Library of concurrent data structures")
68 set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}")
69 set(DEPLOY_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
70
71 # TGZ specific
72 set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
73
74 # RPM specific
75 set(CPACK_RPM_COMPONENT_INSTALL ON)
76 set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/install/post_install_script.sh")
77 set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/install/post_uninstall_script.sh")
78 #set(CPACK_RPM_CHANGELOG_FILE ${CHANGELOG_INCLUDE})
79 set(CPACK_RPM_PACKAGE_LICENSE GPL)
80 set(CPACK_RPM_PACKAGE_GROUP "System Environment/Base")
81 set(CPACK_RPM_PACKAGE_REQUIRES "boost >= 1.50")
82 set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION ${CPACK_PACKAGING_INSTALL_PREFIX})
83 set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/local)
84
85 # DEB specific
86 set(CPACK_DEBIAN_PACKAGE_DEPENDS "boost (>= 1.50)")
87
88 # Components grouping for Mac OS X and Windows installers
89 set(CPACK_COMPONENT_${LIBRARIES_COMPONENT}_GROUP "Runtime")
90 set(CPACK_COMPONENT_${HEADERS_COMPONENT}_GROUP "Development")
91 set(CPACK_COMPONENT_${LIBRARIES_COMPONENT}_DISPLAY_NAME "Libraries")
92 set(CPACK_COMPONENT_${HEADERS_COMPONENT}_DISPLAY_NAME "C++ Headers")
93
94 set(CPACK_COMPONENT_${HEADERS_COMPONENT}_DEPENDS ${LIBRARIES_COMPONENT})
95
96 set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "All of the tools you'll ever need to develop lock-free oriented software with libcds")
97 set(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "Only libcds library for runtime")
98
99 include(CPack)