Skip to content

Commit 4eaa816

Browse files
committed
Add asan back as it appears that it was removed at some point
1 parent b2abe32 commit 4eaa816

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

.github/workflows/cmake-test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,26 @@ jobs:
2626
os: ubuntu-24.04
2727
compiler: gcc-13
2828
compilercxx: g++-13
29+
cflags: ""
30+
cxxflags: ""
2931
- name: Ubuntu Clang
3032
os: ubuntu-24.04
3133
compiler: clang
34+
cflags: ""
35+
cxxflags: ""
3236
compilercxx: clang++
3337
- name: Windows MSVC
3438
os: windows-latest
3539
compiler: msvc
3640
compilercxx: msvc
41+
cflags: /fsanitize=address
42+
cxxflags: /fsanitize=address
3743
- name: MacOS ARM GCC
3844
os: macos-latest
3945
compiler: gcc-13
4046
compilercxx: g++-13
47+
cflags: ""
48+
cxxflags: ""
4149

4250
steps:
4351
- uses: actions/checkout@v4
@@ -63,6 +71,8 @@ jobs:
6371
env:
6472
CC: ${{ matrix.compiler }}
6573
CXX: ${{ matrix.compilercxx }}
74+
CFLAGS: ${{ matrix.cflags }}
75+
CXXFLAGS: ${{ matrix.cxxflags }}
6676
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
6777

6878
- name: Copy Testfiles on Windows

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
3939
# Add libdeflate
4040
add_subdirectory (thirdparty/libdeflate)
4141
add_library(libdeflate_include INTERFACE)
42-
target_include_directories(libdeflate_include INTERFACE thirdparty/libdeflate)
42+
target_include_directories(libdeflate_include SYSTEM INTERFACE thirdparty/libdeflate)
4343

4444
# Add mio for memory-mapped IO files
4545
add_subdirectory (thirdparty/mio)
@@ -55,12 +55,12 @@ add_subdirectory (thirdparty/c-blosc2 EXCLUDE_FROM_ALL)
5555

5656
# Add target for blosc2 headers
5757
add_library(blosc2_include INTERFACE)
58-
target_include_directories(blosc2_include INTERFACE thirdparty/c-blosc2/include)
58+
target_include_directories(blosc2_include SYSTEM INTERFACE thirdparty/c-blosc2/include)
5959

6060

6161
# Add doctest
6262
add_library(doctest INTERFACE)
63-
target_include_directories(doctest INTERFACE thirdparty/doctest/doctest)
63+
target_include_directories(doctest SYSTEM INTERFACE thirdparty/doctest/doctest)
6464

6565
# Add simdutf for UTF conversion operations
6666
set (SIMDUTF_TESTS OFF)
@@ -70,7 +70,7 @@ add_subdirectory (thirdparty/simdutf)
7070

7171
# Add span from tcb for compatibility with older compilers for python bindings
7272
add_library(tcb_span INTERFACE)
73-
target_include_directories(tcb_span INTERFACE thirdparty/compatibility)
73+
target_include_directories(tcb_span SYSTEM INTERFACE thirdparty/compatibility)
7474

7575
# Projects
7676
# --------------------------------------------------------------------------

PhotoshopAPI/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ if(MSVC)
1616
target_compile_options(PhotoshopAPI PRIVATE /MP /DNOMINMAX)
1717
target_compile_options(PhotoshopAPI PUBLIC /arch:AVX2 /Zc:__cplusplus /utf-8)
1818
# Bump up warning levels and enable the following extra exceptions:
19-
# w44062 is for a switch misses some enum members.
20-
# w44464 is for #include containing .. in the path (this should never happen)
19+
# w44062 is for if a switch misses some enum members.
20+
# w44464 is for #include containing .. in the path
2121
# w45264 is for using std:move when returning a temporary.
2222
target_compile_options(PhotoshopAPI PRIVATE /W4 /WX /w44062 /w44464 /w45264)
23-
target_compile_options(PhotoshopAPI PRIVATE /wd4505 /wd4996) # Disable internal linkage and deprecation errors due to blosc2
2423
else()
2524
target_compile_options(PhotoshopAPI PUBLIC -O3)
2625
include(CheckCXXCompilerFlag)

PhotoshopTest/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ file(GLOB_RECURSE MY_SOURCES CONFIGURE_DEPENDS "src/*.cpp")
44
enable_testing()
55

66
add_executable(PhotoshopTest ${MY_SOURCES})
7+
78
if(MSVC)
9+
# For MSVC we add the ASAN flags directly in the CI configuration as unfortunately MSVC requires
10+
# this to be passed before any CMake even runs
811
target_compile_options(PhotoshopTest PRIVATE /MP /utf-8)
12+
else()
13+
add_compile_options(-fsanitize=address,leak,undefined)
14+
add_link_options(-fsanitize=address,leak,undefined)
915
endif()
1016
target_link_libraries(PhotoshopTest PRIVATE PhotoshopAPI doctest)
1117

PhotoshopTest/src/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ int main()
2323
#endif
2424
doctest::Context context;
2525

26+
// TMP trip asan
27+
int x[100];
28+
x[100] = 5;
29+
2630
// set defaults
2731
context.setOption("abort-after", 5); // stop test execution after 5 failed
2832

0 commit comments

Comments
 (0)