Skip to content

Commit c158262

Browse files
authored
Merge pull request #263 from MrAnno/cmake-and-macos-build-fixes
CMake and macOS build fixes
2 parents dcc38fd + f0bc0ec commit c158262

File tree

8 files changed

+28
-17
lines changed

8 files changed

+28
-17
lines changed

.github/workflows/macos.yml

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
--with-python=3
5959
--with-systemd-journal=no
6060
--disable-smtp
61-
--disable-grpc
6261
--disable-java
6362
--disable-java-modules
6463
--disable-mqtt

CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -377,17 +377,17 @@ endif()
377377

378378
include(add_tests)
379379

380-
# The inclusion of CTest triggers enable_testing()
381-
# CMake will generate tests only if the enable_testing() command has been invoked.
382-
# The CTest module invokes the command automatically when the BUILD_TESTING option is ON.
383-
384380
if (BUILD_TESTING)
385381
if (NOT CRITERION_FOUND)
386382
message(FATAL_ERROR "BUILD_TESTING enabled without criterion detected!")
387383
else()
388384
set(CTEST_ENVIRONMENT
389385
"G_SLICE=always-malloc,debug-blocks"
390386
"G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly")
387+
388+
# The inclusion of CTest triggers enable_testing()
389+
# CMake will generate tests only if the enable_testing() command has been invoked.
390+
# The CTest module invokes the command automatically when the BUILD_TESTING option is ON.
391391
include(CTest)
392392

393393
# This flag might be a security issue, do not use in production code, unfortunately we still need it for criterion tests and the current mocking soution

configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,7 @@ AM_CONDITIONAL([HAVE_FMEMOPEN], [test x$ac_cv_func_fmemopen = xyes])
23012301
AM_CONDITIONAL([HAVE_JAVAH], [test -n "$JAVAH_BIN"])
23022302
AM_CONDITIONAL(ENABLE_IPV6, [test $enable_ipv6 = yes])
23032303

2304+
AM_CONDITIONAL(OS_TYPE_MACOS, [test $ostype = "Darwin"])
23042305

23052306
AC_SUBST(PYTHON_VENV)
23062307
AC_SUBST(PYTHON_VENV_DIR)

contrib/Brewfile

+2
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ brew "python@3", link: true, force: true
2626
brew "rabbitmq-c"
2727
brew "riemann-client"
2828

29+
brew "grpc"
30+
2931
brew "criterion"

libtest/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if (NOT BUILD_TESTING)
2+
return ()
3+
endif ()
4+
15
set(LIBTEST_HEADERS
26
config_parse_lib.h
37
fake-time.h

modules/grpc/otel/tests/Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
if ENABLE_GRPC
22

3+
if ! OS_TYPE_MACOS
34
modules_grpc_otel_tests_TESTS = \
45
modules/grpc/otel/tests/test_otel_protobuf_parser \
56
modules/grpc/otel/tests/test_otel_protobuf_formatter \
67
modules/grpc/otel/tests/test_syslog_ng_otlp \
78
modules/grpc/otel/tests/test_otel_filterx
89

910
check_PROGRAMS += ${modules_grpc_otel_tests_TESTS}
11+
endif
1012

1113
modules_grpc_otel_tests_test_otel_protobuf_parser_SOURCES = \
1214
modules/grpc/otel/tests/test-otel-protobuf-parser.cpp

modules/kafka/CMakeLists.txt

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
find_package(rdkafka 1.1.0)
1+
if (NOT DEFINED ENABLE_KAFKA OR ENABLE_KAFKA)
2+
find_package(rdkafka 1.1.0)
3+
endif ()
24

3-
if (RDKAFKA_FOUND)
4-
option(ENABLE_KAFKA "Enable kafka module" ON)
5-
else()
6-
option(ENABLE_KAFKA "Enable kafka module" OFF)
7-
endif()
5+
module_switch (ENABLE_KAFKA "Enable kafka module" RDKAFKA_FOUND)
86

9-
if (NOT ENABLE_KAFKA)
10-
return()
11-
endif()
7+
if (ENABLE_KAFKA AND NOT RDKAFKA_FOUND)
8+
message (FATAL_ERROR "Kafka enabled but no librdkafka found")
9+
endif ()
1210

13-
if (NOT RDKAFKA_FOUND)
14-
message(FATAL_ERROR "Kafka enabled but no librdkafka found")
11+
if (NOT ENABLE_KAFKA)
12+
return()
1513
endif()
1614

15+
check_symbol_exists (rd_kafka_init_transactions "librdkafka/rdkafka.h" SYSLOG_NG_HAVE_RD_KAFKA_INIT_TRANSACTIONS)
1716

1817
set(CMAKE_REQUIRED_INCLUDES ${RDKAFKA_INCLUDE_DIR})
1918
set(CMAKE_REQUIRED_LIBRARIES ${RDKAFKA_LIBRARY})
20-
check_symbol_exists(rd_kafka_init_transactions "librdkafka/rdkafka.h" SYSLOG_NG_HAVE_RD_KAFKA_INIT_TRANSACTIONS)
2119

2220
set(KAFKA_SOURCES
2321
kafka-parser.c

modules/mqtt/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ if (NOT DEFINED ENABLE_MQTT OR ENABLE_MQTT)
33
endif()
44

55
module_switch(ENABLE_MQTT "Enable mqtt" eclipse-paho-mqtt-c_FOUND)
6+
7+
if (ENABLE_MQTT AND NOT eclipse-paho-mqtt-c_FOUND)
8+
message (FATAL_ERROR "MQTT enabled but no eclipse-paho-mqtt-c library found")
9+
endif ()
10+
611
if (NOT ENABLE_MQTT)
712
return()
813
endif()

0 commit comments

Comments
 (0)