-
Notifications
You must be signed in to change notification settings - Fork 276
/
Copy pathCMakeLists.txt
115 lines (102 loc) · 3.87 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") # icc / icpc
# prevent shared libraries from depending on Intel provided libraries
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel")
endif()
# we default on a shared library.
if(ROARING_BUILD_STATIC)
set(ROARING_LIB_TYPE STATIC)
MESSAGE( STATUS "Building a static library." )
else()
MESSAGE( STATUS "Building a dynamic library." )
set(ROARING_LIB_TYPE SHARED)
endif()
MESSAGE( STATUS "ROARING_LIB_TYPE: " ${ROARING_LIB_TYPE})
set(ROARING_SRC
isadetection.c
array_util.c
bitset_util.c
art/art.c
bitset.c
containers/array.c
containers/bitset.c
containers/containers.c
containers/convert.c
containers/mixed_intersection.c
containers/mixed_union.c
containers/mixed_equal.c
containers/mixed_subset.c
containers/mixed_negation.c
containers/mixed_xor.c
containers/mixed_andnot.c
containers/run.c
memory.c
roaring.c
roaring64.c
roaring_priority_queue.c
roaring_array.c)
if(ROARING_BUILD_C_AS_CPP) # more checks and tools, e.g. <type_traits> analysis
SET_SOURCE_FILES_PROPERTIES(${ROARING_SRC} PROPERTIES LANGUAGE CXX)
endif()
add_library(roaring ${ROARING_LIB_TYPE} ${ROARING_SRC})
if(ROARING_DISABLE_AVX512)
target_compile_definitions(roaring PUBLIC CROARING_COMPILER_SUPPORTS_AVX512=0)
endif(ROARING_DISABLE_AVX512)
if(ROARING_DISABLE_AVX)
target_compile_definitions(roaring PUBLIC ROARING_DISABLE_AVX=1)
endif(ROARING_DISABLE_AVX)
if(ROARING_DISABLE_X64)
target_compile_definitions(roaring PUBLIC ROARING_DISABLE_X64=1)
endif(ROARING_DISABLE_X64)
if(ROARING_DISABLE_NEON)
target_compile_definitions(roaring PUBLIC DISABLENEON=1)
endif(ROARING_DISABLE_NEON)
target_link_libraries(roaring PUBLIC roaring-headers)
target_link_libraries(roaring PUBLIC roaring-headers-cpp)
#
#install(TARGETS roaring DESTINATION lib)
#
install(TARGETS roaring
EXPORT roaring-config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(EXPORT roaring-config
FILE roaring-config.cmake
NAMESPACE roaring::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/roaring
)
if(NOT MSVC)
## We output the library at the root of the current directory where cmake is invoked
## This is handy but Visual Studio will happily ignore us
set_target_properties(roaring PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
VERSION ${ROARING_LIB_VERSION}
SOVERSION ${ROARING_LIB_SOVERSION})
MESSAGE( STATUS "Library output directory (does not apply to Visual Studio): " ${CMAKE_BINARY_DIR})
endif()
if(MSVC AND (ROARING_LIB_TYPE STREQUAL "SHARED"))
if (CMAKE_VERSION VERSION_LESS 3.4)
MESSAGE( STATUS "To build a Windows DLL using Visual Studio, you may need cmake 3.4 or better." )
endif()
MESSAGE( STATUS "Building a Windows DLL using Visual Studio, exporting all symbols automatically." )
set_target_properties(roaring
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
endif()
if(ROARING_SANITIZE)
message(STATUS "Enabling address sanitizer")
target_compile_options(roaring PUBLIC -fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
target_compile_definitions(roaring PUBLIC ASAN_OPTIONS=detect_leaks=1)
target_link_libraries(roaring PUBLIC -fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
endif()
if(ROARING_SANITIZE_UNDEFINED)
message(STATUS "Enabling undefined behavior sanitizer")
target_compile_options(roaring PUBLIC -fsanitize=undefined -fno-sanitize-recover=all)
target_link_libraries(roaring PUBLIC -fsanitize=undefined)
endif()
if(ROARING_SANITIZE_THREADS)
message(STATUS "Enabling thread sanitizer")
target_compile_options(roaring PUBLIC -fsanitize=thread -fno-sanitize-recover=all)
target_link_libraries(roaring PUBLIC -fsanitize=thread -fno-sanitize-recover=all)
endif()