forked from eclipse-iceoryx/iceoryx2-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·77 lines (63 loc) · 2.18 KB
/
build.sh
File metadata and controls
executable file
·77 lines (63 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$SCRIPT_DIR/iceoryx2"
echo "======================================"
echo "iceoryx2 C# Bindings Build Script"
echo "======================================"
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Step 1: Build the C FFI library
echo -e "${YELLOW}Step 1: Building iceoryx2 C FFI library...${NC}"
cd "$REPO_ROOT"
if ! cargo build --release --package iceoryx2-ffi-c; then
echo -e "${RED}✗ Failed to build iceoryx2-ffi-c${NC}"
exit 1
fi
echo -e "${GREEN}✓ C FFI library built successfully${NC}"
echo ""
# Step 2: Build the C# library
echo -e "${YELLOW}Step 3: Building C# library...${NC}"
cd "$SCRIPT_DIR"
if ! dotnet build -c Release; then
echo -e "${RED}✗ Failed to build C# library${NC}"
exit 1
fi
echo -e "${GREEN}✓ C# library built successfully${NC}"
echo ""
# Step 3: Run tests
echo -e "${YELLOW}Step 4: Running tests...${NC}"
if dotnet test; then
echo -e "${GREEN}✓ All tests passed${NC}"
else
echo -e "${YELLOW}⚠ Some tests skipped (require native library at runtime)${NC}"
fi
echo ""
echo -e "${GREEN}======================================"
echo "✓ Build completed successfully!"
echo "======================================${NC}"
echo ""
echo "Next steps:"
echo " 1. Copy native library to output directory:"
echo " cp $SCRIPT_DIR/iceoryx2/target/release/libiceoryx2_ffi_c.* $SCRIPT_DIR/bin/Release/net6.0/"
echo ""
echo " 2. Run the example:"
echo " cd $SCRIPT_DIR/examples/PublishSubscribe"
echo " dotnet run publisher # In one terminal"
echo " dotnet run subscriber # In another terminal"
echo ""