Skip to content

Commit 28b009c

Browse files
committed
feat(ci): add macOS ARM build, test and release
- Add build-macos job to build.yml and release.yml (macos-15 ARM) - Use Apple Clang (Xcode 16) for full C++20 ranges support - Update slang submodule to latest for Apple Clang compatibility - macdeployqt on cmake-generated .app bundle, package as DMG - DMG contains QSoC.app (GUI) + standalone qsoc CLI binary - Smoke test with inline-generated CSV bus and Verilog module - Disable mimalloc on macOS (same as Windows) - Set CMAKE_POLICY_VERSION_MINIMUM for yaml-cpp compatibility Signed-off-by: Huang Rui <vowstar@gmail.com>
1 parent 042858c commit 28b009c

File tree

5 files changed

+146
-15
lines changed

5 files changed

+146
-15
lines changed

.github/workflows/build.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,79 @@ jobs:
178178
cd build
179179
ctest -C ${{ env.BUILD_TYPE }} --rerun-failed --output-on-failure -E "test_qsocgui|test_qsocagenttool$|test_qsoccliparsegeneratereportunconnected"
180180
181+
build-macos:
182+
runs-on: macos-15
183+
184+
steps:
185+
- uses: actions/checkout@v4
186+
with:
187+
submodules: recursive
188+
189+
- name: Install Qt
190+
uses: jurplel/install-qt-action@v4
191+
with:
192+
version: ${{ env.QT_VERSION }}
193+
host: 'mac'
194+
target: 'desktop'
195+
arch: 'clang_64'
196+
modules: 'qt5compat'
197+
cache: 'true'
198+
cache-key-prefix: 'install-qt-action-macos'
199+
200+
- name: Install tools
201+
run: brew install ninja pkg-config
202+
203+
- name: Configure CMake (push - no tests)
204+
if: github.event_name == 'push'
205+
run: >-
206+
cmake -B build -G Ninja
207+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
208+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
209+
-DSLANG_USE_MIMALLOC=OFF
210+
-DENABLE_UNIT_TEST=OFF
211+
-DENABLE_CLANG_TIDY=OFF
212+
-DENABLE_DOXYGEN=OFF
213+
214+
- name: Configure CMake (PR - with tests)
215+
if: github.event_name == 'pull_request'
216+
run: >-
217+
cmake -B build -G Ninja
218+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
219+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
220+
-DSLANG_USE_MIMALLOC=OFF
221+
-DENABLE_CLANG_TIDY=OFF
222+
-DENABLE_DOXYGEN=OFF
223+
224+
- name: Build
225+
run: cmake --build build --config ${{ env.BUILD_TYPE }}
226+
227+
- name: Smoke Test
228+
if: github.event_name == 'push'
229+
run: |
230+
set -e
231+
QSOC=./build/qsoc.app/Contents/MacOS/qsoc
232+
TMPD=$(mktemp -d)
233+
trap "rm -rf $TMPD" EXIT
234+
echo "--- version ---"
235+
$QSOC -v
236+
echo "--- help ---"
237+
$QSOC -h | head -3
238+
echo "--- project create ---"
239+
$QSOC project create -d "$TMPD" smoke_test
240+
echo "--- bus import ---"
241+
printf 'Name;Mode;Direction;Width;Qualifier\npclk;slave;in;1;\nprdata;slave;out;32;data\n' > "$TMPD/smoke.csv"
242+
$QSOC bus import -d "$TMPD" -l smoke_lib -b smoke_bus "$TMPD/smoke.csv"
243+
echo "--- module import ---"
244+
printf 'module smoke_mod(input clk, output [7:0] data);\nassign data = 8'\''hFF;\nendmodule\n' > "$TMPD/smoke.v"
245+
$QSOC module import -d "$TMPD" -l smoke_lib "$TMPD/smoke.v"
246+
echo "--- all smoke tests passed ---"
247+
248+
- name: Full Test
249+
if: github.event_name == 'pull_request'
250+
run: |
251+
cd build
252+
QT_QPA_PLATFORM=offscreen ctest -C ${{ env.BUILD_TYPE }} --rerun-failed --output-on-failure
253+
181254
cppcheck:
182255
runs-on: ubuntu-latest
183256

.github/workflows/release.yml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,66 @@ jobs:
201201
name: windows-exe
202202
path: deploy/
203203

204+
build-macos:
205+
runs-on: macos-15
206+
207+
steps:
208+
- uses: actions/checkout@v4
209+
with:
210+
submodules: recursive
211+
212+
- name: Install Qt
213+
uses: jurplel/install-qt-action@v4
214+
with:
215+
version: ${{ env.QT_VERSION }}
216+
host: 'mac'
217+
target: 'desktop'
218+
arch: 'clang_64'
219+
modules: 'qt5compat'
220+
cache: 'true'
221+
cache-key-prefix: 'install-qt-action-macos'
222+
223+
- name: Install tools
224+
run: brew install ninja pkg-config
225+
226+
- name: Configure CMake
227+
run: >-
228+
cmake -B build -G Ninja
229+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
230+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
231+
-DSLANG_USE_MIMALLOC=OFF
232+
-DENABLE_CLANG_TIDY=OFF
233+
-DENABLE_DOXYGEN=OFF
234+
-DENABLE_UNIT_TEST=OFF
235+
236+
- name: Build
237+
run: cmake --build build --config ${{ env.BUILD_TYPE }}
238+
239+
- name: Deploy
240+
run: |
241+
mkdir deploy
242+
cp -a build/qsoc.app deploy/QSoC.app
243+
macdeployqt deploy/QSoC.app -verbose=1
244+
cp deploy/QSoC.app/Contents/MacOS/qsoc deploy/qsoc
245+
246+
- name: Verify deployment
247+
run: |
248+
deploy/qsoc -v
249+
deploy/QSoC.app/Contents/MacOS/qsoc -v
250+
251+
- name: Create DMG
252+
run: |
253+
hdiutil create -volname "QSoC" -srcfolder deploy -ov -format UDZO \
254+
"QSoC-${{ github.ref_name }}-macos-arm64.dmg"
255+
256+
- name: Upload artifact
257+
uses: actions/upload-artifact@v4
258+
with:
259+
name: macos-dmg
260+
path: QSoC-*.dmg
261+
204262
release:
205-
needs: [build-linux, build-windows]
263+
needs: [build-linux, build-windows, build-macos]
206264
runs-on: ubuntu-22.04
207265

208266
steps:
@@ -218,13 +276,15 @@ jobs:
218276
run: |
219277
ls -la linux-appimage/
220278
ls -la QSoC-*-windows-x64.zip
279+
ls -la macos-dmg/
221280
222281
- name: Create Release
223282
uses: softprops/action-gh-release@v2
224283
with:
225284
files: |
226285
linux-appimage/QSoC-*-x86_64.AppImage
227286
QSoC-*-windows-x64.zip
287+
macos-dmg/QSoC-*-macos-arm64.dmg
228288
body: |
229289
**Full Changelog**: https://github.com/${{ github.repository }}/commits/${{ github.ref_name }}
230290
draft: false

external/slang

Submodule slang updated 388 files

src/cli/qsoccliparseagent.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ bool QSocCliWorker::parseAgent(const QStringList &appArguments)
759759
if (checkDoubleInterrupt()) {
760760
escMonitor.stop();
761761
QTextStream(stderr) << "\n" << Qt::flush;
762-
_exit(130);
762+
std::exit(130);
763763
}
764764
agent->abort();
765765
});
@@ -3412,7 +3412,7 @@ bool QSocCliWorker::runAgentLoop(QSocAgent *agent, bool streaming, const QString
34123412
if (checkDoubleInterrupt()) {
34133413
escMonitor.stop();
34143414
compositor.stop();
3415-
_exit(130);
3415+
std::exit(130);
34163416
}
34173417
agent->abort();
34183418
});
@@ -3872,7 +3872,7 @@ bool QSocCliWorker::runAgentLoop(QSocAgent *agent, bool streaming, const QString
38723872
if (checkDoubleInterrupt()) {
38733873
escMonitor.stop();
38743874
compositor.stop();
3875-
_exit(130);
3875+
std::exit(130);
38763876
}
38773877
agent->abort();
38783878
});

src/common/qsocgeneratetemplate.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,14 @@ bool QSocGenerateManager::renderTemplate(
117117
std::string floatBuffer(trimmedView);
118118
std::replace(floatBuffer.begin(), floatBuffer.end(), ',', '.');
119119

120-
double doubleValue{};
121-
auto [doubleParseEnd, doubleParseErr] = std::from_chars(
122-
floatBuffer.data(),
123-
floatBuffer.data() + floatBuffer.size(),
124-
doubleValue);
125-
126-
if (doubleParseErr == std::errc{}
127-
&& doubleParseEnd == floatBuffer.data() + floatBuffer.size()) {
128-
row[colName] = doubleValue;
129-
continue;
120+
try {
121+
size_t pos = 0;
122+
double value = std::stod(floatBuffer, &pos);
123+
if (pos == floatBuffer.size()) {
124+
row[colName] = value;
125+
continue;
126+
}
127+
} catch (...) {
130128
}
131129

132130
/* Parsing failed: keep the original text */

0 commit comments

Comments
 (0)