1
0
mirror of https://github.com/google/leveldb.git synced 2025-04-15 13:20:37 +08:00

Reuse leveldb version define.

This commit is contained in:
Denley Hsiao 2021-09-18 11:16:37 +08:00
parent c5d5174a66
commit 1b172eb293
4 changed files with 23 additions and 3 deletions

2
.gitignore vendored
View File

@ -6,3 +6,5 @@
# Build directory.
build/
out/
version_config.h

View File

@ -98,6 +98,10 @@ int main() { std::string str; return 0; }
set(LEVELDB_PUBLIC_INCLUDE_DIR "include/leveldb")
set(LEVELDB_PORT_CONFIG_DIR "include/port")
configure_file(
"version_config.h.in"
"${PROJECT_SOURCE_DIR}/${LEVELDB_PUBLIC_INCLUDE_DIR}/version_config.h"
)
configure_file(
"port/port_config.h.in"
"${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
@ -206,6 +210,7 @@ target_sources(leveldb
"${LEVELDB_PUBLIC_INCLUDE_DIR}/status.h"
"${LEVELDB_PUBLIC_INCLUDE_DIR}/table_builder.h"
"${LEVELDB_PUBLIC_INCLUDE_DIR}/table.h"
"${LEVELDB_PUBLIC_INCLUDE_DIR}/version_config.h"
"${LEVELDB_PUBLIC_INCLUDE_DIR}/write_batch.h"
)

View File

@ -11,12 +11,12 @@
#include "leveldb/export.h"
#include "leveldb/iterator.h"
#include "leveldb/options.h"
#include "leveldb/version_config.h"
namespace leveldb {
// Update CMakeLists.txt if you change these
static const int kMajorVersion = 1;
static const int kMinorVersion = 23;
static const int kMajorVersion = LEVELDB_VERSION_MAJOR;
static const int kMinorVersion = LEVELDB_VERSION_MINOR;
struct Options;
struct ReadOptions;

13
version_config.h.in Normal file
View File

@ -0,0 +1,13 @@
// Copyright 2017 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef STORAGE_LEVELDB_VERSION_CONFIG_H_
#define STORAGE_LEVELDB_VERSION_CONFIG_H_
#define LEVELDB_VERSION "@PROJECT_VERSION@"
#define LEVELDB_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define LEVELDB_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define LEVELDB_VERSION_PATCH @PROJECT_VERSION_PATCH@
#endif // STORAGE_LEVELDB_VERSION_CONFIG_H_