-
Notifications
You must be signed in to change notification settings - Fork 3
91 lines (88 loc) · 2.46 KB
/
build-dylib.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
name: "Build dylib"
on:
push:
paths:
- "src/**.c"
- "inc/**.h"
- "Makefile"
- ".github/workflows/build-dylib.yml"
pull_request:
branches: [master]
paths:
- "src/**.c"
- "inc/**.h"
- "Makefile"
- ".github/workflows/build-dylib.yml"
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "warning"
jobs:
build-dylib-linux:
strategy:
fail-fast: true
matrix:
platform: [x86, x64]
os: [ubuntu-latest]
runs-on: "${{ matrix.os }}"
name: "Build dylib: ${{ matrix.os }} / ${{ matrix.platform }}"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
# 设置GCC版本
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: latest
platform: "${{ matrix.platform }}"
# 构建 (linux)
- name: Make dylib at ${{ matrix.os }} / ${{ matrix.platform }}
run: |
make dylib
env:
MTFMT_BUILD_C_DEFS: "-D_MSTR_BUILD_DYLIB=1 -D_MSTR_USE_MALLOC=1 -D_MSTR_USE_HARDWARE_DIV=1"
MTFMT_BUILD_USE_LTO: "1"
MTFMT_BUILD_TARGET_NAME: "mtfmt_${{ matrix.platform }}"
# 打包
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dylib-artifact
path: target/*
build-dylib-win:
strategy:
fail-fast: true
matrix:
platform: [x86, x64]
os: [windows-latest]
runs-on: "${{ matrix.os }}"
name: "Build dll: ${{ matrix.os }} / ${{ matrix.platform }}"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install Cygwin
uses: egor-tensin/setup-cygwin@v4
with:
packages: make gcc-g++
- name: Make dll at ${{ matrix.os }} / ${{ matrix.platform }}
run: |
make dylib
env:
MTFMT_BUILD_C_DEFS: "-D_MSTR_BUILD_DLL=1 -D_MSTR_USE_MALLOC=1 -D_MSTR_USE_HARDWARE_DIV=1 -D_MSTR_USE_STD_IO=1"
MTFMT_BUILD_USE_LTO: "1"
MTFMT_BUILD_INC_ADDITIONAL_OUT: "1"
MTFMT_BUILD_TARGET_NAME: "mtfmt_win_${{ matrix.platform }}"
MTFMT_BUILD_LIB_EXT: ".lib"
MTFMT_BUILD_DYLIB_EXT: ".dll"
# 打包
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dll-artifact
path: target/*