Marc Kupietz | a6a81dc | 2024-11-15 16:25:10 +0100 | [diff] [blame^] | 1 | # Only used for JetBrains CLion |
| 2 | |
| 3 | cmake_minimum_required(VERSION 3.9) |
| 4 | project(PerlWithCProject) |
| 5 | |
| 6 | # Add your C files here |
| 7 | set(SOURCE_FILES |
| 8 | lib/IDS/DeReKoVecs/derekovecs-server.c |
| 9 | ) |
| 10 | |
| 11 | set(CMAKE_VERBOSE_MAKEFILE on) |
| 12 | if (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") |
| 14 | else () |
| 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lm -pthread -O3 -march=native -mtune=native -Wall -funroll-loops") |
| 16 | endif () |
| 17 | set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} pthread rt snappy z bz2 lz4 zstd stdc++ dl) |
| 18 | include(GNUInstallDirs) |
| 19 | |
| 20 | # Find the Perl include path dynamically |
| 21 | execute_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 |
| 28 | include_directories(${PERL_INCLUDE_PATH}) |
| 29 | |
| 30 | include_directories(/usr/local/include) |
| 31 | link_directories(/usr/local/lib;/usr/local/lib64) |
| 32 | |
| 33 | find_library(COLLOCATORDB libcollocatordb_static.a REQUIRED) |
| 34 | if (NOT COLLOCATORDB) |
| 35 | message(FATAL_ERROR "No libcollocatordb_static.a found. Please install from https://korap.ids-mannheim.de/gerrit/plugins/gitiles/private/collocatordb") |
| 36 | endif () |
| 37 | |
| 38 | find_library(ROCKSDB librocksdb.a REQUIRED) |
| 39 | if (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") |
| 41 | endif () |
| 42 | |
| 43 | |
| 44 | add_library(my_c_lib ${SOURCE_FILES}) |
| 45 | |
| 46 | # Link any external libraries, if necessary |
| 47 | target_link_libraries(my_c_lib collocatordb) |