-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
75 lines (50 loc) · 2.21 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
cmake_minimum_required(VERSION 2.8)
# Name of the project (will be the name of the plugin)
project(poziomka)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_definitions(-fno-builtin-memcmp)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(${PROJECT_NAME} SHARED)
target_sources(${PROJECT_NAME}
PRIVATE
"${PROJECT_SOURCE_DIR}/src/poziomka.cc"
"${PROJECT_SOURCE_DIR}/src/poziomka.h"
"${PROJECT_SOURCE_DIR}/src/slice.h"
"${PROJECT_SOURCE_DIR}/src/workers.cc"
"${PROJECT_SOURCE_DIR}/src/workers.h"
)
# Gives our library file a .node extension without any "lib" prefix
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
# Essential include files to build a node addon,
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_JS_INC})
# Essential library files to link to a node addon
target_link_libraries(
${PROJECT_NAME}
${CMAKE_JS_LIB}
)
# crc32c
set(CRC32C_BUILD_TESTS OFF CACHE BOOL "Build CRC32C's unit tests")
set(CRC32C_BUILD_BENCHMARKS OFF CACHE BOOL "Build CRC32C's benchmarks")
set(CRC32C_USE_GLOG OFF CACHE BOOL "Build CRC32C's tests with Google Logging")
set(CRC32C_INSTALL OFF CACHE BOOL "Install CRC32C's header and library")
set(HAVE_CRC32C ON CACHE BOOL "CRC32C is build here")
add_subdirectory(deps/crc32c)
include_directories(SYSTEM "${PROJECT_SOURCE_DIR}/deps/crc32c/include")
target_link_libraries(${PROJECT_NAME} crc32c)
# crc32c CMake messes up with PROPERTY POSITION_INDEPENDENT_CODE status
set_property(TARGET crc32c_sse42 PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET crc32c_arm64 PROPERTY POSITION_INDEPENDENT_CODE ON)
# snappy
set(SNAPPY_BUILD_TESTS CACHE BOOL "Don not Build Snappy's own tests.")
set(HAVE_SNAPPY ON CACHE BOOL "snappy is build also")
add_subdirectory(deps/snappy)
include_directories(SYSTEM "${PROJECT_SOURCE_DIR}/deps/snappy")
target_link_libraries(${PROJECT_NAME} snappy)
# leveldb
set(LEVELDB_BUILD_TESTS OFF CACHE BOOL "do not build benchmarks")
set(LEVELDB_BUILD_BENCHMARKS OFF CACHE BOOL "do not build benchmarks")
set(LEVELDB_INSTALL OFF CACHE BOOL "do not install")
add_subdirectory(deps/leveldb)
target_link_libraries(${PROJECT_NAME} leveldb)