Skip to content

Commit 30b3652

Browse files
acceleratedmfontanini
authored andcommitted
auto-gen main header file (#59)
1 parent 8fc6a0f commit 30b3652

File tree

4 files changed

+113
-2
lines changed

4 files changed

+113
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _cppkafka_'s API is simple to use. For example, this code creates a producer tha
2626
into some partition:
2727

2828
```c++
29-
#include <cppkafka/producer.h>
29+
#include <cppkafka/cppkafka.h>
3030

3131
using namespace std;
3232
using namespace cppkafka;

cppkafka.h.in

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2017, Matias Fontanini
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are
7+
* met:
8+
*
9+
* * Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* * Redistributions in binary form must reproduce the above
12+
* copyright notice, this list of conditions and the following disclaimer
13+
* in the documentation and/or other materials provided with the
14+
* distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
*
28+
*/
29+
30+
#ifndef CPPKAFKA_H
31+
#define CPPKAFKA_H
32+
33+
@CPPKAFKA_HEADERS@
34+
35+
#endif

include/cppkafka/CMakeLists.txt

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# Local function to auto-generate main cppkafka.h header file
2+
function(make_cppkafka_header)
3+
set(CPPKAFKA_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/cppkafka.h)
4+
file(GLOB INCLUDE_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h" "utils/*.h")
5+
foreach(header ${INCLUDE_HEADERS})
6+
if (NOT ${header} MATCHES "cppkafka.h")
7+
SET(CPPKAFKA_HEADERS "${CPPKAFKA_HEADERS}#include <cppkafka/${header}>\n")
8+
endif()
9+
endforeach()
10+
11+
#create file from template
12+
configure_file(${PROJECT_SOURCE_DIR}/cppkafka.h.in ${CPPKAFKA_HEADER})
13+
endfunction()
14+
15+
# Run file generation function
16+
make_cppkafka_header()
17+
18+
# Install headers including the auto-generated cppkafka.h
119
file(GLOB INCLUDE_FILES "*.h")
220
file(GLOB UTILS_INCLUDE_FILES "utils/*.h")
321
install(
@@ -9,4 +27,4 @@ install(
927
FILES ${UTILS_INCLUDE_FILES}
1028
DESTINATION include/cppkafka/utils/
1129
COMPONENT Headers
12-
)
30+
)

include/cppkafka/cppkafka.h

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2017, Matias Fontanini
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are
7+
* met:
8+
*
9+
* * Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* * Redistributions in binary form must reproduce the above
12+
* copyright notice, this list of conditions and the following disclaimer
13+
* in the documentation and/or other materials provided with the
14+
* distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
*
28+
*/
29+
30+
#ifndef CPPKAFKA_H
31+
#define CPPKAFKA_H
32+
33+
#include <cppkafka/buffer.h>
34+
#include <cppkafka/clonable_ptr.h>
35+
#include <cppkafka/configuration.h>
36+
#include <cppkafka/configuration_base.h>
37+
#include <cppkafka/configuration_option.h>
38+
#include <cppkafka/consumer.h>
39+
#include <cppkafka/error.h>
40+
#include <cppkafka/exceptions.h>
41+
#include <cppkafka/group_information.h>
42+
#include <cppkafka/kafka_handle_base.h>
43+
#include <cppkafka/macros.h>
44+
#include <cppkafka/message.h>
45+
#include <cppkafka/message_builder.h>
46+
#include <cppkafka/metadata.h>
47+
#include <cppkafka/producer.h>
48+
#include <cppkafka/topic.h>
49+
#include <cppkafka/topic_configuration.h>
50+
#include <cppkafka/topic_partition.h>
51+
#include <cppkafka/topic_partition_list.h>
52+
#include <cppkafka/utils/backoff_committer.h>
53+
#include <cppkafka/utils/backoff_performer.h>
54+
#include <cppkafka/utils/buffered_producer.h>
55+
#include <cppkafka/utils/compacted_topic_processor.h>
56+
#include <cppkafka/utils/consumer_dispatcher.h>
57+
58+
#endif

0 commit comments

Comments
 (0)