blob: 4d52d56e8a9cddc0c3644021f8fd308318cdfec1 [file] [log] [blame]
Marc Kupietzed0bfcf2021-03-14 14:56:15 +01001cmake_minimum_required(VERSION 3.9)
2project(collocatordb VERSION 1.2.0 DESCRIPTION "Storing and retrieving collocation counts based on RocksDB")
3set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-rtti")
4set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
5
6include(GNUInstallDirs)
7include_directories(/usr/local/include)
8find_library(ROCKSDB librocksdb.so.5.11)
9enable_testing()
10add_library(collocatordb SHARED src/collocatordb.cc)
11target_link_libraries(collocatordb pthread rt snappy z bz2 lz4 zstd ${ROCKSDB})
12set_target_properties(collocatordb PROPERTIES
13 VERSION ${PROJECT_VERSION}
14 SOVERSION 1
15 PUBLIC_HEADER src/collocatordb.h)
16
17add_library(collocatordb_static STATIC src/collocatordb.cc)
18target_link_libraries(collocatordb_static pthread rt snappy bz2 lz4 zstd)
19
20add_executable(basic_test tests/basic_test.c tests/acutest.h)
21TARGET_LINK_LIBRARIES(basic_test ${ROCKSDB} collocatordb)
22add_test(BASIC_TEST basic_test)
23
24configure_file(collocatordb.pc.in collocatordb.pc @ONLY)
25target_include_directories(collocatordb PRIVATE .)
26install(TARGETS collocatordb collocatordb_static
27 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
28 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
29install(FILES ${CMAKE_BINARY_DIR}/collocatordb.pc
30 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
31
32# Install library
33install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME})