Skip to content

Commit e6af9f8

Browse files
committed
conditionally skip avro installation for arm macos
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
1 parent 7396b22 commit e6af9f8

8 files changed

Lines changed: 102 additions & 10 deletions

File tree

.github/workflows/conda.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,25 @@ jobs:
8181
- uses: mamba-org/setup-micromamba@v2
8282
with:
8383
micromamba-version: '2.3.2-0'
84-
environment-file: conda/dev-environment-unix.yml
84+
environment-file: conda/dev-environment-linux.yml
8585
init-shell: >-
8686
bash
8787
cache-environment: true
8888
cache-downloads: true
8989
post-cleanup: 'all'
9090
if: ${{ runner.os != 'Windows' }}
9191

92+
- uses: mamba-org/setup-micromamba@v2
93+
with:
94+
micromamba-version: '2.3.2-0'
95+
environment-file: conda/dev-environment-osx.yml
96+
init-shell: >-
97+
bash
98+
cache-environment: true
99+
cache-downloads: true
100+
post-cleanup: 'all'
101+
if: ${{ runner.os != 'macOS' }}
102+
92103
- uses: mamba-org/setup-micromamba@v2
93104
with:
94105
micromamba-version: '2.3.2-0'

conda/dev-environment-osx.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: csp
2+
channels:
3+
- conda-forge
4+
- nodefaults
5+
dependencies:
6+
- astor
7+
- bison
8+
- brotli
9+
- bump-my-version
10+
- cmake
11+
- codespell>=2.4,<2.5
12+
- compilers
13+
- cyrus-sasl
14+
- deprecated
15+
- docutils<0.22.1
16+
- exprtk
17+
- flex
18+
- graphviz
19+
- gtest
20+
- httpx>=0.20,<1
21+
- libarrow<23
22+
- libboost>=1.80.0
23+
- libboost-headers>=1.80.0
24+
- librdkafka
25+
- lz4-c
26+
- make
27+
- mamba
28+
- mdformat>=0.7.19,<1.1
29+
- mdformat-tables>=1,<1.1
30+
- ninja
31+
- numpy>=2
32+
- pandas
33+
- pillow
34+
- polars
35+
- psutil
36+
- pyarrow>=15,<23
37+
- pydantic>=2
38+
- pytest
39+
- pytest-asyncio
40+
- pytest-cov
41+
- pytest-sugar
42+
- python>=3.10,<3.14
43+
- python-build
44+
- python-graphviz
45+
- python-rapidjson
46+
- pytz
47+
- rapidjson
48+
- requests
49+
- ruamel.yaml
50+
- ruff>=0.9,<0.15
51+
- scikit-build
52+
- setuptools>=69,<74
53+
- sqlalchemy
54+
- tar
55+
- threadpoolctl
56+
- tornado
57+
- twine
58+
- typing-extensions
59+
- unzip
60+
- wheel
61+
- zip
62+
- zlib

cpp/cmake/modules/FindDepsKafkaAdapter.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@ cmake_minimum_required(VERSION 3.7.2)
33
if (CSP_USE_VCPKG)
44
find_package(RdKafka CONFIG REQUIRED)
55
find_package(unofficial-avro-cpp CONFIG REQUIRED)
6+
set(CSP_HAVE_AVRO ON)
67
if(NOT WIN32)
78
# Bad, but a temporary workaround for
89
# https://github.com/microsoft/vcpkg/issues/40320
910
link_directories(${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib)
1011
endif()
1112
else()
1213
find_package(RdKafka REQUIRED)
13-
find_package(Avro REQUIRED)
14+
find_package(Avro QUIET)
15+
if(Avro_FOUND)
16+
set(CSP_HAVE_AVRO ON)
17+
else()
18+
set(CSP_HAVE_AVRO OFF)
19+
message(STATUS "Avro not found - AVRO protocol support will be disabled")
20+
endif()
1421
endif()

cpp/csp/adapters/kafka/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ find_package(DepsKafkaAdapter REQUIRED)
2424

2525
target_link_libraries(csp_kafka_adapter PUBLIC csp_adapter_utils RdKafka::rdkafka RdKafka::rdkafka++)
2626

27-
# Link Avro library - uses different target names for vcpkg vs conda
28-
if(CSP_USE_VCPKG)
29-
target_link_libraries(csp_kafka_adapter PUBLIC unofficial::avro-cpp::avrocpp)
30-
else()
31-
target_link_libraries(csp_kafka_adapter PUBLIC Avro::avrocpp)
27+
# Link Avro library if available
28+
if(CSP_HAVE_AVRO)
29+
target_compile_definitions(csp_kafka_adapter PUBLIC CSP_HAVE_AVRO)
30+
if(CSP_USE_VCPKG)
31+
target_link_libraries(csp_kafka_adapter PUBLIC unofficial::avro-cpp::avrocpp)
32+
else()
33+
target_link_libraries(csp_kafka_adapter PUBLIC Avro::avrocpp)
34+
endif()
3235
endif()
3336

3437
install(TARGETS csp_kafka_adapter

cpp/csp/adapters/kafka/KafkaPublisher.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#include <csp/adapters/kafka/KafkaPublisher.h>
44
#include <csp/adapters/utils/MessageWriter.h>
55
#include <csp/adapters/utils/JSONMessageWriter.h>
6+
#ifdef CSP_HAVE_AVRO
67
#include <csp/adapters/utils/AvroMessageWriter.h>
8+
#endif
79

810
#include <librdkafka/rdkafkacpp.h>
911

@@ -18,8 +20,10 @@ KafkaPublisher::KafkaPublisher( KafkaAdapterManager * mgr, const Dictionary & pr
1820
auto protocol = properties.get<std::string>( "protocol" );
1921
if( protocol == "JSON" )
2022
m_msgWriter = std::make_shared<utils::JSONMessageWriter>( properties );
23+
#ifdef CSP_HAVE_AVRO
2124
else if( protocol == "AVRO" )
2225
m_msgWriter = std::make_shared<utils::AvroMessageWriter>( properties );
26+
#endif
2327
else if( protocol != "RAW_BYTES" )
2428
CSP_THROW( NotImplemented, "msg protocol " << protocol << " not currently supported for kafka output adapters" );
2529
}

cpp/csp/adapters/utils/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
set(ADAPTER_UTILS_PUBLIC_HEADERS
2-
AvroMessageWriter.h
32
JSONMessageStructConverter.h
43
JSONMessageWriter.h
54
MessageEnums.h
@@ -10,6 +9,10 @@ set(ADAPTER_UTILS_PUBLIC_HEADERS
109
ValueDispatcher.h
1110
)
1211

12+
if(CSP_HAVE_AVRO)
13+
list(APPEND ADAPTER_UTILS_PUBLIC_HEADERS AvroMessageWriter.h)
14+
endif()
15+
1316
set(ADAPTER_UTILS_FILES
1417
JSONMessageStructConverter.cpp
1518
MessageWriter.cpp

docs/wiki/dev-guides/Build-CSP-from-Source.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ git submodule update --init --recursive
7575

7676
```bash
7777
# Note the operating system, change as needed
78-
# Linux and MacOS should use the unix dev environment spec
79-
micromamba create -n csp -f conda/dev-environment-unix.yml
78+
# Linux should use the linux dev environment spec
79+
micromamba create -n csp -f conda/dev-environment-linux.yml
80+
# On macOS, use the osx dev environment spec
81+
micromamba create -n csp -f conda/dev-environment-osx.yml
8082

8183
# uncomment below if the build fails because git isn't new enough
8284
#

0 commit comments

Comments
 (0)