-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (111 loc) · 4.26 KB
/
cmake-multi-platform.yml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: CMake Build
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macos-13 ]
build_type: [ Debug, Release ]
c_compiler: [clang] # [ gcc, clang ]
include:
- os: macos-13
c_compiler: clang
cpp_compiler: clang++
env:
- LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
- CPPFLAGS="-I/usr/local/opt/llvm/include"
- LD_LIBRARY_PATH="/usr/local/opt/llvm/lib"
- DYLD_LIBRARY_PATH="/usr/local/opt/llvm/lib"
# - os: ubuntu-latest
# c_compiler: gcc
# cpp_compiler: g++-13
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++-17
# Don't include the following configurations in the matrix
# exclude:
# - os: macos-13
# c_compiler: clang # LLVM Clang17+ required, and building it from the source will take longer
steps:
# Install dependencies: cmake, ninja, gcc, libgcrypt, openssl, readline, and libsodium
- name: Install Dependencies
if: matrix.os == 'macos-13'
run: |
brew update
brew install llvm cmake ninja gcc libgcrypt openssl@3 readline libsodium
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
# - name: Install Dependencies
# if: matrix.os == 'ubuntu-latest'
# run: |
# wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
# sudo add-apt-repository -y "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
# sudo add-apt-repository -y ppa:ubuntu-toolchain-r/ppa
# sudo apt update
# sudo apt install -y cmake ninja-build gcc-13 g++-13 clang-17 lldb-17 lld-17 libc++-17-dev libc++abi-17-dev \
# libomp-17-dev libgcrypt20 openssl libreadline8 libsodium23 libsodium-dev
- uses: actions/checkout@v4
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
# Build project
- name: Build PrivacyShield
if: matrix.os == 'ubuntu-latest'
run: |
sudo ./scripts/buildscript.sh
# OS=${{ matrix.os }}
# COMMAND="./scripts/install-blake3.sh ${{ matrix.c_compiler }}"
# if [ "$OS" == "macos-13" ]; then
# $COMMAND
# elif [ "$OS" == "ubuntu-latest" ]; then
# sudo $COMMAND
# fi
#
- name: Install Blake3
if: matrix.os == 'macos-13'
run: |
./scripts/install-blake3.sh ${{ matrix.c_compiler }}
- name: Configure CMake
if: matrix.os == 'macos-13'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++
-DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_CXX_FLAGS="-lc++"
-S ${{ github.workspace }} -G Ninja
- name: Build
if: matrix.os == 'macos-13'
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j 4
#
# - name: Test
# working-directory: ${{ steps.strings.outputs.build-output-dir }}
# # Execute tests defined by the CMake configuration
# run: ctest --build-config ${{ matrix.build_type }}
#
- name: Package
if: matrix.os == 'macos-13'
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cpack -G DragNDrop
- name: Package
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
sudo cpack
#
# # Upload the built artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.os }}-${{ matrix.build_type }}"
path: "${{ github.workspace }}/Packages"
overwrite: true
if-no-files-found: 'warn'