blob: 311eaa679f83a7b490c93c57e572b702b1994472 [file] [log] [blame]
# Only used for JetBrains CLion
cmake_minimum_required(VERSION 3.9)
project(PerlWithCProject)
# Add your C files here
set(SOURCE_FILES
lib/IDS/DeReKoVecs/derekovecs-server.c
)
set(CMAKE_VERBOSE_MAKEFILE on)
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lm -g -O0 -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -Wno-unused-value -Wno-unused-result")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lm -pthread -O3 -march=native -mtune=native -Wall -funroll-loops")
endif ()
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} pthread rt snappy z bz2 lz4 zstd stdc++ dl)
include(GNUInstallDirs)
# Find the Perl include path dynamically
execute_process(
COMMAND perl -MConfig -e "print qq(\$Config{archlib}/CORE)"
OUTPUT_VARIABLE PERL_INCLUDE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Add the Perl include path to the project include directories
include_directories(${PERL_INCLUDE_PATH})
include_directories(/usr/local/include)
link_directories(/usr/local/lib;/usr/local/lib64)
find_library(COLLOCATORDB libcollocatordb_static.a REQUIRED)
if (NOT COLLOCATORDB)
message(FATAL_ERROR "No libcollocatordb_static.a found. Please install from https://korap.ids-mannheim.de/gerrit/plugins/gitiles/private/collocatordb")
endif ()
find_library(ROCKSDB librocksdb.a REQUIRED)
if (NOT ROCKSDB)
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")
endif ()
add_library(my_c_lib ${SOURCE_FILES})
# Link any external libraries, if necessary
target_link_libraries(my_c_lib collocatordb)