Skip to content

Commit cdf35e5

Browse files
committed
Add set-objectbox-c-version.sh and update version to 5.0.0-rc
1 parent f4a15dd commit cdf35e5

File tree

5 files changed

+149
-96
lines changed

5 files changed

+149
-96
lines changed
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
cmake_minimum_required(VERSION 3.14)
2-
3-
project("objectbox-generator-cpp-flat-layout" CXX)
4-
5-
include(FetchContent)
6-
FetchContent_Declare(
7-
objectbox
8-
GIT_REPOSITORY https://github.com/objectbox/objectbox-c.git
9-
GIT_TAG v4.2.0
10-
)
11-
FetchContent_MakeAvailable(objectbox)
12-
13-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake)
14-
set(ObjectBoxGenerator_ROOT ${CMAKE_CURRENT_LIST_DIR}/../..)
15-
find_package(ObjectBoxGenerator 4.0.0 REQUIRED)
16-
17-
add_executable(objectbox-test main.cpp)
18-
target_link_libraries(objectbox-test objectbox)
19-
20-
set_target_properties(objectbox-test PROPERTIES
21-
CXX_STANDARD 14
22-
CXX_STANDARD_REQUIRED YES
23-
)
24-
25-
option(DO_INSOURCE "" FALSE)
26-
27-
if (DO_INSOURCE)
28-
add_obx_schema(
29-
TARGET
30-
objectbox-test
31-
SCHEMA_FILES
32-
task.fbs
33-
INSOURCE
34-
)
35-
else()
36-
add_obx_schema(
37-
TARGET
38-
objectbox-test
39-
SCHEMA_FILES
40-
task.fbs
41-
)
42-
endif()
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project("objectbox-generator-cpp-flat-layout" CXX)
4+
5+
include(FetchContent)
6+
FetchContent_Declare(
7+
objectbox
8+
GIT_REPOSITORY https://github.com/objectbox/objectbox-c.git
9+
GIT_TAG v5.0.0-rc
10+
)
11+
FetchContent_MakeAvailable(objectbox)
12+
13+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake)
14+
set(ObjectBoxGenerator_ROOT ${CMAKE_CURRENT_LIST_DIR}/../..)
15+
find_package(ObjectBoxGenerator 4.0.0 REQUIRED)
16+
17+
add_executable(objectbox-test main.cpp)
18+
target_link_libraries(objectbox-test objectbox)
19+
20+
set_target_properties(objectbox-test PROPERTIES
21+
CXX_STANDARD 14
22+
CXX_STANDARD_REQUIRED YES
23+
)
24+
25+
option(DO_INSOURCE "" FALSE)
26+
27+
if (DO_INSOURCE)
28+
add_obx_schema(
29+
TARGET
30+
objectbox-test
31+
SCHEMA_FILES
32+
task.fbs
33+
INSOURCE
34+
)
35+
else()
36+
add_obx_schema(
37+
TARGET
38+
objectbox-test
39+
SCHEMA_FILES
40+
task.fbs
41+
)
42+
endif()

examples/cpp/CMakeLists.txt

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
cmake_minimum_required(VERSION 3.14)
2-
3-
project("objectbox-test" CXX)
4-
5-
include(FetchContent)
6-
FetchContent_Declare(
7-
objectbox
8-
GIT_REPOSITORY https://github.com/objectbox/objectbox-c.git
9-
GIT_TAG v4.2.0
10-
)
11-
FetchContent_MakeAvailable(objectbox)
12-
13-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake)
14-
set(ObjectBoxGenerator_ROOT ${CMAKE_CURRENT_LIST_DIR}/../..)
15-
find_package(ObjectBoxGenerator 4.0.0 REQUIRED)
16-
17-
add_executable("objectbox-test"
18-
"src/main.cpp"
19-
)
20-
target_link_libraries("objectbox-test" objectbox)
21-
22-
set_target_properties("objectbox-test" PROPERTIES
23-
CXX_STANDARD 14
24-
CXX_STANDARD_REQUIRED YES
25-
)
26-
27-
option(DO_INSOURCE "" FALSE)
28-
29-
if (DO_INSOURCE)
30-
add_obx_schema(
31-
TARGET
32-
objectbox-test
33-
SCHEMA_FILES
34-
src/schema/person.fbs
35-
src/schema/task.fbs
36-
src/schema/monster.fbs
37-
src/schema/another_monster.fbs
38-
INSOURCE
39-
CXX_STANDARD 14
40-
)
41-
target_include_directories(objectbox-test PRIVATE src/schema)
42-
else()
43-
add_obx_schema(
44-
TARGET
45-
objectbox-test
46-
SCHEMA_FILES
47-
src/schema/person.fbs
48-
src/schema/task.fbs
49-
src/schema/monster.fbs
50-
src/schema/another_monster.fbs
51-
)
52-
endif()
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project("objectbox-test" CXX)
4+
5+
include(FetchContent)
6+
FetchContent_Declare(
7+
objectbox
8+
GIT_REPOSITORY https://github.com/objectbox/objectbox-c.git
9+
GIT_TAG v5.0.0-rc
10+
)
11+
FetchContent_MakeAvailable(objectbox)
12+
13+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake)
14+
set(ObjectBoxGenerator_ROOT ${CMAKE_CURRENT_LIST_DIR}/../..)
15+
find_package(ObjectBoxGenerator 4.0.0 REQUIRED)
16+
17+
add_executable("objectbox-test"
18+
"src/main.cpp"
19+
)
20+
target_link_libraries("objectbox-test" objectbox)
21+
22+
set_target_properties("objectbox-test" PROPERTIES
23+
CXX_STANDARD 14
24+
CXX_STANDARD_REQUIRED YES
25+
)
26+
27+
option(DO_INSOURCE "" FALSE)
28+
29+
if (DO_INSOURCE)
30+
add_obx_schema(
31+
TARGET
32+
objectbox-test
33+
SCHEMA_FILES
34+
src/schema/person.fbs
35+
src/schema/task.fbs
36+
src/schema/monster.fbs
37+
src/schema/another_monster.fbs
38+
INSOURCE
39+
CXX_STANDARD 14
40+
)
41+
target_include_directories(objectbox-test PRIVATE src/schema)
42+
else()
43+
add_obx_schema(
44+
TARGET
45+
objectbox-test
46+
SCHEMA_FILES
47+
src/schema/person.fbs
48+
src/schema/task.fbs
49+
src/schema/monster.fbs
50+
src/schema/another_monster.fbs
51+
)
52+
endif()

scripts/set-objectbox-c-version.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
# Script to update ObjectBox C version across the project
3+
set -euo pipefail
4+
5+
# macOS does not have realpath and readlink does not have -f option, so do this instead:
6+
script_dir=$( cd "$(dirname "$0")" ; pwd -P )
7+
src_dir="$script_dir/.."
8+
9+
echo "set-objectbox-c-version.sh script dir: $script_dir"
10+
11+
if [[ "$#" -ne "1" ]]; then
12+
echo "usage: $0 <version>"
13+
echo "e.g. $0 4.3.1"
14+
echo " or $0 5.0.0-rc"
15+
exit 1
16+
fi
17+
18+
version=$1
19+
20+
echo "Setting ObjectBox C version: $version"
21+
22+
# align GNU vs BSD `sed` version handling -i argument
23+
if [[ "$OSTYPE" == "darwin"* ]]; then
24+
sed="sed -i ''"
25+
else
26+
sed="sed -i"
27+
fi
28+
29+
function replace() {
30+
file=$1
31+
pattern=$2
32+
33+
# `sed` doesn't fail if the file isn't changed - verify the checksum instead
34+
echo "Updating file $file with pattern $pattern"
35+
checksum=$(sha1sum "$file" 2>/dev/null || shasum -a 1 "$file")
36+
$sed "$pattern" "$file"
37+
38+
new_checksum=$(sha1sum "$file" 2>/dev/null || shasum -a 1 "$file")
39+
if [[ "$checksum" == "$new_checksum" ]]; then
40+
echo "No change to $file - was it already at the intended version? (Otherwise check manually)"
41+
fi
42+
echo ""
43+
}
44+
45+
# Update CMake files with GIT_TAG
46+
replace "$src_dir/examples/cpp/CMakeLists.txt" "s|GIT_TAG[[:space:]]*v[0-9][0-9.rc-]*|GIT_TAG v${version}|g"
47+
replace "$src_dir/examples/cpp-flat-layout/CMakeLists.txt" "s|GIT_TAG[[:space:]]*v[0-9][0-9.rc-]*|GIT_TAG v${version}|g"
48+
replace "$src_dir/test/integration/cmake/projects/common.cmake" "s|GIT_TAG[[:space:]]*v[0-9][0-9.rc-]*|GIT_TAG v${version}|g"
49+
50+
# Update bash script with cVersion variable
51+
replace "$src_dir/third_party/objectbox-c/get-objectbox-c.sh" "s/^cVersion=.*/cVersion=${version}/g"
52+
53+
echo "Version update complete!"

test/integration/cmake/projects/common.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include(FetchContent)
88
FetchContent_Declare(
99
objectbox
1010
GIT_REPOSITORY https://github.com/objectbox/objectbox-c.git
11-
GIT_TAG v4.3.1
11+
GIT_TAG v5.0.0-rc
1212
)
1313
FetchContent_MakeAvailable(objectbox)
1414

third_party/objectbox-c/get-objectbox-c.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
cVersion=4.3.1
4+
cVersion=5.0.0-rc
55

66
scriptDir=$(dirname "${BASH_SOURCE[0]}")
77

0 commit comments

Comments
 (0)