build: Properly optimize web build

This commit is contained in:
WerWolv
2025-01-18 16:53:11 +01:00
parent 3adc2c44e6
commit 2cb0df4080
2 changed files with 5 additions and 5 deletions

8
dist/web/Dockerfile vendored
View File

@@ -1,4 +1,4 @@
FROM emscripten/emsdk:3.1.51 as build FROM emscripten/emsdk:3.1.51 AS build
# Used to invalidate layer cache but not mount cache # Used to invalidate layer cache but not mount cache
# See https://github.com/moby/moby/issues/41715#issuecomment-733976493 # See https://github.com/moby/moby/issues/41715#issuecomment-733976493
@@ -27,7 +27,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
' >> /emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake ' >> /emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
EOF EOF
ENV VCPKG_DEFAULT_BINARY_CACHE /cache/vcpkg ENV VCPKG_DEFAULT_BINARY_CACHE=/cache/vcpkg
RUN --mount=type=cache,target=/cache <<EOF RUN --mount=type=cache,target=/cache <<EOF
# Install dependencies with vcpkg # Install dependencies with vcpkg
set -xe set -xe
@@ -45,7 +45,7 @@ EOF
# Build ImHex # Build ImHex
ARG JOBS=4 ARG JOBS=4
ENV CCACHE_DIR /cache/ccache ENV CCACHE_DIR=/cache/ccache
RUN mkdir /build RUN mkdir /build
WORKDIR /build WORKDIR /build
@@ -80,7 +80,7 @@ EOF
# See https://stackoverflow.com/questions/41701849/cannot-modify-accept-encoding-with-fetch https://github.com/AnthumChris/fetch-progress-indicators/issues/13 # See https://stackoverflow.com/questions/41701849/cannot-modify-accept-encoding-with-fetch https://github.com/AnthumChris/fetch-progress-indicators/issues/13
RUN du -b /build/imhex.wasm | cut -f1 > imhex.wasm.size RUN du -b /build/imhex.wasm | cut -f1 > imhex.wasm.size
FROM scratch as raw FROM scratch AS raw
COPY --from=build [ \ COPY --from=build [ \
# ImHex \ # ImHex \
"/build/imhex.wasm", \ "/build/imhex.wasm", \

View File

@@ -44,7 +44,7 @@ if (EMSCRIPTEN)
target_link_options(main PRIVATE -sEXPORTED_RUNTIME_METHODS=ccall) target_link_options(main PRIVATE -sEXPORTED_RUNTIME_METHODS=ccall)
target_link_options(main PRIVATE -sFETCH) target_link_options(main PRIVATE -sFETCH)
target_link_options(main PRIVATE -sWASM_BIGINT) target_link_options(main PRIVATE -sWASM_BIGINT)
target_link_options(main PRIVATE -O1) target_link_options(main PRIVATE -O2)
target_link_options(main PRIVATE -sLEGACY_GL_EMULATION) target_link_options(main PRIVATE -sLEGACY_GL_EMULATION)
target_link_options(main PRIVATE -fsanitize=null) target_link_options(main PRIVATE -fsanitize=null)
target_link_options(main PRIVATE -fsanitize-minimal-runtime) target_link_options(main PRIVATE -fsanitize-minimal-runtime)