-
Notifications
You must be signed in to change notification settings - Fork 136
138 lines (117 loc) · 3.67 KB
/
build-as-subproject.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
129
130
131
132
133
134
135
136
137
138
name: "Build SLEEF as Subproject"
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
GCC_VERSION: "11"
COMMON_CMAKE_FLAGS: >
-DSLEEF_SHOW_CONFIG=ON
-DSLEEF_BUILD_GNUABI_LIBS=ON
-DSLEEF_BUILD_DFT=ON
-DSLEEF_BUILD_SCALAR_LIB=ON
-DSLEEF_BUILD_TESTS=OFF
jobs:
build-nested:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
name: build-nested
steps:
- uses: actions/checkout@v4.1.1
with:
persist-credentials: false
- name: Print host CPU info
run: |
cat /proc/cpuinfo
- name: Install dependencies
run: |
sudo apt update -y -qq
sudo apt install -y -qq build-essential cmake ninja-build gcc-${GCC_VERSION}
- name: Create nested project
shell: bash -ex -o pipefail {0}
run: |
# Create new project
mkdir -p ~/project
# Move examples to root of project
cp docs/src/CMakeLists.txt.nested ~/project/CMakeLists.txt
cp docs/src/hellox86.c docs/src/tutorial.c ~/project/
# Copy SLEEF sources to project
cd .. && cp -r sleef ~/project/
- name: Build nested project
shell: bash -ex -o pipefail {0}
run: |
cd ~/project
# Configure and build project depending on sleef as nested project
cmake -S . -B _build-nested -GNinja \
-DCMAKE_TOOLCHAIN_FILE=$(pwd)/sleef/toolchains/native-gcc.cmake \
${COMMON_CMAKE_FLAGS}
cmake --build _build-nested -j
- name: Run examples
shell: bash -ex -o pipefail {0}
run: |
cd ~/project/_build-nested
./hellox86
./dfttutorial 4
./dfttutorial 4
- name: Upload nested artifacts
uses: actions/upload-artifact@v3
with:
name: nested project
path: |
~/project/_build-nested
if: always()
build-submodule:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
name: build-submodule
steps:
- uses: actions/checkout@v4.1.1
with:
persist-credentials: false
- name: Print host CPU info
run: |
cat /proc/cpuinfo
- name: Install dependencies
run: |
sudo apt update -y -qq
sudo apt install -y -qq build-essential cmake ninja-build gcc-${GCC_VERSION}
- name: Create submodule project
shell: bash -ex -o pipefail {0}
run: |
# Create new project
mkdir -p ~/project
# Move examples to root of project
cp docs/src/CMakeLists.txt ~/project/
cp docs/src/hellox86.c docs/src/tutorial.c ~/project/
# Add some toolchain files
cp -r toolchains ~/project/
- name: Build project with submodule
shell: bash -ex -o pipefail {0}
run: |
cd ~/project
# Configure and build project depending on sleef as submodule
# Options are passed in CMakeLists.txt directly
cmake -S . -B _build-submodule -GNinja \
-DSLEEF_BUILD_DFT_TUTORIAL=ON \
-DCMAKE_TOOLCHAIN_FILE=~/project/toolchains/native-gcc.cmake
cmake --build _build-submodule -j
- name: Run examples
shell: bash -ex -o pipefail {0}
run: |
cd ~/project/_build-submodule
./hellox86
./dfttutorial 4
./dfttutorial 4
- name: Upload submodule artifacts
uses: actions/upload-artifact@v3
with:
name: submodule project
path: |
~/project/_build-submodule
if: always()