From 9773d6d25e0bf4a74e472f0f424475a7cde550e0 Mon Sep 17 00:00:00 2001 From: aiekick Date: Thu, 1 Feb 2024 20:18:05 +0100 Subject: [PATCH] [ADD] : add ASAN in DemoApp of linux github/actions --- .github/workflows/Linux.yml | 6 +++--- CMakeLists.txt | 9 +++++++++ ImGuiFileDialog | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index 9b5b625..657e40b 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -22,7 +22,7 @@ jobs: - name: Install OpenGL lib / Requirement for Glfw3 run : sudo apt-get update && sudo apt-get install libgl1-mesa-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev - name: configure - run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_LEAK_SANITIZER=ON - name: build run: cmake --build build --config Release - name: ctest @@ -44,7 +44,7 @@ jobs: - name: Install OpenGL lib / Requirement for Glfw3 run : sudo apt-get update && sudo apt-get install libgl1-mesa-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev - name: configure - run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_STD_FILESYSTEM=ON + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_STD_FILESYSTEM=ON -DUSE_LEAK_SANITIZER=ON - name: build run: cmake --build build --config Release - name: ctest @@ -66,7 +66,7 @@ jobs: - name: Install OpenGL lib / Requirement for Glfw3 run : sudo apt-get update && sudo apt-get install libgl1-mesa-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev - name: configure - run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_BOOST_DEMO_FILESYSTEM=ON + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_BOOST_DEMO_FILESYSTEM=ON -DUSE_LEAK_SANITIZER=ON - name: build run: cmake --build build --config Release - name: ctest diff --git a/CMakeLists.txt b/CMakeLists.txt index 9414c6f..59a782d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,10 @@ option(USE_TEST "Enable tests" ON) option(USE_STD_FILESYSTEM "Enable std::filesystem use for path and ImGuiFileDialog" OFF) option(USE_BOOST_DEMO_FILESYSTEM "Enable the demo of custom filesystem here with boost" OFF) +if (UNIX) + option(USE_LEAK_SANITIZER "Enable the Leak Sanitizer" OFF) +endif() + include(cmake/3rdparty.cmake) if (USE_BOOST_DEMO_FILESYSTEM) @@ -85,6 +89,11 @@ if (USE_TEST) add_definitions(-DNEED_TO_BE_PUBLIC_FOR_TESTS) endif() +if (USE_LEAK_SANITIZER) + add_compile_options(-fexceptions -pthread -ldl -lGL -Wall -Werror -g -fsanitize=undefined -fno-sanitize-recover -fsanitize=float-cast-overflow -fsanitize=leak -fsanitize=address -fsanitize-address-use-after-scope -fstack-protector -fstack-protector-all -fstack-check) + add_link_options(-fexceptions -pthread -ldl -lGL -Wall -Werror -g -fsanitize=undefined -fno-sanitize-recover -fsanitize=float-cast-overflow -fsanitize=leak -fsanitize=address -fsanitize-address-use-after-scope -fstack-protector -fstack-protector-all -fstack-check) +endif() + add_subdirectory(${CMAKE_SOURCE_DIR}/ImGuiFileDialog) target_link_libraries(ImGuiFileDialog PRIVATE diff --git a/ImGuiFileDialog b/ImGuiFileDialog index d4c5c04..3b69c33 160000 --- a/ImGuiFileDialog +++ b/ImGuiFileDialog @@ -1 +1 @@ -Subproject commit d4c5c048685ba0d9624baf72acfbe9fea2d6d9fa +Subproject commit 3b69c330b11d8160e8d03a8ecf7e36681c472d7b