Add flags for Valgrind build

This commit is contained in:
Jarred Sumner
2023-12-29 00:25:02 -08:00
parent 70f344101b
commit 8a34b8f6f8
3 changed files with 15 additions and 0 deletions

View File

@@ -253,11 +253,24 @@ option(USE_CUSTOM_LIBUV "Use Bun's recommended version of libuv (Windows only)"
option(USE_CUSTOM_LSHPACK "Use Bun's recommended version of ls-hpack" ON)
option(USE_BASELINE_BUILD "Build Bun for baseline (older) CPUs" OFF)
option(USE_VALGRIND "Build Bun with Valgrind support (Linux only)" OFF)
option(ZIG_OPTIMIZE "Optimization level for Zig" ${DEFAULT_ZIG_OPTIMIZE})
option(USE_DEBUG_JSC "Enable assertions and use a debug build of JavaScriptCore" ${DEFAULT_USE_DEBUG_JSC})
option(USE_UNIFIED_SOURCES "Use unified sources to speed up the build" OFF)
option(USE_STATIC_LIBATOMIC "Statically link libatomic, requires the presence of libatomic.a" ${DEFAULT_USE_STATIC_LIBATOMIC})
if(USE_VALGRIND)
# Disable SIMD
set(USE_BASELINE_BUILD ON)
if(ARCH STREQUAL "x86_64")
# This is for picohttpparser
# Valgrind cannot handle SSE4.2 instructions
add_compile_definitions("__SSE4_2__=0")
endif()
endif()
if(NOT CANARY)
set(CANARY 0)
endif()

View File

@@ -17,6 +17,7 @@
"scripts": {
"setup": "./scripts/setup.sh",
"build": "if [ ! -e build ]; then bun setup; fi && ninja -C build",
"build:valgrind": "cmake . -DZIG_OPTIMIZE=Debug -DUSE_DEBUG_JSC=ON -DCMAKE_BUILD_TYPE=Debug -GNinja -Bbuild-valgrind && ninja -Cbuild-valgrind",
"build:release": "cmake . -DCMAKE_BUILD_TYPE=Release -GNinja -Bbuild-release && ninja -Cbuild-release",
"build:safe": "cmake . -DZIG_OPTIMIZE=ReleaseSafe -DUSE_DEBUG_JSC=ON -DCMAKE_BUILD_TYPE=Release -GNinja -Bbuild-safe && ninja -Cbuild-safe",
"typecheck": "tsc --noEmit && cd test && bun run typecheck",

View File

@@ -18,6 +18,7 @@ cmake "${CMAKE_FLAGS[@]}" . \
-DMI_BUILD_TESTS=OFF \
-DMI_OSX_ZONE=OFF \
-DMI_OSX_INTERPOSE=OFF \
-DMI_TRACK_VALGRIND=ON \
-DMI_BUILD_OBJECT=ON \
-DMI_USE_CXX=ON \
-DMI_OVERRIDE=OFF \