Skip to content

Commit

Permalink
Version 4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
greenrobot committed Oct 15, 2024
1 parent da2be14 commit ae135a5
Show file tree
Hide file tree
Showing 34 changed files with 1,398 additions and 61 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
ObjectBox C and C++ API Changelog
=================================

4.0.2 (2024-10-15)
------------------
* Made closing the store more robust; e.g. it waits for ongoing queries and transactions to finish
(please still ensure to clean up properly on your side, this is an additional safety net)
* Made Box API more robust when racing against store closing
* Improved C++ APIs for nearest neighbor search (query building etc.)
* Some minor HNSW performance improvements
* Add "vectorsearch-cities" example

### Sync

* Fixed a serious regression; please update to the latest version asap!
* Added a special compression for tiny transactions
* Embedded clusters (note: the cluster feature may not come with all editions of the library)
* Add FlatBuffers based configuration for Sync Server

4.0.1 (2024-07-17)
------------------
* Query: "visit with score" added, so you can consume vector search results one-by-one with a visitor callback
Expand Down
78 changes: 68 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.5)
# 3.5: Since CMake 3.27 VERSION < 3.5 produce a deprecation warning.

project(ObjectBoxCRoot) # to be displayed in an IDE when this CMake is opened
# This CMake file has the following purposes:
# * Define the ObjectBox library target (target name "objectbox"; or, if the sync variant is used, "objectbox-sync")
# * Fetch (download) the ObjectBoxGenerator CMake
# * Unless this CMake is consumed from a user project, add the sub-projects (tests and examples)
#
# Options are available via plain (not cached) variables that can be declared before fetching this CMake module:
# * ObjectBoxGenerator_CMAKE_DISABLE: set to ON to skip CMake integration of ObjectBox Generator
# * ObjectBoxGenerator_CMAKE_VERSION: override the default version of the ObjectBox Generator CMake.
# Changes the version to be fetched (git tag or branch).

project(ObjectBoxCRoot)

# Remove Warning (as of CMake >= 3.24):
# "The DOWNLOAD_EXTRACT_TIMESTAMP option was not given.."
# We use the new behaviour (file timestamps from downloaded/extracted archives are updated).
if(POLICY CMP0135)
if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
endif ()

if (${CMAKE_VERSION} VERSION_LESS "3.11.0")
message("Please consider upgrading your CMake to a more recent version (v3.11+) to get automatic library download.")
Expand Down Expand Up @@ -39,7 +49,7 @@ else ()

function(defineObjectBoxLib VARIANT)
# Configuration updated for each release
set(DL_VERSION 4.0.1)
set(DL_VERSION 4.0.2)

# Platform detection and other setup
set(DL_URL https://github.com/objectbox/objectbox-c/releases/download)
Expand Down Expand Up @@ -84,8 +94,56 @@ else ()
endif ()
endif ()

# By default we exclude tests and examples.
# If you want to build them please "make" them explicitly by target name (see targets below)
add_subdirectory(src-test EXCLUDE_FROM_ALL) # target: objectbox-c-test
add_subdirectory(src-test-gen EXCLUDE_FROM_ALL) # target: objectbox-c-gen-test
add_subdirectory(examples EXCLUDE_FROM_ALL) # targets: objectbox-c-examples-tasks-{c,cpp-gen,cpp-gen-sync}
# ObjectBoxGenerator CMake Downloader
# -----------------------------------
# Make "FindObjectBoxGenerator" available, which is used to download/find and run the ObjectBox Generator.

if (ObjectBoxGenerator_CMAKE_DISABLE)
message(STATUS "ObjectBox Generator: CMake integration disabled")
else ()
if(NOT DEFINED ObjectBoxGenerator_CMAKE_VERSION OR ObjectBoxGenerator_CMAKE_VERSION STREQUAL "")
# The default version is a specific version that "matches" the ObjectBox library version of this repo.
# Nevertheless, it's often possible to use a newer Generator version as breaking changes are infrequent.
set(ObjectBoxGenerator_CMAKE_VERSION "v4.0.0-beta")
endif ()
set(OBX_GEN_DL_URL https://raw.githubusercontent.com/objectbox/objectbox-generator/${ObjectBoxGenerator_CMAKE_VERSION}/cmake/FindObjectBoxGenerator.cmake)

if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18)
message(STATUS "ObjectBox Generator: fetching version \"${ObjectBoxGenerator_CMAKE_VERSION}\"")
include(FetchContent)
FetchContent_Declare(FindObjectBoxGenerator URL ${OBX_GEN_DL_URL} DOWNLOAD_NO_EXTRACT TRUE)
FetchContent_MakeAvailable(FindObjectBoxGenerator)
set(OBX_GEN_MODULE_DIR ${findobjectboxgenerator_SOURCE_DIR})
else ()
message(STATUS "ObjectBox Generator: fetching version \"${ObjectBoxGenerator_CMAKE_VERSION}\" (using old CMake version)")
set(OBX_GEN_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR}/cmake)
file(MAKE_DIRECTORY ${OBX_GEN_MODULE_DIR})
if (NOT EXISTS ${OBX_GEN_MODULE_DIR}/FindObjectBoxGenerator.cmake)
file(DOWNLOAD ${OBX_GEN_DL_URL} ${OBX_GEN_MODULE_DIR}/FindObjectBoxGenerator.cmake
TLS_VERIFY ON
STATUS DL_STATUS
)
if (NOT DL_STATUS EQUAL 0)
message(WARNING "Downloading FindObjectBoxGenerator.cmake from URL ${DL_URL} failed")
endif ()
endif ()
endif ()

if (EXISTS ${OBX_GEN_MODULE_DIR}/FindObjectBoxGenerator.cmake)
# Enable find_package to locate ObjectBoxGenerator find module.
list(APPEND CMAKE_MODULE_PATH ${OBX_GEN_MODULE_DIR})
get_directory_property(hasParent PARENT_DIRECTORY)
if (hasParent)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
endif ()
endif ()
endif ()


# If this project is top-level, include public tests and examples.
# Otherwise, this CMake file is used from a user project, so we do not want to expose these.
if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
add_subdirectory(src-test) # target: objectbox-c-test
add_subdirectory(src-test-gen) # target: objectbox-c-gen-test
add_subdirectory(examples) # targets: objectbox-c-examples-tasks-{c,cpp-{auto}gen,cpp-gen-sync}
endif ()
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ box.put({.text = "Buy milk"});
See [ObjectBox C and C++ docs](https://cpp.objectbox.io/) for API details.
**Latest version: 4.0.1** (2024-07-17).
**Latest version: 4.0.2** (2024-10-15).
See [changelog](CHANGELOG.md) for more details.
## Table of Contents:
Expand Down
2 changes: 1 addition & 1 deletion download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tty -s || quiet=true

# Note: optional arguments like "--quiet" shifts argument positions in the case block above

version=${1:-4.0.1}
version=${1:-4.0.2}
os=${2:-$(uname)}
arch=${3:-$(uname -m)}
echo "Base config: OS ${os} and architecture ${arch}"
Expand Down
16 changes: 16 additions & 0 deletions doxygen/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
ObjectBox C and C++ API Changelog
=================================

4.0.2 (2024-10-15)
------------------
* Made closing the store more robust; e.g. it waits for ongoing queries and transactions to finish
(please still ensure to clean up properly on your side, this is an additional safety net)
* Made Box API more robust when racing against store closing
* Improved C++ APIs for nearest neighbor search (query building etc.)
* Some minor HNSW performance improvements
* Add "vectorsearch-cities" example

### Sync

* Fixed a serious regression; please update to the latest version asap!
* Added a special compression for tiny transactions
* Embedded clusters (note: the cluster feature may not come with all editions of the library)
* Add FlatBuffers based configuration for Sync Server

4.0.1 (2024-07-17)
------------------
* Query: "visit with score" added, so you can consume vector search results one-by-one with a visitor callback
Expand Down
2 changes: 1 addition & 1 deletion doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "ObjectBox C and C++ API"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "4.0.1"
PROJECT_NUMBER = "4.0.2"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
12 changes: 11 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
add_subdirectory(c-cursor-no-gen)
add_subdirectory(c-gen)
add_subdirectory(cpp-gen)
add_subdirectory(cpp-gen-sync)
add_subdirectory(cpp-gen-sync)

find_package(ObjectBoxGenerator 4.0.0)
# Some platforms such as Linux ARM(64) and Windows ARM(64) are not supported.
# We exclude this example for these cases where the generator was not found.
if (ObjectBoxGenerator_FOUND)
add_subdirectory(cpp-autogen)
else ()
message(WARNING "Did not add all examples, as the ObjectBoxGenerator CMake was not found")
endif ()
add_subdirectory(vectorsearch-cities)
2 changes: 1 addition & 1 deletion examples/c-cursor-no-gen/flatbuffers_common_builder.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef FLATBUFFERS_COMMON_BUILDER_H
#define FLATBUFFERS_COMMON_BUILDER_H

/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */

/* Common FlatBuffers build functionality for C. */

Expand Down
2 changes: 1 addition & 1 deletion examples/c-cursor-no-gen/flatbuffers_common_reader.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef FLATBUFFERS_COMMON_READER_H
#define FLATBUFFERS_COMMON_READER_H

/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */

/* Common FlatBuffers read functionality for C. */

Expand Down
4 changes: 2 additions & 2 deletions examples/c-cursor-no-gen/task_builder.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef TASK_BUILDER_H
#define TASK_BUILDER_H

/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */

#ifndef TASK_READER_H
#include "task_reader.h"
Expand All @@ -14,7 +14,7 @@
#define flatbuffers_identifier 0
#endif
#ifndef flatbuffers_extension
#define flatbuffers_extension ".bin"
#define flatbuffers_extension "bin"
#endif

static const flatbuffers_voffset_t __Task_required[] = { 0 };
Expand Down
11 changes: 7 additions & 4 deletions examples/c-cursor-no-gen/task_reader.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef TASK_READER_H
#define TASK_READER_H

/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */

#ifndef FLATBUFFERS_COMMON_READER_H
#include "flatbuffers_common_reader.h"
Expand All @@ -15,7 +15,7 @@
#define flatbuffers_identifier 0
#endif
#ifndef flatbuffers_extension
#define flatbuffers_extension ".bin"
#define flatbuffers_extension "bin"
#endif


Expand All @@ -24,14 +24,17 @@ typedef struct Task_table *Task_mutable_table_t;
typedef const flatbuffers_uoffset_t *Task_vec_t;
typedef flatbuffers_uoffset_t *Task_mutable_vec_t;
#ifndef Task_file_identifier
#define Task_file_identifier flatbuffers_identifier
#define Task_file_identifier 0
#endif
/* deprecated, use Task_file_identifier */
#ifndef Task_identifier
#define Task_identifier flatbuffers_identifier
#define Task_identifier 0
#endif
#define Task_type_hash ((flatbuffers_thash_t)0x76ef3d8c)
#define Task_type_identifier "\x8c\x3d\xef\x76"
#ifndef Task_file_extension
#define Task_file_extension "bin"
#endif



Expand Down
4 changes: 4 additions & 0 deletions examples/cpp-autogen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.obx.*
objectbox-model.h
objectbox-model.json

16 changes: 16 additions & 0 deletions examples/cpp-autogen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# C++ local-only example using objectbox-generator via cmake
set(PROJECT_NAME objectbox-c-examples-tasks-cpp-autogen)
project(${PROJECT_NAME} CXX)
add_executable(${PROJECT_NAME}
main.cpp
)

# add_obx_schema provided by ObjectBoxGenerator package.
add_obx_schema(TARGET ${PROJECT_NAME} SCHEMA_FILES tasklist.fbs INSOURCE)

set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)
target_link_libraries(${PROJECT_NAME} objectbox)
target_include_directories(${PROJECT_NAME} PRIVATE ../../include ../../external)
32 changes: 32 additions & 0 deletions examples/cpp-autogen/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2018-2020 ObjectBox Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#define OBX_CPP_FILE
#include "tasklist-example-app.hpp"

int main(int argc, char* argv[]) {
// create_obx_model() provided by objectbox-model.h
// obx interface contents provided by objectbox.hpp
obx::Options options(create_obx_model());

if (int err = processArgs(argc, argv, options)) {
return err;
}

obx::Store store(options);
TasklistCmdlineApp app(store);
return app.run();
}
Loading

0 comments on commit ae135a5

Please sign in to comment.