blob: 311eaa679f83a7b490c93c57e572b702b1994472 [file] [log] [blame]
Marc Kupietza6a81dc2024-11-15 16:25:10 +01001# Only used for JetBrains CLion
2
3cmake_minimum_required(VERSION 3.9)
4project(PerlWithCProject)
5
6# Add your C files here
7set(SOURCE_FILES
8 lib/IDS/DeReKoVecs/derekovecs-server.c
9)
10
11set(CMAKE_VERBOSE_MAKEFILE on)
12if (CMAKE_BUILD_TYPE MATCHES Debug)
13 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")
14else ()
15 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lm -pthread -O3 -march=native -mtune=native -Wall -funroll-loops")
16endif ()
17set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} pthread rt snappy z bz2 lz4 zstd stdc++ dl)
18include(GNUInstallDirs)
19
20# Find the Perl include path dynamically
21execute_process(
22 COMMAND perl -MConfig -e "print qq(\$Config{archlib}/CORE)"
23 OUTPUT_VARIABLE PERL_INCLUDE_PATH
24 OUTPUT_STRIP_TRAILING_WHITESPACE
25)
26
27# Add the Perl include path to the project include directories
28include_directories(${PERL_INCLUDE_PATH})
29
30include_directories(/usr/local/include)
31link_directories(/usr/local/lib;/usr/local/lib64)
32
33find_library(COLLOCATORDB libcollocatordb_static.a REQUIRED)
34if (NOT COLLOCATORDB)
35 message(FATAL_ERROR "No libcollocatordb_static.a found. Please install from https://korap.ids-mannheim.de/gerrit/plugins/gitiles/private/collocatordb")
36endif ()
37
38find_library(ROCKSDB librocksdb.a REQUIRED)
39if (NOT ROCKSDB)
40 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")
41endif ()
42
43
44add_library(my_c_lib ${SOURCE_FILES})
45
46# Link any external libraries, if necessary
47target_link_libraries(my_c_lib collocatordb)