Fix build stuff

This commit is contained in:
Kao Makino 2019-06-04 17:35:47 -07:00
parent ae0a5388c9
commit 42c14dcdc2
5 changed files with 23 additions and 77 deletions

View File

@ -52,14 +52,30 @@ if(NOT WIN32)
if(OPEN_FOR_IDE)
add_library(fdb_c_performance_test OBJECT test/performance_test.c test/test.h)
add_library(fdb_c_ryw_benchmark OBJECT test/ryw_benchmark.c test/test.h)
add_library(mako OBJECT EXCLUDE_FROM_ALL
test/mako/mako.c
test/mako/mako.h
test/mako/utils.c
test/mako/utils.h
test/mako/zipf.c
test/mako/zipf.h)
else()
add_executable(fdb_c_performance_test test/performance_test.c test/test.h)
add_executable(fdb_c_ryw_benchmark test/ryw_benchmark.c test/test.h)
add_executable(mako EXCLUDE_FROM_ALL
test/mako/mako.c
test/mako/mako.h
test/mako/utils.c
test/mako/utils.h
test/mako/zipf.c
test/mako/zipf.h)
strip_debug_symbols(fdb_c_performance_test)
strip_debug_symbols(fdb_c_ryw_benchmark)
strip_debug_symbols(mako)
endif()
target_link_libraries(fdb_c_performance_test PRIVATE fdb_c)
target_link_libraries(fdb_c_ryw_benchmark PRIVATE fdb_c)
target_link_libraries(mako PRIVATE fdb_c)
endif()
# TODO: re-enable once the old vcxproj-based build system is removed.

View File

@ -1,45 +0,0 @@
cmake_minimum_required(VERSION 3.5)
project(mako)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake")
message (STATUS "${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}")
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are forbidden and unsupported")
endif()
# default to 307
if(NOT FDB_API_VERSION)
message(STATUS "Setting FDB API version to 307")
set(FDB_API_VERSION 307)
endif()
# we don't want rpath to be set
set(CMAKE_SKIP_BUILD_RPATH TRUE)
if(FDB_BUILD_DIR)
set(FDB_LIB_DIR ${FDB_BUILD_DIR}/lib)
if (FDB_SOURCE_DIR)
set(FDB_INCLUDE_DIR ${FDB_SOURCE_DIR}/bindings/c ${FDB_BUILD_DIR}/bindings/c/foundationdb)
endif()
else()
if (APPLE)
set(FDB_LIB_DIR ${FDB_DIR}/usr/local/lib)
set(FDB_INCLUDE_DIR ${FDB_DIR}/usr/local/include)
else()
set(FDB_LIB_DIR ${FDB_DIR}/usr/lib64)
set(FDB_INCLUDE_DIR ${FDB_DIR}/usr/include)
endif()
endif()
link_directories(${FDB_LIB_DIR})
include_directories(${FDB_INCLUDE_DIR})
file(GLOB SOURCES "*.c")
add_executable(mako ${SOURCES})
if(APPLE)
target_link_libraries(mako ${PROJECT_LINK_LIBS} pthread m fdb_c)
else()
target_link_libraries(mako ${PROJECT_LINK_LIBS} pthread rt m fdb_c)
endif()
target_compile_options(mako PUBLIC -g -fPIC -O2 -DFDB_API_VERSION=${FDB_API_VERSION})

View File

@ -1,21 +0,0 @@
default_target: mako
#FDB_API_VERSION=307
#FDBDIR=/home/kmakino/scratch/rpms/3.2.2
FDB_API_VERSION=610
FDBDIR=/home/kmakino/scratch/rpms/6.1.0
INCS = -I. -I$(FDBDIR)/usr/include
CFLAGS = -g -fPIC -O2 $(INCS) -DFDB_API_VERSION=$(FDB_API_VERSION)
LDFLAGS = -L$(FDBDIR)/usr/lib64 -lm -lpthread -lrt -lfdb_c
TARGET = mako
SRCS = mako.c utils.c zipf.c
OBJS := $(SRCS:.c=.o)
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
clean:
$(RM) $(TARGET) $(OBJS)

View File

@ -144,7 +144,6 @@ int populate(FDBTransaction *transaction, mako_args_t *args, int worker_id,
int end = insert_end(args->rows, worker_id, thread_id, args->num_processes,
args->num_threads);
int xacts = 0;
uint64_t latencyus;
keystr = (char *)malloc(sizeof(char) * args->key_length + 1);
if (!keystr)
@ -246,8 +245,8 @@ FDB_FAIL:
int64_t run_op_getreadversion(FDBTransaction *transaction) {
int64_t rv = 0;
FDBFuture *f, *ferr;
fdb_error_t err, err2;
FDBFuture *f;
fdb_error_t err;
FDB_RETRY:
f = fdb_transaction_get_read_version(transaction);
@ -262,11 +261,11 @@ FDB_RETRY:
int run_op_get(FDBTransaction *transaction, char *keystr, char *valstr,
int snapshot) {
FDBFuture *f, *ferr;
FDBFuture *f;
int out_present;
char *val;
int vallen;
fdb_error_t err, err2;
fdb_error_t err;
FDB_RETRY:
f = fdb_transaction_get(transaction, (uint8_t *)keystr, strlen(keystr),
@ -295,7 +294,6 @@ int run_op_getrange(FDBTransaction *transaction, char *keystr, char *keystr2,
FDBKeyValue const *out_kv;
int out_count;
int out_more;
int i;
FDB_RETRY:
f = fdb_transaction_get_range(
@ -735,7 +733,6 @@ int worker_process_main(mako_args_t *args, int worker_id, mako_shmhdr_t *shm) {
#if FDB_API_VERSION < 610
FDBCluster *cluster;
#endif
FDBFuture *f;
process_info_t process;
thread_args_t *thread_args;
int rc;
@ -958,8 +955,6 @@ int init_args(mako_args_t *args) {
/* parse transaction specification */
int parse_transaction(mako_args_t *args, char *optarg) {
char *ptr = optarg;
int len = strlen(optarg);
int i = 0;
int op = 0;
int rangeop = 0;
int num;

View File

@ -2,8 +2,9 @@
#define MAKO_H
#pragma once
//#define FDB_API_VERSION 307
//#define FDB_API_VERSION 610
#ifndef FDB_API_VERSION
#define FDB_API_VERSION 610
#endif
#include <foundationdb/fdb_c.h>
#include <pthread.h>