Skip to content
Open
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
40 changes: 40 additions & 0 deletions .github/workflows/build_test_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Windows Build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: windows-latest

env:
CMAKE_BUILD_TYPE: Release

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up CMake
uses: lukka/get-cmake@v3.29.2

- name: Cache vcpkg packages
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/heiFIP/build/vcpkg_installed
C:/Users/runneradmin/AppData/Local/vcpkg/archives
key: ${{ runner.os }}-vcpkg-${{ hashFiles('heiFIP/vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-

- name: Configure and Build
shell: pwsh
run: |
cd heiFIP
cmake -B build -S . `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --build build --config Release -j $env:NUMBER_OF_PROCESSORS
103 changes: 103 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
build:
name: Build for ${{ matrix.arch }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-24.04-arm
arch: arm64
- os: windows-2022
arch: x86_64

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up CMake
uses: lukka/get-cmake@v3.29.2

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libpcap-dev \
git

- name: Cache vcpkg packages
uses: actions/cache@v4
with:
path: |
~/.cache/vcpkg
heiFIP/build/vcpkg_installed
key: ${{ runner.os }}-vcpkg-${{ hashFiles('heiFIP/vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-

- name: Configure and Build
run: |
cd heiFIP/
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --build build --config Release -j 4

- name: Install and Package (Linux)
if: runner.os == 'Linux'
run: |
cd heiFIP/
cmake --install build --prefix ./install
VERSION=$(git describe --tags --always)
ARCH=${{ matrix.arch }}
tar -czf ../heiFIP-${VERSION}-${ARCH}.tar.gz -C ./install .

- name: Install and Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd heiFIP
cmake --install build --prefix ./install
$VERSION = git describe --tags --always
$ARCH = "${{ matrix.arch }}"
Compress-Archive -Path ./install/* -DestinationPath ../heiFIP-$VERSION-$ARCH.zip

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: heiFIP-${{ matrix.os }}-${{ matrix.arch }}
path: |
heiFIP-*.tar.gz
heiFIP-*.zip

release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*.tar.gz
artifacts/*.zip
generate_release_notes: true
41 changes: 33 additions & 8 deletions heiFIP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@ if(NOT CMAKE_BUILD_TYPE)
endif()

# === 2. Maximum optimization flags for Release ===
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -funroll-loops -flto=auto -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3 -march=native -funroll-loops -flto=auto -DNDEBUG")
if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /GL /DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "/O2 /GL /DNDEBUG")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -funroll-loops -flto=auto -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -flto=auto -DNDEBUG")
endif()

# === 3. Find dependencies ===

find_package(OpenSSL REQUIRED)
find_package(OpenCV REQUIRED)
find_package(PcapPlusPlus CONFIG REQUIRED)
if(WIN32)
find_package(getopt-win32 CONFIG REQUIRED)
endif()

# === 4. User project headers ===
include_directories(
Expand All @@ -41,14 +49,31 @@ foreach(_target IN ITEMS heiFIP main)
PcapPlusPlus::Pcap++
${OpenCV_LIBS}
)
if(WIN32)
target_link_libraries(${_target} PUBLIC getopt-win32::getopt)
endif()
endforeach()

# === 8. Install rules ===
install(TARGETS heiFIP RUNTIME DESTINATION bin)
# Optionally install assets if needed
# install(DIRECTORY assets DESTINATION share/heiFIP)

# === 7. Optimization and LTO in Release builds ===
foreach(_target IN ITEMS heiFIP main)
target_compile_options(${_target} PUBLIC
$<$<CONFIG:Release>:-O3 -march=native -funroll-loops -flto=auto -DNDEBUG>
)
target_link_options(${_target} PUBLIC
$<$<CONFIG:Release>:-flto=auto>
)
if(MSVC)
target_compile_options(${_target} PUBLIC
$<$<CONFIG:Release>:/O2 /GL /DNDEBUG>
)
target_link_options(${_target} PUBLIC
$<$<CONFIG:Release>:/LTCG>
)
else()
target_compile_options(${_target} PUBLIC
$<$<CONFIG:Release>:-O3 -funroll-loops -flto=auto -DNDEBUG>
)
target_link_options(${_target} PUBLIC
$<$<CONFIG:Release>:-flto=auto>
)
endif()
endforeach()
8 changes: 3 additions & 5 deletions heiFIP/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <variant>
#include <string>

#include <filesystem>
#include "extractor.cpp"

// Runner class orchestrates multithreaded image generation using FIPExtractor
Expand Down Expand Up @@ -57,10 +58,7 @@ class Runner {
);

// Ensure output path is properly formed before saving
if (!output_dir.empty() && output_dir.back() == '/') {
extractor.save_image(img, output_dir + output_name);
} else {
extractor.save_image(img, output_dir + "/" + output_name);
}
std::filesystem::path out_path = std::filesystem::path(output_dir) / output_name;
extractor.save_image(img, out_path.string());
}
};
4 changes: 4 additions & 0 deletions heiFIP/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"default-features": false,
"features": ["jpeg", "png"]
},
{
"name": "getopt-win32",
"platform": "windows"
},
"openssl",
"pcapplusplus"
]
Expand Down
Loading