Marc Kupietz | 6afb352 | 2021-03-22 17:22:55 +0100 | [diff] [blame^] | 1 | cmake_minimum_required(VERSION 3.9) |
| 2 | project(dereko2vec VERSION 0.9.0 DESCRIPTION "Fork from wang2vec with extensions for re-training and count based models") |
| 3 | set(CMAKE_VERBOSE_MAKEFILE on) |
| 4 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lm -pthread -O3 -march=native -mtune=native -Wall -funroll-loops") |
| 5 | set(ADDITIONAL_LIBS pthread rt snappy z bz2 lz4 zstd stdc++ dl) |
| 6 | include(GNUInstallDirs) |
| 7 | |
| 8 | include_directories(/usr/local/include;/usr/local/kl/include) |
| 9 | link_directories(/usr/local/kl/lib;/usr/local/lib;/usr/local/lib64) |
| 10 | |
| 11 | find_library(COLLOCATORDB libcollocatordb_static.a REQUIRED) |
| 12 | if (NOT COLLOCATORDB) |
| 13 | message(FATAL_ERROR "No libcollocatordb_static.a found. Please install from https://korap.ids-mannheim.de/gerrit/plugins/gitiles/private/collocatordb") |
| 14 | endif () |
| 15 | |
| 16 | find_library(ROCKSDB librocksdb.a REQUIRED) |
| 17 | if (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") |
| 19 | endif () |
| 20 | |
| 21 | file(GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/src/*.c) |
| 22 | foreach (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 () |
| 31 | endforeach (mysourcefile ${APP_SOURCES}) |