Skip to content

Commit f438f68

Browse files
authored
Merge pull request #434 from Tom94/update-libdeflate
Update libdeflate to fix clang build & add clang CI
2 parents 1552c4a + fcd5f91 commit f438f68

6 files changed

Lines changed: 96 additions & 25 deletions

File tree

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ strict_env
22
if [ "$(uname)" = "Linux" ]; then
33
watch_file ./*.nix
44
use flake
5+
# use flake .#clang
56
fi
67

.github/workflows/main.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,46 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818
strategy:
1919
matrix:
20-
os: [ubuntu-24.04, ubuntu-24.04-arm]
20+
include:
21+
- os: ubuntu-24.04
22+
cc: gcc
23+
cxx: g++
24+
upload: true
25+
- os: ubuntu-24.04-arm
26+
cc: gcc
27+
cxx: g++
28+
upload: true
29+
- os: ubuntu-24.04
30+
cc: clang
31+
cxx: clang++
32+
upload: false
33+
- os: ubuntu-24.04-arm
34+
cc: clang
35+
cxx: clang++
36+
upload: false
2137
env:
2238
build_dir: "build"
2339
config: "Release"
24-
CC: gcc
25-
CXX: g++
26-
APPIMAGE_EXTRACT_AND_RUN: 1# https://github.com/AppImage/AppImageKit/wiki/FUSE#docker
40+
CC: ${{ matrix.cc }}
41+
CXX: ${{ matrix.cxx }}
42+
APPIMAGE_EXTRACT_AND_RUN: 1
2743
steps:
2844
- name: Install dependencies
29-
run: sudo apt-get update && sudo apt-get install -y cmake libglu1-mesa-dev xorg-dev libdbus-1-dev libwayland-dev wayland-protocols libxkbcommon-dev libffi-dev nasm ninja-build
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install -y \
48+
cmake \
49+
libc++-dev \
50+
libc++abi-dev \
51+
libdbus-1-dev \
52+
libffi-dev \
53+
libglu1-mesa-dev \
54+
libwayland-dev \
55+
libxkbcommon-dev \
56+
nasm \
57+
ninja-build \
58+
wayland-protocols \
59+
xorg-dev
3060
- uses: actions/checkout@v1
3161
with:
3262
submodules: recursive
@@ -39,10 +69,11 @@ jobs:
3969
working-directory: ${{ env.build_dir }}
4070
run: ./tev --version
4171
- name: Package
72+
if: matrix.upload
4273
working-directory: ${{ env.build_dir }}
4374
run: cmake --build . --config ${{ env.config }} --target package --verbose
4475
- name: Upload executable
45-
if: github.event_name != 'pull_request'
76+
if: matrix.upload && github.event_name != 'pull_request'
4677
uses: actions/upload-artifact@v4
4778
with:
4879
name: Linux executable (${{ matrix.os }})

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,35 @@
66
flake-utils.url = "github:numtide/flake-utils";
77
};
88

9-
outputs = { self, nixpkgs, flake-utils }:
10-
flake-utils.lib.eachDefaultSystem (system:
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
flake-utils,
14+
}:
15+
flake-utils.lib.eachDefaultSystem (
16+
system:
1117
let
1218
pkgs = nixpkgs.legacyPackages.${system};
1319
package = pkgs.callPackage ./package.nix { };
20+
21+
ldLibraryPath = pkgs.lib.makeLibraryPath (
22+
with pkgs;
23+
[
24+
wayland
25+
libxkbcommon
26+
]
27+
);
28+
29+
commonBuildInputs =
30+
with pkgs;
31+
if stdenv.isDarwin then
32+
[ ]
33+
else
34+
[
35+
binutils
36+
mesa-demos # for glxinfo, eglinfo
37+
];
1438
in
1539
{
1640
packages = {
@@ -20,18 +44,33 @@
2044

2145
devShells.default = pkgs.mkShell {
2246
inputsFrom = [ package ];
23-
buildInputs = with pkgs; if stdenv.isDarwin then [ ] else [
24-
gcc
25-
gdb
26-
binutils
27-
mesa-demos # for glxinfo, eglinfo
28-
];
29-
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (with pkgs; [
30-
wayland
31-
libxkbcommon
32-
]);
47+
buildInputs =
48+
commonBuildInputs
49+
++ (
50+
with pkgs;
51+
if stdenv.isDarwin then
52+
[ ]
53+
else
54+
[
55+
gcc
56+
gdb
57+
]
58+
);
59+
LD_LIBRARY_PATH = ldLibraryPath;
3360
};
3461

62+
devShells.clang =
63+
pkgs.mkShell.override
64+
{
65+
stdenv = pkgs.llvmPackages_22.libcxxStdenv;
66+
}
67+
{
68+
inputsFrom = [ package ];
69+
buildInputs =
70+
commonBuildInputs ++ (with pkgs; if stdenv.isDarwin then [ ] else [ llvmPackages_22.lldb ]);
71+
LD_LIBRARY_PATH = ldLibraryPath;
72+
};
73+
3574
apps.default = flake-utils.lib.mkApp {
3675
drv = package;
3776
};

include/tev/Common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ template <typename T> bool fromChars(const char* begin, const char* end, T& valu
313313
}
314314

315315
template <typename T> bool fromChars(std::string_view s, T& value) {
316-
// Shockingly, macOS *still* does not ship a floating point from_chars() implementation -- a C++17 feature! -- so we polyfill via the
317-
// much heavier stof (string alloc + exception on failed parse). TODO: remove once supported
318-
#ifdef __APPLE__
316+
// libc++ *still* does not ship a floating-point from_chars() -- a C++17 feature!
317+
// Polyfill via stof/stod (string alloc + exception on failed parse).
318+
#if !defined(__cpp_lib_to_chars) || __cpp_lib_to_chars < 201611L
319319
if constexpr (std::is_floating_point_v<T>) {
320320
try {
321321
value = std::stof(std::string{s});

0 commit comments

Comments
 (0)