-
Notifications
You must be signed in to change notification settings - Fork 8
119 lines (108 loc) · 4.13 KB
/
cmake.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
name: Generate Native Libs
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
BUILD_TYPE: Release
jobs:
build:
name: Build Platform Specific Native Libs
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x86_64]
include:
- os: windows-latest
preset: npitaya-default
cmake_path: build/_builds
cppstd: "17"
- os: ubuntu-latest
preset: npitaya-release
cmake_path: build/_builds/Release
cppstd: gnu17
- os: macos-latest
preset: npitaya-release
cmake_path: build/_builds/Release
arch: x86_64
cppstd: gnu17
- os: macos-latest
preset: npitaya-release
cmake_path: build/_builds/Release
arch: armv8
cppstd: gnu17
runs-on: ${{ matrix.os }}
steps:
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
env:
PIP_BREAK_SYSTEM_PACKAGES: 1
- name: Update conan profile
run: conan profile detect
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Using the builtin GitHub Cache Action for .conan
id: cache-conan-restore
uses: actions/cache/restore@v3
env:
cache-name: cache-conan-modules
with:
path: ~/.conan2/
key: ${{ runner.os }}-${{ matrix.arch }}-builder-${{ env.cache-name }}-${{ hashFiles('cpp-lib/conanfile.py') }}
restore-keys: ${{ runner.os }}-${{ matrix.arch }}-builder-${{ env.cache-name }}-
- name: Install Dependencies
run: conan install . -of build -s build_type=${{env.BUILD_TYPE}} -s arch=${{matrix.arch}} -s:b compiler.cppstd=${{ matrix.cppstd }} -s compiler.cppstd=${{ matrix.cppstd }} --build=missing
working-directory: cpp-lib
- name: Configure CMake
run: cmake --preset ${{matrix.preset}} -DBUILD_TESTING=OFF
working-directory: cpp-lib
- name: Build
run: cmake --build ${{matrix.cmake_path}} --config ${{env.BUILD_TYPE}} --target pitaya_cpp
working-directory: cpp-lib
- uses: actions/cache/save@v3
if: always()
env:
cache-name: cache-conan-modules
with:
path: ~/.conan2/
key: ${{ runner.os }}-${{ matrix.arch }}-builder-${{ env.cache-name }}-${{ hashFiles('cpp-lib/conanfile.py') }}
- uses: actions/upload-artifact@v3
with:
name: prebuilt-libs-${{ matrix.os }}-${{ matrix.arch }}
path: |
cpp-lib/build/**/*pitaya_cpp.dll
cpp-lib/build/**/*pitaya_cpp.so
cpp-lib/build/**/*pitaya_cpp.dylib
cpp-lib/build/**/*pitaya_cpp.bundle
consolidate_archive:
name: Consolidate all libs into single package
needs: build
runs-on: macos-latest
steps:
- name: Download platform specific artifacts
uses: actions/download-artifact@v3
with:
path: downloaded-artifacts
- name: Process Libs
run: |
mkdir macos-fat macos-arm64 macos-x86_64 linux-x86_64 windows-x86_64 macos-fat-unity
lipo -create prebuilt-libs-macos-latest-armv8/_builds/Release/libpitaya_cpp.dylib prebuilt-libs-macos-latest-x86_64/_builds/Release/libpitaya_cpp.dylib -output macos-fat/libpitaya_cpp.dylib
cp macos-fat/libpitaya_cpp.dylib macos-fat-unity/libpitaya_cpp.bundle
mv prebuilt-libs-macos-latest-armv8/_builds/Release/libpitaya_cpp.dylib macos-arm64
mv prebuilt-libs-macos-latest-x86_64/_builds/Release/libpitaya_cpp.dylib macos-x86_64
mv prebuilt-libs-ubuntu-latest-x86_64/_builds/Release/libpitaya_cpp.so linux-x86_64
mv prebuilt-libs-windows-latest-x86_64/_builds/Release/pitaya_cpp.dll windows-x86_64/libpitaya_cpp.dll
working-directory: downloaded-artifacts
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: prebuilt-libs-all-archs
path: |
./**/*pitaya_cpp.dll
./**/*pitaya_cpp.so
./**/*pitaya_cpp.dylib
./**/*pitaya_cpp.bundle
working-directory: downloaded-artifacts