Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,34 @@ on:
branches: [ main ]

jobs:
moving-average-accumulator-test:
runs-on: ubuntu-latest

itch_streamgen:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Download Dependencies
run: |
sudo apt-get install ninja-build
sudo apt-get install valgrind

- name: Configure Build Directory
run: |
cd itch_streamgen
mkdir -p build
cmake -G Ninja -S . -B build

- name: Build
run: |
cd itch_streamgen
ninja -C build

- name: Install Dependencies
- name: Run Unit Tests
run: |
sudo apt-get install -y verilator make
cd itch_streamgen
ninja runtests -C build
ninja memcheck -C build

- name: Run Simulation
- name: Run Valgrind
run: |
cd mov_avg_acc
make test
cd itch_streamgen
ninja valgrind -C build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ vivado/project/
*.str
*.wdb
*.backup
.cache/

# Clash generated files
*/clash/generated/
Expand Down
34 changes: 0 additions & 34 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,35 +1 @@
{
description = "A dev/build env for punt-engine.";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";

outputs = {
self,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
pkgs = import nixpkgs {inherit system;};
});
in {
devShells = forEachSupportedSystem ({pkgs}: {
default =
pkgs.mkShell.override {stdenv = pkgs.llvmPackages_19.libcxxStdenv;}
{
packages = with pkgs; [
llvmPackages_19.libcxxClang
llvmPackages_19.clang-tools
gdb
cmake
gtest
openssl
valgrind
ninja
verilator
];
};
});
};
}
1 change: 0 additions & 1 deletion include/constant.hpp

This file was deleted.

Binary file removed itch_streamgen/.DS_Store
Binary file not shown.
67 changes: 67 additions & 0 deletions itch_streamgen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.28)
project(itch_streamgen)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMAND ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)

set(CMAKE_EXPORT_COMPILE_COMMANDS
ON
CACHE INTERNAL "")

if(CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif()

set(CMAKE_CXX_FLAGS "-std=c++23")

add_compile_options(-Wall -Wextra -pedantic)

include_directories(include)
add_definitions(-DSOME_DEFINITION)
add_subdirectory(src)

enable_testing()
add_subdirectory(tests)

include(FetchContent)

FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip)

# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt
ON
CACHE BOOL "" FORCE)

FetchContent_MakeAvailable(googletest)

include(CTest)

add_custom_target(
memcheck
COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --test-action
memcheck
COMMAND ${CMAKE_COMMAND} -E cat
"${CMAKE_BINARY_DIR}/Testing/Temporary/MemoryChecker.*.log"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

add_custom_target(
runtests
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --schedule-random
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

add_custom_target(
valgrind
COMMAND valgrind --leak-check=full ./src/itch_streamgen
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

function(analyze target)
get_target_property(SRCs ${target} SOURCES)
add_library(${target}_analyze OBJECT EXCLUDE_FROM_ALL ${SRCs})
set_target_properties(
${target}_analyze PROPERTIES COMPILE_OPTIONS "--analyze"
EXCLUDE_FROM_DEFAULT_BUILD true)
endfunction()
37 changes: 0 additions & 37 deletions itch_streamgen/Makefile

This file was deleted.

27 changes: 27 additions & 0 deletions itch_streamgen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Development

Before anything, build and enter the development environment with `nix develop`.

### Run CMake
```bash
cmake -G Ninja -S . -B build
```

### Build
```bash
ninja -C build
```

### Run Tests
```bash
ninja runtests -C build
ninja memcheck -C build
ninja valgrind -C build
```

### Clangd Setup
I'm using the Clangd C++ LSP. Run the command below to make it aware of your linked libraries.

```bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1
```
27 changes: 27 additions & 0 deletions itch_streamgen/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions itch_streamgen/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
description = "A dev/build env for itch_streamgen.";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";

outputs = {
self,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
pkgs = import nixpkgs {inherit system;};
});
in {
devShells = forEachSupportedSystem ({pkgs}: {
default =
pkgs.mkShell.override {stdenv = pkgs.llvmPackages_19.libcxxStdenv;}
{
packages = with pkgs; [
llvmPackages_19.libcxxClang
llvmPackages_19.clang-tools
gdb
cmake
gtest
valgrind
ninja
];
};
});
};
}
Loading