Skip to content

Commit e43c0a1

Browse files
committed
Version bump and better instructions.
1 parent 0e27348 commit e43c0a1

File tree

4 files changed

+90
-60
lines changed

4 files changed

+90
-60
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ endif()
1717
set(ROARING_LIB_NAME roaring)
1818
set(PROJECT_VERSION_MAJOR 2)
1919
set(PROJECT_VERSION_MINOR 0)
20-
set(PROJECT_VERSION_PATCH 2)
21-
set(ROARING_LIB_VERSION "2.0.2" CACHE STRING "Roaring library version")
20+
set(PROJECT_VERSION_PATCH 3)
21+
set(ROARING_LIB_VERSION "2.0.3" CACHE STRING "Roaring library version")
2222
set(ROARING_LIB_SOVERSION "13" CACHE STRING "Roaring library soversion")
2323

2424
option(ROARING_EXCEPTIONS "Enable exception-throwing interface" ON)

README.md

Lines changed: 85 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,83 @@ We support big-endian systems such as IBM s390x through emulators---except for
6666
IO serialization which is only supported on little-endian systems (see [issue 423](https://github.com/RoaringBitmap/CRoaring/issues/423)).
6767

6868

69+
# Quick Start
70+
71+
The CRoaring library can be amalgamated into a single source file that makes it easier
72+
for integration into other projects. Moreover, by making it possible to compile
73+
all the critical code into one compilation unit, it can improve the performance. For
74+
the rationale, please see the [SQLite documentation](https://www.sqlite.org/amalgamation.html),
75+
or the corresponding [Wikipedia entry](https://en.wikipedia.org/wiki/Single_Compilation_Unit).
76+
Users who choose this route, do not need to rely on CRoaring's build system (based on CMake).
77+
78+
We offer amalgamated files as part of each release.
79+
80+
Linux or macOS users might follow the following instructions if they have a recent C or C++ compiler installed and a standard utility (`wget`).
81+
82+
83+
1. Pull the library in a directory
84+
```
85+
wget https://github.com/RoaringBitmap/CRoaring/releases/download/v2.0.2/roaring.c
86+
wget https://github.com/RoaringBitmap/CRoaring/releases/download/v2.0.2/roaring.h
87+
wget https://github.com/RoaringBitmap/CRoaring/releases/download/v2.0.2/roaring.hh
88+
```
89+
2. Create a new file named `demo.c` with this content:
90+
```C
91+
#include <stdio.h>
92+
#include <stdlib.h>
93+
#include "roaring.c"
94+
int main() {
95+
roaring_bitmap_t *r1 = roaring_bitmap_create();
96+
for (uint32_t i = 100; i < 1000; i++) roaring_bitmap_add(r1, i);
97+
printf("cardinality = %d\n", (int) roaring_bitmap_get_cardinality(r1));
98+
roaring_bitmap_free(r1);
99+
100+
bitset_t *b = bitset_create();
101+
for (int k = 0; k < 1000; ++k) {
102+
bitset_set(b, 3 * k);
103+
}
104+
printf("%zu \n", bitset_count(b));
105+
bitset_free(b);
106+
return EXIT_SUCCESS;
107+
}
108+
```
109+
2. Create a new file named `demo.cpp` with this content:
110+
```C++
111+
#include <iostream>
112+
#include "roaring.hh"
113+
#include "roaring.c"
114+
int main() {
115+
roaring::Roaring r1;
116+
for (uint32_t i = 100; i < 1000; i++) {
117+
r1.add(i);
118+
}
119+
std::cout << "cardinality = " << r1.cardinality() << std::endl;
120+
121+
roaring::Roaring64Map r2;
122+
for (uint64_t i = 18000000000000000100ull; i < 18000000000000001000ull; i++) {
123+
r2.add(i);
124+
}
125+
std::cout << "cardinality = " << r2.cardinality() << std::endl;
126+
return 0;
127+
}
128+
```
129+
2. Compile
130+
```
131+
cc -o demo demo.c
132+
c++ -std=c++11 -o demopp demo.cpp
133+
```
134+
3. `./demo`
135+
```
136+
cardinality = 900
137+
1000
138+
```
139+
4. `./demopp`
140+
```
141+
cardinality = 900
142+
cardinality = 900
143+
```
144+
145+
69146
# Using as a CMake dependency
70147
71148
If you like CMake, you can just a few lines in you `CMakeLists.txt` file to grab a `CRoaring` release. [See our demonstration for further details](https://github.com/RoaringBitmap/croaring_cmake_demo_single_file).
@@ -103,74 +180,27 @@ target_link_libraries(repro PUBLIC roaring::roaring)
103180
```
104181

105182

106-
# Amalgamation/Unity Build
107-
108-
The CRoaring library can be amalgamated into a single source file that makes it easier
109-
for integration into other projects. Moreover, by making it possible to compile
110-
all the critical code into one compilation unit, it can improve the performance. For
111-
the rationale, please see the SQLite documentation, https://www.sqlite.org/amalgamation.html,
112-
or the corresponding Wikipedia entry (https://en.wikipedia.org/wiki/Single_Compilation_Unit).
113-
Users who choose this route, do not need to rely on CRoaring's build system (based on CMake).
114-
115-
We maintain pre-generated amalgamated files at https://github.com/lemire/CRoaringUnityBuild for your convenience.
183+
# Amalgamating
116184

117185
To generate the amalgamated files yourself, you can invoke a bash script...
118186

119187
```bash
120188
./amalgamation.sh
121189
```
122190

123-
(Bash shells are standard under Linux and macOS. Bash shells are available under Windows as part of the  [GitHub Desktop](https://desktop.github.com/) under the name ``Git Shell``. So if you have cloned the ``CRoaring`` GitHub repository from within the GitHub Desktop, you can right-click on ``CRoaring``, select ``Git Shell`` and then enter the above commands.)
124-
125-
It is not necessary to invoke the script in the CRoaring directory. You can invoke
126-
it from any directory where you want the amalgamation files to be written.
127-
128-
It will generate three files for C users: ``roaring.h``, ``roaring.c`` and ``amalgamation_demo.c``... as well as some brief instructions. The ``amalgamation_demo.c`` file is a short example, whereas ``roaring.h`` and ``roaring.c`` are "amalgamated" files (including all source and header files for the project). This means that you can simply copy the files ``roaring.h`` and ``roaring.c`` into your project and be ready to go! No need to produce a library! See the ``amalgamation_demo.c`` file.
191+
If you prefer a silent output, you can use the following command to redirect ``stdout`` :
129192

130-
For example, you can use the C code as follows:
131-
```C++
132-
#include <stdio.h>
133-
#include "roaring.c"
134-
int main() {
135-
roaring_bitmap_t *r1 = roaring_bitmap_create();
136-
for (uint32_t i = 100; i < 1000; i++) roaring_bitmap_add(r1, i);
137-
printf("cardinality = %d\n", (int) roaring_bitmap_get_cardinality(r1));
138-
roaring_bitmap_free(r1);
139-
return 0;
140-
}
193+
```bash
194+
./amalgamation.sh > /dev/null
141195
```
142196

143-
The script will also generate C++ files for C++ users, including an example. You can use the C++ as follows.
144-
145-
```C++
146-
#include <iostream>
147-
148-
#include "roaring.hh"
149-
#include "roaring64map.hh"
150-
151-
using namespace roaring;
152-
int main() {
153-
Roaring r1;
154-
for (uint32_t i = 100; i < 1000; i++) {
155-
r1.add(i);
156-
}
157-
std::cout << "cardinality = " << r1.cardinality() << std::endl;
158197

159-
Roaring64Map r2;
160-
for (uint64_t i = 18000000000000000100ull; i < 18000000000000001000ull;
161-
i++) {
162-
r2.add(i);
163-
}
164-
std::cout << "cardinality = " << r2.cardinality() << std::endl;
165-
return EXIT_SUCCESS;
166-
}
167-
```
198+
(Bash shells are standard under Linux and macOS. Bash shells are available under Windows as part of the  [GitHub Desktop](https://desktop.github.com/) under the name ``Git Shell``. So if you have cloned the ``CRoaring`` GitHub repository from within the GitHub Desktop, you can right-click on ``CRoaring``, select ``Git Shell`` and then enter the above commands.)
168199

169-
If you prefer a silent output, you can use the following command to redirect ``stdout`` :
200+
It is not necessary to invoke the script in the CRoaring directory. You can invoke
201+
it from any directory where you want the amalgamation files to be written.
170202

171-
```bash
172-
./amalgamation.sh > /dev/null
173-
```
203+
It will generate three files for C users: ``roaring.h``, ``roaring.c`` and ``amalgamation_demo.c``... as well as some brief instructions. The ``amalgamation_demo.c`` file is a short example, whereas ``roaring.h`` and ``roaring.c`` are "amalgamated" files (including all source and header files for the project). This means that you can simply copy the files ``roaring.h`` and ``roaring.c`` into your project and be ready to go! No need to produce a library! See the ``amalgamation_demo.c`` file.
174204

175205
# API
176206

doxygen

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "CRoaring"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = "2.0.2"
51+
PROJECT_NUMBER = "2.0.3"
5252

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

include/roaring/roaring_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand
22
#ifndef ROARING_INCLUDE_ROARING_VERSION
33
#define ROARING_INCLUDE_ROARING_VERSION
4-
#define ROARING_VERSION "2.0.2"
4+
#define ROARING_VERSION "2.0.3"
55
enum {
66
ROARING_VERSION_MAJOR = 2,
77
ROARING_VERSION_MINOR = 0,
8-
ROARING_VERSION_REVISION = 2
8+
ROARING_VERSION_REVISION = 3
99
};
1010
#endif // ROARING_INCLUDE_ROARING_VERSION

0 commit comments

Comments
 (0)