Skip to content

Commit f8c57c9

Browse files
committed
Version 5.0.0-rc
1 parent e39eae4 commit f8c57c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1503
-1063
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ image: objectboxio/cbuild-ubuntu18.04:2023-08-23
22

33
build:
44
stage: build
5-
tags: [x64, docker, linux]
5+
tags: [x64, docker ]
66
script:
77
- ./test.sh

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
ObjectBox C and C++ API Changelog
22
=================================
33

4+
5.0.0-rc (2025-09-30)
5+
------------------
6+
7+
### User-Specific Data Sync
8+
9+
* Sync filters: define server-side filter expression to sync individual data for each sync user.
10+
This is also known as "user-specific data sync" and requires Sync clients version 5.0.
11+
* Client variables: clients may define key/value pairs that can be used in sync filters
12+
13+
### Fixes
14+
15+
* Fixed clearing 1:N backlinks for IDs larger than 32-bit (setting backlink ID to 0 on the "1" side)
16+
* In-memory with WAL file: improved error handling
17+
* Safeguard against undefined behavior by panicking in rare illegal usage patterns that are not recoverable.
18+
I.e. deleting a (write) transaction in a non-owner thread cannot be safely handled in any other way.
19+
20+
### Examples
21+
22+
* Make each example self-contained, you can e.g. copy an example's directory as a starting point for your own app
23+
* Add a convenient `build.sh` script to each example that works the same way across examples,
24+
e.g. `./build.sh run` to build and run the example in one step
25+
* Make sources more readable (refactorings, added additional comments)
26+
427
4.3.1 (2025-07-28)
528
------------------
629
* Cursor/Query: deleting a cursor (e.g. in a non-creator thread) waits for any query to finish

CMakeLists.txt

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
cmake_minimum_required(VERSION 3.5)
2-
# 3.5: Since CMake 3.27 VERSION < 3.5 produce a deprecation warning.
1+
cmake_minimum_required(VERSION 3.5...4.0)
2+
# ^ We likely require a new minimum version soon, as we do not test those ancient CMake versions anymore.
33

44
# This CMake file has the following purposes:
55
# * Define the ObjectBox library target (target name "objectbox"; or, if the sync variant is used, "objectbox-sync")
@@ -28,19 +28,25 @@ if (${CMAKE_VERSION} VERSION_LESS "3.11.0")
2828
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/lib")
2929
else ()
3030
function(defineObjectBoxLibForURL VARIANT DL_URL)
31+
# Fetch (download and un-archive) the ObjectBox library
3132
include(FetchContent)
32-
project(objectbox${VARIANT}-download)
33-
FetchContent_Declare(${PROJECT_NAME} URL ${DL_URL})
34-
35-
FetchContent_Populate(${PROJECT_NAME})
36-
set(DL_DIR "${${PROJECT_NAME}_SOURCE_DIR}")
37-
message(STATUS "Pre-compiled ObjectBox library is saved in ${DL_DIR}")
38-
39-
project(objectbox${VARIANT})
40-
add_library(${PROJECT_NAME} SHARED IMPORTED GLOBAL)
33+
set(_obx_download_name objectbox${VARIANT}-download)
34+
# Note: FetchContent_Populate(URL ${DL_URL}) on Windows CMake 3.31 downloaded to "wrong" dir (leaving out "_deps")
35+
FetchContent_Declare(${_obx_download_name} URL ${DL_URL})
36+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14") # FetchContent_Populate with single param is deprecated
37+
FetchContent_MakeAvailable(${_obx_download_name})
38+
else()
39+
FetchContent_Populate(${_obx_download_name})
40+
endif()
41+
set(DL_DIR "${${_obx_download_name}_SOURCE_DIR}")
42+
message(STATUS "ObjectBox library saved to ${DL_DIR}")
43+
44+
# Create the public imported target with the expected name: objectbox or objectbox-sync
45+
set(_obx_public_target objectbox${VARIANT})
46+
add_library(${_obx_public_target} SHARED IMPORTED GLOBAL)
4147
set(objectbox_include_dirs ${DL_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/external/)
4248
set_target_properties(
43-
${PROJECT_NAME} PROPERTIES
49+
${_obx_public_target} PROPERTIES
4450
IMPORTED_LOCATION ${DL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}
4551
IMPORTED_IMPLIB ${DL_DIR}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}objectbox${CMAKE_IMPORT_LIBRARY_SUFFIX}
4652
INTERFACE_INCLUDE_DIRECTORIES "${objectbox_include_dirs}"
@@ -49,7 +55,7 @@ else ()
4955

5056
function(defineObjectBoxLib VARIANT)
5157
# Configuration updated for each release
52-
set(DL_VERSION 4.3.1)
58+
set(DL_VERSION 5.0.0-rc)
5359

5460
# Platform detection and other setup
5561
set(DL_URL https://github.com/objectbox/objectbox-c/releases/download)
@@ -108,7 +114,7 @@ else ()
108114
endif ()
109115
set(OBX_GEN_DL_URL https://raw.githubusercontent.com/objectbox/objectbox-generator/${ObjectBoxGenerator_CMAKE_VERSION}/cmake/FindObjectBoxGenerator.cmake)
110116

111-
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18)
117+
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18) # 3.18 because DOWNLOAD_NO_EXTRACT
112118
message(STATUS "ObjectBox Generator: fetching version \"${ObjectBoxGenerator_CMAKE_VERSION}\"")
113119
include(FetchContent)
114120
FetchContent_Declare(FindObjectBoxGenerator URL ${OBX_GEN_DL_URL} DOWNLOAD_NO_EXTRACT TRUE)
@@ -140,10 +146,10 @@ else ()
140146
endif ()
141147

142148

143-
# If this project is top-level, include public tests and examples.
149+
# If this project is top-level, include public tests.
144150
# Otherwise, this CMake file is used from a user project, so we do not want to expose these.
145151
if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
146152
add_subdirectory(src-test) # target: objectbox-c-test
147153
add_subdirectory(src-test-gen) # target: objectbox-c-gen-test
148-
add_subdirectory(examples) # targets: objectbox-c-examples-tasks-{c,cpp-{auto}gen,cpp-gen-sync}
154+
# Note: examples are standalone CMake projects, so we do not include them here.
149155
endif ()

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ box.put({.text = "Buy milk"});
1818
1919
See [ObjectBox C and C++ docs](https://cpp.objectbox.io/) for API details.
2020
21-
**Latest version: 4.3.1** (2025-07-28).
21+
**Latest version: 5.0.0-rc** (2025-09-30).
2222
See [changelog](CHANGELOG.md) for more details.
2323
2424
## Table of Contents:
@@ -77,20 +77,14 @@ Head over to [ObjectBox C and C++ installation docs](https://cpp.objectbox.io/in
7777
7878
C++ API
7979
-------
80-
The C++ API is built on top of the C API exposed by the library (e.g. you still need objectbox.h).
81-
You can also use both APIs from your code if necessary.
82-
For example, you use the C++ `obx::Box` class for most database operations, but "break out" into the C API for a special function you need.
80+
The C++ API provides a higher level `class`-based interface built on top of the C API.
81+
A central class is `obx::Box`, which provides most database operations.
8382
Note that to use the `obx::Box` class, you also need the [ObjectBox Generator](https://github.com/objectbox/objectbox-generator) to generate binding code.
8483
Find more details how to use it the [Getting started](https://cpp.objectbox.io/getting-started) section of the docs.
8584
8685
Examples
8786
--------
88-
Have a look at the following TaskList example apps, depending on your programming language and preference:
89-
90-
* [C, cursor, no generated code](examples/c-cursor-no-gen) - plain C; using flatcc directly; without any generated code
91-
* [C, with generated code](examples/c-gen) - plain C, using code generated by `objectbox-generator`
92-
* [C++, with generated code](examples/cpp-gen) - C++, using code generated by `objectbox-generator`
93-
* also includes sync client application example
87+
Check the [examples](examples) directory for self-contained examples that show how to use the C and C++ APIs.
9488
9589
Documentation
9690
-------------

download.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tty -s || quiet=true
4444

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

47-
version=${1:-4.3.1}
47+
version=${1:-5.0.0-rc}
4848
os=${2:-$(uname)}
4949
arch=${3:-$(uname -m)}
5050
echo "Base config: OS ${os} and architecture ${arch}"

doxygen/Changelog.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@
33
ObjectBox C and C++ API Changelog
44
=================================
55

6+
5.0.0-rc (2025-09-30)
7+
------------------
8+
9+
### User-Specific Data Sync
10+
11+
* Sync filters: define server-side filter expression to sync individual data for each sync user.
12+
This is also known as "user-specific data sync" and requires Sync clients version 5.0.
13+
* Client variables: clients may define key/value pairs that can be used in sync filters
14+
15+
### Fixes
16+
17+
* Fixed clearing 1:N backlinks for IDs larger than 32-bit (setting backlink ID to 0 on the "1" side)
18+
* In-memory with WAL file: improved error handling
19+
* Safeguard against undefined behavior by panicking in rare illegal usage patterns that are not recoverable.
20+
I.e. deleting a (write) transaction in a non-owner thread cannot be safely handled in any other way.
21+
22+
### Examples
23+
24+
* Make each example self-contained, you can e.g. copy an example's directory as a starting point for your own app
25+
* Add a convenient `build.sh` script to each example that works the same way across examples,
26+
e.g. `./build.sh run` to build and run the example in one step
27+
* Make sources more readable (refactorings, added additional comments)
28+
629
4.3.1 (2025-07-28)
730
------------------
831
* Cursor/Query: deleting a cursor (e.g. in a non-creator thread) waits for any query to finish

doxygen/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "ObjectBox C and C++ API"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = "4.3.1"
41+
PROJECT_NUMBER = "5.0.0-rc"
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

examples/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
ObjectBox C and C++ examples
2+
============================
3+
4+
These are examples for ObjectBox C and C++.
5+
6+
Each example is self-contained in its own subdirectory and can be built using CMake.
7+
For convenience, a `build.sh` script is provided in each example directory,
8+
which puts all build files into a separate directory ("build/").
9+
See the [build and run](#build-and-run) section below for details.
10+
11+
## Tasks Examples
12+
13+
There are four examples console applications that implement a simple task list.
14+
Tasks can be added, viewed, and marked as finished to demonstrate typical ObjectBox database operations.
15+
16+
The examples for C++ are:
17+
18+
- `tasks`: C++ application
19+
- `tasks-sync`: C++ application with sync enabled (requires a ObjectBox Sync server)
20+
21+
The examples for C are:
22+
23+
- `c-tasks`: C application
24+
- `c-tasks-lowlevel`: C application, but with lesser used lower-level APIs; not the best to start with
25+
26+
## Vector Search Example
27+
28+
There's a C++ example for vector search in the [vectorsearch-cities](vectorsearch-cities/README.md) directory.
29+
30+
## Build and run
31+
32+
Prerequisites are CMake 3.14+ and a C/C++ compiler.
33+
All examples follow the same setup, and thus we document it only once here.
34+
35+
### Build with the provided shell script
36+
37+
This is the simplest way on Linux and macOS from the command line.
38+
39+
* Typically, you `cd` into an example directory and run `./build.sh` (each example has its own `build.sh`).
40+
* Once the build is done, you can run the example: the executable is in the `build/` directory and its path is printed to the console during the build.
41+
* Run `./build.sh run` to build and run the example in one step.
42+
* The `./build.sh` also accepts `--clear` as the first argument to clear the build directory before building.
43+
44+
### Build within IDEs (CMake)
45+
46+
If you work with a IDE, you can typically just open each example as a CMake project.
47+
The IDE will setup everything for you.
48+
49+
### Build with CMake
50+
51+
If you prefer to use CMake directly (e.g. on a Windows terminal), you can do so as follows:
52+
53+
```
54+
cmake -S . -B build
55+
cmake --build build
56+
```
57+
58+
And then run the built executable:
59+
60+
```
61+
build/objectbox-examples-... # replace ... with the example name
62+
```
63+
64+
## Next steps
65+
66+
If you want, you can copy an example as a starting point for your own project.
67+
Pick the directory of the example that fits best for your needs.
68+
69+
Links and documentation:
70+
71+
* [ObjectBox homepage](https://objectbox.io/)
72+
* [ObjectBox C and C++ docs](https://cpp.objectbox.io/)
73+
* [ObjectBox Sync docs](https://sync.objectbox.io/)
74+
* [ObjectBox vector search docs](https://docs.objectbox.io/on-device-vector-search)
75+

examples/c-cursor-no-gen/CMakeLists.txt

Lines changed: 0 additions & 19 deletions
This file was deleted.

examples/c-gen/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)