diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf3178fd2..ca9ec17db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1076,6 +1076,59 @@ jobs: path: | imhex-${{ env.IMHEX_VERSION }}-${{ matrix.name }}-${{ matrix.release_num }}-x86_64.rpm + snap-build: + strategy: + fail-fast: false + matrix: + include: + - architecture: "x86_64" + image: ubuntu-24.04 + - architecture: "arm64" + image: ubuntu-24.04-arm + name: 🐧 Snap ${{ matrix.architecture }} + runs-on: ${{ matrix.image }} + + permissions: + id-token: write + attestations: write + + steps: + - name: ⬇️ Install setup dependencies + run: | + sudo apt update && sudo apt install -y git curl + + - name: 🧰 Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: 📜 Set version variable + run: | + echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV + + - name: 📜 Move snap directory to root + run: | + mkdir -p ./snap + envsubst '${IMHEX_VERSION}' < ./dist/snap/snapcraft.yaml > ./snap/snapcraft.yaml + + - name: 🛠️ Build + uses: snapcore/action-build@v1 + id: snapcraft + + - name: 🗝️ Generate build provenance attestations + uses: actions/attest-build-provenance@v2 + if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }} + with: + subject-path: | + ${{ steps.snapcraft.outputs.snap }} + + - name: ⬆️ Upload Snap + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + name: Snap ${{ matrix.architecture }} + path: ${{ steps.snapcraft.outputs.snap }} + webassembly-build: runs-on: ubuntu-24.04 name: 🌍 Web diff --git a/.gitignore b/.gitignore index 667c5d31f..e11d046fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,15 @@ -.vscode/ -.idea/ -.kdev4/ +/.vscode/ +/.idea/ +/.kdev4/ +/.vs/ -cmake-build-*/ -build*/ -local/ -venv/ -.cache/ -install/ -out/ +/cmake-build-*/ +/build*/ +/local/ +/venv/ +/.cache/ +/install/ +/out/ *.mgc *.kdev4 @@ -17,5 +18,4 @@ imgui.ini CMakeUserPresets.json Brewfile.lock.json -.vs/ vcpkg.json diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 4b3745c3d..42fcb0c2c 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -347,8 +347,7 @@ macro(createPackage) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.imhex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo) # install symlink for the old standard name - file(CREATE_LINK net.werwolv.imhex.metainfo.xml ${CMAKE_CURRENT_BINARY_DIR}/net.werwolv.imhex.appdata.xml SYMBOLIC) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/net.werwolv.imhex.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.imhex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo RENAME net.werwolv.imhex.appdata.xml) endif() diff --git a/dist/snap/snapcraft.yaml b/dist/snap/snapcraft.yaml new file mode 100644 index 000000000..501af21a8 --- /dev/null +++ b/dist/snap/snapcraft.yaml @@ -0,0 +1,87 @@ +name: imhex +base: core24 +version: ${IMHEX_VERSION} +summary: Hex editor for reverse engineering +description: | + ImHex is a hex editor for reverse engineering, reverse engineering, and + analyzing binary files. It provides a powerful and flexible interface for + working with binary data, including features like pattern matching, scripting, + and a customizable user interface. +grade: stable +confinement: classic +contact: https://github.com/WerWolv/ImHex/discussions +issues: https://github.com/WerWolv/ImHex/issues +website: https://imhex.werwolv.net +license: GPL-2.0-only +icon: resources/icon.svg +adopt-info: imhex + +platforms: + amd64: + arm64: + +apps: + imhex: + command: usr/local/bin/imhex + desktop: usr/local/share/applications/imhex.desktop + environment: + LD_LIBRARY_PATH: '$SNAP/usr/local/lib:$SNAP/usr/local/lib/imhex:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH' + XDG_DATA_DIRS: '$XDG_DATA_DIRS:$SNAP/usr/local/share:$SNAP/usr/local/lib:$SNAP/usr/local/share' + XDG_CONFIG_DIRS: '$XDG_CONFIG_DIRS:$SNAP/usr/local/share' + XDG_DATA_HOME: '$XDG_DATA_HOME:$SNAP_DATA' + +parts: + imhex: + plugin: cmake + source: . + build-environment: + - CC: /usr/bin/gcc-14 + - CXX: /usr/bin/g++-14 + cmake-parameters: + - -DCMAKE_BUILD_TYPE=Release + cmake-generator: Ninja + build-packages: + - cmake + - ninja-build + - gcc-14 + - g++-14 + - git + - pkg-config + - libglfw3-dev + - libmagic-dev + - libmbedtls-dev + - libfontconfig-dev + - libfreetype-dev + - libdbus-1-dev + - libcurl4-gnutls-dev + - libgtk-3-dev + - zlib1g-dev + - libbz2-dev + - liblzma-dev + - libzstd-dev + - liblz4-dev + - libssh2-1-dev + stage-packages: + - libglfw3 + - libmagic1 + - libmbedtls14 + - libfontconfig1 + - libfreetype6 + - libdbus-1-3 + - libcurl4-gnutls-dev + - libgtk-3-0 + - zlib1g + - libbz2-1.0 + - liblzma5 + - libzstd1 + - liblz4-1 + - libssh2-1 + prime: + - -usr/include/* + - -usr/local/include/* + - -usr/lib/**/*.a + - -usr/local/lib/**/*.a + - -usr/lib/**/*.la + - -usr/local/lib/**/*.la + - -usr/share/doc/* + - -usr/share/man/* diff --git a/lib/third_party/imgui/implot/include/implot_internal.h b/lib/third_party/imgui/implot/include/implot_internal.h index 8c1650ef1..00ab32b26 100644 --- a/lib/third_party/imgui/implot/include/implot_internal.h +++ b/lib/third_party/imgui/implot/include/implot_internal.h @@ -33,6 +33,7 @@ #include #include "imgui_internal.h" +#include #ifndef IMPLOT_VERSION #error Must include implot.h before implot_internal.h @@ -120,7 +121,7 @@ static inline T ImRemap01(T x, T x0, T x1) { return (x - x0) / (x1 - x0); } // Returns always positive modulo (assumes r != 0) static inline int ImPosMod(int l, int r) { return (l % r + r) % r; } // Returns true if val is NAN -static inline bool ImNan(double val) { return isnan(val); } +static inline bool ImNan(double val) { return std::isnan(val); } // Returns true if val is NAN or INFINITY static inline bool ImNanOrInf(double val) { return !(val >= -DBL_MAX && val <= DBL_MAX) || ImNan(val); } // Turns NANs to 0s diff --git a/lib/third_party/imgui/implot3d/include/implot3d_internal.h b/lib/third_party/imgui/implot3d/include/implot3d_internal.h index d1a22be5e..04022d539 100644 --- a/lib/third_party/imgui/implot3d/include/implot3d_internal.h +++ b/lib/third_party/imgui/implot3d/include/implot3d_internal.h @@ -28,6 +28,8 @@ #pragma once +#include + #ifndef IMPLOT3D_VERSION #include "implot3d.h" #endif @@ -58,7 +60,7 @@ template static inline bool ImHasFlag(TSet set, template static inline void ImFlipFlag(TSet& set, TFlag flag) { ImHasFlag(set, flag) ? set &= ~flag : set |= flag; } template static inline T ImRemap01(T x, T x0, T x1) { return (x1 - x0) ? ((x - x0) / (x1 - x0)) : 0; } // Returns true if val is NAN -static inline bool ImNan(float val) { return isnan(val); } +static inline bool ImNan(float val) { return std::isnan(val); } // Returns true if val is NAN or INFINITY static inline bool ImNanOrInf(float val) { return !(val >= -FLT_MAX && val <= FLT_MAX) || ImNan(val); } // Turns NANs to 0s