blob: 205319b211f57339ca0fde787a0b93cfa514cb0a [file] [log] [blame]
Marc Kupietz6afb3522021-03-22 17:22:55 +01001cmake_minimum_required(VERSION 3.9)
2project(dereko2vec VERSION 0.9.0 DESCRIPTION "Fork from wang2vec with extensions for re-training and count based models")
3set(CMAKE_VERBOSE_MAKEFILE on)
4set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lm -pthread -O3 -march=native -mtune=native -Wall -funroll-loops")
5set(ADDITIONAL_LIBS pthread rt snappy z bz2 lz4 zstd stdc++ dl)
6include(GNUInstallDirs)
7
8include_directories(/usr/local/include;/usr/local/kl/include)
9link_directories(/usr/local/kl/lib;/usr/local/lib;/usr/local/lib64)
10
11find_library(COLLOCATORDB libcollocatordb_static.a REQUIRED)
12if (NOT COLLOCATORDB)
13 message(FATAL_ERROR "No libcollocatordb_static.a found. Please install from https://korap.ids-mannheim.de/gerrit/plugins/gitiles/private/collocatordb")
14endif ()
15
16find_library(ROCKSDB librocksdb.a REQUIRED)
17if (NOT ROCKSDB)
18 message(FATAL_ERROR "No librocksdb.a found. Please install like suggested here https://korap.ids-mannheim.de/gerrit/plugins/gitiles/private/collocatordb#install-rocksdb-and-prerequisites")
19endif ()
20
21file(GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/src/*.c)
22foreach (mysourcefile ${APP_SOURCES})
23 # I used a simple string replace, to cut off .cpp.
24 string(REPLACE ".c" "" myname ${mysourcefile})
25 string(REGEX REPLACE ".*/" "" myname ${myname})
26 add_executable(${myname} ${mysourcefile})
27 # Make sure YourLib is linked to each app
28 if (${myname} MATCHES "derek")
29 target_link_libraries(${myname} ${COLLOCATORDB} ${ROCKSDB} ${ADDITIONAL_LIBS})
30 endif ()
31endforeach (mysourcefile ${APP_SOURCES})
Marc Kupietz31e2e312021-03-22 17:22:57 +010032
33enable_testing()
34find_program(BASH_PROGRAM bash)
35if (BASH_PROGRAM)
36 add_test(type-3-test ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test-type-3.sh)
37else ()
38 message(SEND_ERROR "Cannot find bash, needed for testing")
39endif ()