From 1da3e3cb84774beb9e3df078daf08dc974fb7c49 Mon Sep 17 00:00:00 2001 From: Stefan Machmeier Date: Thu, 26 Mar 2026 09:29:40 +0100 Subject: [PATCH 1/3] feat: Add release workflow --- .github/workflows/release.yml | 86 +++++++++++++++++++++++++++++++++++ heiFIP/CMakeLists.txt | 11 +++-- 2 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a86312c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,86 @@ +name: Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + build: + name: Build for ${{ matrix.arch }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + arch: x86_64 + - os: ubuntu-24.04-arm + arch: arm64 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up CMake + uses: lukka/get-cmake@v3.29.2 + + - name: Install dependencies + 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$(nproc) + + - name: Install and Package + run: | + cd heiFIP/ + cmake --install build --prefix ./install + # Get version from tag or git describe + VERSION=$(git describe --tags --always) + ARCH=${{ matrix.arch }} + tar -czf ../heiFIP-${VERSION}-${ARCH}.tar.gz -C ./install . + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: heiFIP-${{ matrix.arch }} + path: heiFIP-*.tar.gz + + 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 + generate_release_notes: true diff --git a/heiFIP/CMakeLists.txt b/heiFIP/CMakeLists.txt index 53d71d5..08d7aba 100644 --- a/heiFIP/CMakeLists.txt +++ b/heiFIP/CMakeLists.txt @@ -9,8 +9,8 @@ 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") +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -funroll-loops -flto=auto -DNDEBUG") +set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -flto=auto -DNDEBUG") # === 3. Find dependencies === @@ -43,10 +43,15 @@ foreach(_target IN ITEMS heiFIP main) ) 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 - $<$:-O3 -march=native -funroll-loops -flto=auto -DNDEBUG> + $<$:-O3 -funroll-loops -flto=auto -DNDEBUG> ) target_link_options(${_target} PUBLIC $<$:-flto=auto> From 2e68ccc9bd48d6a782b0e5ac1655583b86d0cf42 Mon Sep 17 00:00:00 2001 From: Stefan Machmeier Date: Thu, 26 Mar 2026 13:04:04 +0100 Subject: [PATCH 2/3] feat: Add windows support --- .github/workflows/build_test_windows.yml | 40 ++++++++++++++++++++++++ heiFIP/CMakeLists.txt | 36 ++++++++++++++++----- heiFIP/runner.cpp | 8 ++--- heiFIP/vcpkg.json | 4 +++ 4 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/build_test_windows.yml diff --git a/.github/workflows/build_test_windows.yml b/.github/workflows/build_test_windows.yml new file mode 100644 index 0000000..2695b3b --- /dev/null +++ b/.github/workflows/build_test_windows.yml @@ -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 diff --git a/heiFIP/CMakeLists.txt b/heiFIP/CMakeLists.txt index 08d7aba..d6a709f 100644 --- a/heiFIP/CMakeLists.txt +++ b/heiFIP/CMakeLists.txt @@ -9,14 +9,22 @@ if(NOT CMAKE_BUILD_TYPE) endif() # === 2. Maximum optimization flags for Release === -set(CMAKE_CXX_FLAGS_RELEASE "-O3 -funroll-loops -flto=auto -DNDEBUG") -set(CMAKE_C_FLAGS_RELEASE "-O3 -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( @@ -41,6 +49,9 @@ 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 === @@ -50,10 +61,19 @@ install(TARGETS heiFIP RUNTIME DESTINATION bin) # === 7. Optimization and LTO in Release builds === foreach(_target IN ITEMS heiFIP main) - target_compile_options(${_target} PUBLIC - $<$:-O3 -funroll-loops -flto=auto -DNDEBUG> - ) - target_link_options(${_target} PUBLIC - $<$:-flto=auto> - ) + if(MSVC) + target_compile_options(${_target} PUBLIC + $<$:/O2 /GL /DNDEBUG> + ) + target_link_options(${_target} PUBLIC + $<$:/LTCG> + ) + else() + target_compile_options(${_target} PUBLIC + $<$:-O3 -funroll-loops -flto=auto -DNDEBUG> + ) + target_link_options(${_target} PUBLIC + $<$:-flto=auto> + ) + endif() endforeach() \ No newline at end of file diff --git a/heiFIP/runner.cpp b/heiFIP/runner.cpp index f2af68a..7818f50 100644 --- a/heiFIP/runner.cpp +++ b/heiFIP/runner.cpp @@ -3,6 +3,7 @@ #include #include +#include #include "extractor.cpp" // Runner class orchestrates multithreaded image generation using FIPExtractor @@ -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()); } }; \ No newline at end of file diff --git a/heiFIP/vcpkg.json b/heiFIP/vcpkg.json index 1e0d704..58ea71a 100644 --- a/heiFIP/vcpkg.json +++ b/heiFIP/vcpkg.json @@ -7,6 +7,10 @@ "default-features": false, "features": ["jpeg", "png"] }, + { + "name": "getopt-win32", + "platform": "windows" + }, "openssl", "pcapplusplus" ] From a78b44b3885af8334fd9ea3709a76699d75dc787 Mon Sep 17 00:00:00 2001 From: Stefan Machmeier Date: Thu, 26 Mar 2026 13:10:46 +0100 Subject: [PATCH 3/3] feat(release): add support for windows --- .github/workflows/release.yml | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a86312c..3d78d43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: jobs: build: - name: Build for ${{ matrix.arch }} + name: Build for ${{ matrix.arch }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -17,6 +17,8 @@ jobs: arch: x86_64 - os: ubuntu-24.04-arm arch: arm64 + - os: windows-2022 + arch: x86_64 steps: - name: Checkout code @@ -25,7 +27,8 @@ jobs: - name: Set up CMake uses: lukka/get-cmake@v3.29.2 - - name: Install dependencies + - name: Install dependencies (Linux) + if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y \ @@ -50,22 +53,34 @@ jobs: cmake -B build -S . \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" - cmake --build build --config Release -j$(nproc) + cmake --build build --config Release -j 4 - - name: Install and Package + - name: Install and Package (Linux) + if: runner.os == 'Linux' run: | cd heiFIP/ cmake --install build --prefix ./install - # Get version from tag or git describe 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.arch }} - path: heiFIP-*.tar.gz + name: heiFIP-${{ matrix.os }}-${{ matrix.arch }} + path: | + heiFIP-*.tar.gz + heiFIP-*.zip release: name: Create Release @@ -82,5 +97,7 @@ jobs: - name: Create Release uses: softprops/action-gh-release@v2 with: - files: artifacts/*.tar.gz + files: | + artifacts/*.tar.gz + artifacts/*.zip generate_release_notes: true