Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake build system for valkey #1082

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
81192d4
Change return value of aeTimeProc callback function to long long. (#1…
Shivshankar-Reddy Sep 27, 2024
fc5862c
Fix typo in test_helper.tcl (#1080)
chx9 Sep 28, 2024
4cb85fc
RDMA: Support .is_local method (#1089)
pizhenwei Sep 30, 2024
e978a01
avoid double close on replica main channel (#1097)
ranshid Sep 30, 2024
35692b4
Speed up AOF rewrite test case (#1093)
zuiderkwast Sep 30, 2024
9fa4ef1
Create empty lua tables with specified initial capacity as much as po…
imasahiro Oct 1, 2024
9c07468
Update keyspace notifications link to valkey.io in code comment (#1100)
hwware Oct 1, 2024
673d4c2
Avoid timing issue in diskless-load-swapdb test (#1077)
enjoy-binbin Oct 1, 2024
a106e8a
Rax size tracking (#688)
knggk Oct 2, 2024
3a748a3
Avoid .c, .d and .o files from being copied to the binary tar.gz rele…
melroy89 Oct 2, 2024
a120069
Build binary releases with systemd support (#1107)
melroy89 Oct 2, 2024
245340b
Apply CVE patches for CVE-2024-31449, CVE-2024-31227, CVE-2024-31228 …
madolson Oct 2, 2024
6dce172
Fix undefined-santitizer warning in rax test (#1122)
zuiderkwast Oct 3, 2024
d0fa9ef
Fix some unitialized fields in `client` struct (#1126)
rjd15372 Oct 4, 2024
7df88bc
Include second solo test execution in total test count (#1071)
Shivshankar-Reddy Oct 4, 2024
7eeeb45
Removing Redis from internal lua function names and comments (#1102)
parthpatel Oct 4, 2024
093cf10
Correct the typo in valkey.conf file (#1118)
Shivshankar-Reddy Oct 4, 2024
993e0a6
RDMA: use protected mode for test (#1124)
pizhenwei Oct 4, 2024
024f777
Add tags into .gitignore (#1125)
pizhenwei Oct 5, 2024
71ffb57
Adding the "-j" option in ci make commands to parallelize CI builds (…
Shivshankar-Reddy Oct 6, 2024
aedfb04
Make ./runtest --dump-logs dump logs on crash (#1117)
zuiderkwast Oct 6, 2024
f1fbd7d
Reuse `obey_client` variable in `processCommand()` function (#1101)
otheng03 Oct 6, 2024
219e646
Eliminate hashTypeIterator memory allocation by assigning it on stack…
imasahiro Oct 6, 2024
bd2666c
Removing incorrect comment about a warning (#1132)
madolson Oct 7, 2024
a91f913
fix typo (#1136)
chx9 Oct 8, 2024
8994460
Add server log when module load fails with busy name (#1084)
enjoy-binbin Oct 9, 2024
7f95311
Add flush-before-load option for repl-diskless-load (#909)
kronwerk Oct 9, 2024
2389b2c
Fix empty response for ACL CAT category subcommand for module defined…
roshkhatri Oct 10, 2024
7ea3a97
Add io-threads-do-reads config to deprecated config table to have no …
Shivshankar-Reddy Oct 10, 2024
cfca78a
Fix typo last_procssed -> last_processed (#1142)
enjoy-binbin Oct 10, 2024
c86cdd6
Correct the note details for deprecated config 'io-threads-do-reads' …
Shivshankar-Reddy Oct 12, 2024
b37f749
Move prepareClientToWrite out of loop for HGETALL command (#1119)
imasahiro Oct 12, 2024
f1beadb
Fix aof race in shutdown nosave timedout script test (#1156)
enjoy-binbin Oct 13, 2024
85461b8
Minor comments cleanup around replication.c (#1154)
enjoy-binbin Oct 14, 2024
892fc84
Deflake test Primary COB growth with inactive replica (#1165)
ranshid Oct 14, 2024
41c4a32
Deflake test ync should continue if not all slaves dropped dual-chann…
ranshid Oct 14, 2024
2010f69
Set fail-fast to false in daily CI (#1162)
enjoy-binbin Oct 15, 2024
6a05d59
Use listLast to replace listIndex -1 (#1163)
enjoy-binbin Oct 15, 2024
3967aff
Minor cleanups in acl-v2 tests (#1166)
enjoy-binbin Oct 15, 2024
a05fc0e
Rename z{malloc,calloc,realloc,free} into valkey_{malloc,calloc,reall…
Romain-Geissler-1A Oct 15, 2024
b92675d
Take hz into account in activerehashing to avoid CPU spikes (#977)
enjoy-binbin Oct 15, 2024
881019c
Fix FUNCTION KILL error message being displayed as SCRIPT KILL (#1171)
enjoy-binbin Oct 15, 2024
3357ea3
Refactor return and goto statements (#945)
naglera Oct 15, 2024
1f06a1c
Remove 'posting in the mailing list' in CONTRIBUTING.md (#1174)
Shivshankar-Reddy Oct 15, 2024
2fe7100
Improved hashing algorithm in luaS_newlstr (#1168)
zarkash-aws Oct 15, 2024
5d89211
Add 'WithDictIndex' expiry API and update RANDOMKEY command (#1155)
nadav-levanoni Oct 17, 2024
ebe0943
Remove the restriction that cli --cluster create requires at least 3 …
enjoy-binbin Oct 17, 2024
a4d4870
Fix false sharing issue between main thread and io-threads when acces…
lipzhu Oct 17, 2024
e3d8f94
Introduce connection context for Unix socket (#1160)
pizhenwei Oct 19, 2024
748b68d
Fix SORT GET to ignore special pattern # in cluster slot check (#1182)
enjoy-binbin Oct 19, 2024
110d5b9
Added CMake build system
eifrah-aws Oct 20, 2024
f2be60d
Merge branch 'valkey-io:unstable' into cmake
eifrah-aws Oct 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
format:
_help_line_width:
- How wide to allow formatted cmake files
line_width: 120
_help_tab_size:
- How many spaces to tab for indent
tab_size: 4
_help_use_tabchars:
- If true, lines are indented using tab characters (utf-8
- 0x09) instead of <tab_size> space characters (utf-8 0x20).
- In cases where the layout would require a fractional tab
- character, the behavior of the fractional indentation is
- governed by <fractional_tab_policy>
use_tabchars: false
_help_separate_ctrl_name_with_space:
- If true, separate flow control names from their parentheses
- with a space
separate_ctrl_name_with_space: true
_help_min_prefix_chars:
- If the statement spelling length (including space and
- parenthesis) is smaller than this amount, then force reject
- nested layouts.
min_prefix_chars: 4
_help_max_prefix_chars:
- If the statement spelling length (including space and
- parenthesis) is larger than the tab width by more than this
- amount, then force reject un-nested layouts.
max_prefix_chars: 10
_help_max_lines_hwrap:
- If a candidate layout is wrapped horizontally but it exceeds
- this many lines, then reject the layout.
max_lines_hwrap: 2
_help_line_ending:
- What style line endings to use in the output.
line_ending: unix
_help_command_case:
- Format command names consistently as 'lower' or 'upper' case
command_case: canonical
_help_keyword_case:
- Format keywords consistently as 'lower' or 'upper' case
keyword_case: unchanged
_help_always_wrap:
- A list of command names which should always be wrapped
always_wrap: []
_help_enable_sort:
- If true, the argument lists which are known to be sortable
- will be sorted lexicographicall
enable_sort: true
_help_autosort:
- If true, the parsers may infer whether or not an argument
- list is sortable (without annotation).
autosort: false
_help_require_valid_layout:
- By default, if cmake-format cannot successfully fit
- everything into the desired linewidth it will apply the
- last, most agressive attempt that it made. If this flag is
- True, however, cmake-format will print error, exit with non-
- zero status code, and write-out nothing
require_valid_layout: false
_help_layout_passes:
- A dictionary mapping layout nodes to a list of wrap
- decisions. See the documentation for more information.
layout_passes: {}
encode:
_help_emit_byteorder_mark:
- If true, emit the unicode byte-order mark (BOM) at the start
- of the file
emit_byteorder_mark: false
_help_input_encoding:
- Specify the encoding of the input file. Defaults to utf-8
input_encoding: utf-8
_help_output_encoding:
- Specify the encoding of the output file. Defaults to utf-8.
- Note that cmake only claims to support utf-8 so be careful
- when using anything else
output_encoding: utf-8
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.20)

# Must be done first
if (APPLE)
# Force clang compiler on macOS
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_C_COMPILER "/usr/bin/clang")
endif ()

# Options
option(WITH_TLS "Build valkey-server with TLS support" OFF)
option(BUILD_TESTS "Build valkey-unit-tests" OFF)
option(WITH_RDMA "Build valkey-rdma module" OFF)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
project("valkey")

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)

include(ValkeySetup)
add_subdirectory(src)

# Include the packaging module
include(Packaging)

# Clear variables declared on this file from the cache
unset(WITH_TLS CACHE)
unset(BUILD_TESTS CACHE)
unset(WITH_RDMA CACHE)
44 changes: 44 additions & 0 deletions cmake/Modules/Packaging.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
set(CPACK_PACKAGE_NAME "valkey")
set(CPACK_PACKAGE_VERSION_MAJOR 8)
set(CPACK_PACKAGE_VERSION_MINOR 1)
set(CPACK_PACKAGE_VERSION_PATCH 0)
set(CPACK_PACKAGE_CONTACT "maintainers@lists.valkey.io")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Valkey is an open source (BSD) high-performance key/value datastore")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_STRIP_FILES TRUE)

valkey_get_distro_name(DISTRO_NAME)
message(STATUS "Current host distro: ${DISTRO_NAME}")

if (DISTRO_NAME MATCHES ubuntu
OR DISTRO_NAME MATCHES debian
OR DISTRO_NAME MATCHES mint)
message(STATUS "Adding target package for ${DISTRO_NAME}")
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/valkey")
# Debian related parameters
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Valkey contributors")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_GENERATOR "DEB")
endif ()

include(CPack)
unset(DISTRO_NAME CACHE)

# ---------------------------------------------------
# Create a helper script for creating symbolic links
# ---------------------------------------------------
write_file(
${CMAKE_BINARY_DIR}/CreateSymlink.sh
"\
#!/bin/bash \n\
if [ -z \${DESTDIR} ]; then \n\
# Script is called during 'make install' \n\
PREFIX=${CMAKE_INSTALL_PREFIX}/bin \n\
else \n\
# Script is called during 'make package' \n\
PREFIX=\${DESTDIR}${CPACK_PACKAGING_INSTALL_PREFIX}/bin \n\
fi \n\
cd \$PREFIX \n\
ln -sf \$1 \$2")
149 changes: 149 additions & 0 deletions cmake/Modules/SourceFiles.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# -------------------------------------------------
# Define the sources to be built
# -------------------------------------------------

# libvalkeylib.a sources
set(VALKEY_LIB_SRCS
${CMAKE_SOURCE_DIR}/src/threads_mngr.c
${CMAKE_SOURCE_DIR}/src/adlist.c
${CMAKE_SOURCE_DIR}/src/quicklist.c
${CMAKE_SOURCE_DIR}/src/ae.c
${CMAKE_SOURCE_DIR}/src/anet.c
${CMAKE_SOURCE_DIR}/src/dict.c
${CMAKE_SOURCE_DIR}/src/kvstore.c
${CMAKE_SOURCE_DIR}/src/sds.c
${CMAKE_SOURCE_DIR}/src/zmalloc.c
${CMAKE_SOURCE_DIR}/src/lzf_c.c
${CMAKE_SOURCE_DIR}/src/lzf_d.c
${CMAKE_SOURCE_DIR}/src/pqsort.c
${CMAKE_SOURCE_DIR}/src/zipmap.c
${CMAKE_SOURCE_DIR}/src/sha1.c
${CMAKE_SOURCE_DIR}/src/ziplist.c
${CMAKE_SOURCE_DIR}/src/release.c
${CMAKE_SOURCE_DIR}/src/memory_prefetch.c
${CMAKE_SOURCE_DIR}/src/io_threads.c
${CMAKE_SOURCE_DIR}/src/networking.c
${CMAKE_SOURCE_DIR}/src/util.c
${CMAKE_SOURCE_DIR}/src/object.c
${CMAKE_SOURCE_DIR}/src/db.c
${CMAKE_SOURCE_DIR}/src/replication.c
${CMAKE_SOURCE_DIR}/src/rdb.c
${CMAKE_SOURCE_DIR}/src/t_string.c
${CMAKE_SOURCE_DIR}/src/t_list.c
${CMAKE_SOURCE_DIR}/src/t_set.c
${CMAKE_SOURCE_DIR}/src/t_zset.c
${CMAKE_SOURCE_DIR}/src/t_hash.c
${CMAKE_SOURCE_DIR}/src/config.c
${CMAKE_SOURCE_DIR}/src/aof.c
${CMAKE_SOURCE_DIR}/src/pubsub.c
${CMAKE_SOURCE_DIR}/src/multi.c
${CMAKE_SOURCE_DIR}/src/debug.c
${CMAKE_SOURCE_DIR}/src/sort.c
${CMAKE_SOURCE_DIR}/src/intset.c
${CMAKE_SOURCE_DIR}/src/syncio.c
${CMAKE_SOURCE_DIR}/src/cluster.c
${CMAKE_SOURCE_DIR}/src/cluster_legacy.c
${CMAKE_SOURCE_DIR}/src/cluster_slot_stats.c
${CMAKE_SOURCE_DIR}/src/crc16.c
${CMAKE_SOURCE_DIR}/src/endianconv.c
${CMAKE_SOURCE_DIR}/src/slowlog.c
${CMAKE_SOURCE_DIR}/src/eval.c
${CMAKE_SOURCE_DIR}/src/bio.c
${CMAKE_SOURCE_DIR}/src/rio.c
${CMAKE_SOURCE_DIR}/src/rand.c
${CMAKE_SOURCE_DIR}/src/memtest.c
${CMAKE_SOURCE_DIR}/src/syscheck.c
${CMAKE_SOURCE_DIR}/src/crcspeed.c
${CMAKE_SOURCE_DIR}/src/crccombine.c
${CMAKE_SOURCE_DIR}/src/crc64.c
${CMAKE_SOURCE_DIR}/src/bitops.c
${CMAKE_SOURCE_DIR}/src/sentinel.c
${CMAKE_SOURCE_DIR}/src/notify.c
${CMAKE_SOURCE_DIR}/src/setproctitle.c
${CMAKE_SOURCE_DIR}/src/blocked.c
${CMAKE_SOURCE_DIR}/src/hyperloglog.c
${CMAKE_SOURCE_DIR}/src/latency.c
${CMAKE_SOURCE_DIR}/src/sparkline.c
${CMAKE_SOURCE_DIR}/src/valkey-check-rdb.c
${CMAKE_SOURCE_DIR}/src/valkey-check-aof.c
${CMAKE_SOURCE_DIR}/src/geo.c
${CMAKE_SOURCE_DIR}/src/lazyfree.c
${CMAKE_SOURCE_DIR}/src/module.c
${CMAKE_SOURCE_DIR}/src/evict.c
${CMAKE_SOURCE_DIR}/src/expire.c
${CMAKE_SOURCE_DIR}/src/geohash.c
${CMAKE_SOURCE_DIR}/src/geohash_helper.c
${CMAKE_SOURCE_DIR}/src/childinfo.c
${CMAKE_SOURCE_DIR}/src/defrag.c
${CMAKE_SOURCE_DIR}/src/siphash.c
${CMAKE_SOURCE_DIR}/src/rax.c
${CMAKE_SOURCE_DIR}/src/t_stream.c
${CMAKE_SOURCE_DIR}/src/listpack.c
${CMAKE_SOURCE_DIR}/src/localtime.c
${CMAKE_SOURCE_DIR}/src/lolwut.c
${CMAKE_SOURCE_DIR}/src/lolwut5.c
${CMAKE_SOURCE_DIR}/src/lolwut6.c
${CMAKE_SOURCE_DIR}/src/acl.c
${CMAKE_SOURCE_DIR}/src/tracking.c
${CMAKE_SOURCE_DIR}/src/socket.c
${CMAKE_SOURCE_DIR}/src/tls.c
${CMAKE_SOURCE_DIR}/src/sha256.c
${CMAKE_SOURCE_DIR}/src/timeout.c
${CMAKE_SOURCE_DIR}/src/setcpuaffinity.c
${CMAKE_SOURCE_DIR}/src/monotonic.c
${CMAKE_SOURCE_DIR}/src/mt19937-64.c
${CMAKE_SOURCE_DIR}/src/resp_parser.c
${CMAKE_SOURCE_DIR}/src/call_reply.c
${CMAKE_SOURCE_DIR}/src/script_lua.c
${CMAKE_SOURCE_DIR}/src/script.c
${CMAKE_SOURCE_DIR}/src/functions.c
${CMAKE_SOURCE_DIR}/src/function_lua.c
${CMAKE_SOURCE_DIR}/src/commands.c
${CMAKE_SOURCE_DIR}/src/strl.c
${CMAKE_SOURCE_DIR}/src/connection.c
${CMAKE_SOURCE_DIR}/src/unix.c
${CMAKE_SOURCE_DIR}/src/logreqres.c)

# valkey-cli
set(VALKEY_CLI_SRCS
${CMAKE_SOURCE_DIR}/src/anet.c
${CMAKE_SOURCE_DIR}/src/adlist.c
${CMAKE_SOURCE_DIR}/src/dict.c
${CMAKE_SOURCE_DIR}/src/valkey-cli.c
${CMAKE_SOURCE_DIR}/src/zmalloc.c
${CMAKE_SOURCE_DIR}/src/release.c
${CMAKE_SOURCE_DIR}/src/ae.c
${CMAKE_SOURCE_DIR}/src/serverassert.c
${CMAKE_SOURCE_DIR}/src/crcspeed.c
${CMAKE_SOURCE_DIR}/src/crccombine.c
${CMAKE_SOURCE_DIR}/src/crc64.c
${CMAKE_SOURCE_DIR}/src/siphash.c
${CMAKE_SOURCE_DIR}/src/crc16.c
${CMAKE_SOURCE_DIR}/src/monotonic.c
${CMAKE_SOURCE_DIR}/src/cli_common.c
${CMAKE_SOURCE_DIR}/src/mt19937-64.c
${CMAKE_SOURCE_DIR}/src/strl.c
${CMAKE_SOURCE_DIR}/src/cli_commands.c)

# valkey-benchmark
set(VALKEY_BENCHMARK_SRCS
${CMAKE_SOURCE_DIR}/src/ae.c
${CMAKE_SOURCE_DIR}/src/anet.c
${CMAKE_SOURCE_DIR}/src/valkey-benchmark.c
${CMAKE_SOURCE_DIR}/src/adlist.c
${CMAKE_SOURCE_DIR}/src/dict.c
${CMAKE_SOURCE_DIR}/src/zmalloc.c
${CMAKE_SOURCE_DIR}/src/serverassert.c
${CMAKE_SOURCE_DIR}/src/release.c
${CMAKE_SOURCE_DIR}/src/crcspeed.c
${CMAKE_SOURCE_DIR}/src/crccombine.c
${CMAKE_SOURCE_DIR}/src/crc64.c
${CMAKE_SOURCE_DIR}/src/siphash.c
${CMAKE_SOURCE_DIR}/src/crc16.c
${CMAKE_SOURCE_DIR}/src/monotonic.c
${CMAKE_SOURCE_DIR}/src/cli_common.c
${CMAKE_SOURCE_DIR}/src/mt19937-64.c
${CMAKE_SOURCE_DIR}/src/strl.c)

# valkey-rdmo module
set(VALKEY_RDMA_MODULE_SRCS ${CMAKE_SOURCE_DIR}/src/rdma.c)
Loading
Loading