Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "externals/sanitizers-cmake"]
path = externals/sanitizers-cmake
url = git://github.com/arsenm/sanitizers-cmake.git
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ set(OPENJPEG_LIBRARY_PROPERTIES
# Path to additional CMake modules
set(CMAKE_MODULE_PATH
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/externals/sanitizers-cmake/cmake
${CMAKE_MODULE_PATH})

# --------------------------------------------------------------------------
Expand Down Expand Up @@ -243,6 +244,10 @@ check_symbol_exists(posix_memalign stdlib.h OPJ_HAVE_POSIX_MEMALIGN)
unset(CMAKE_REQUIRED_DEFINITIONS)
# memalign (obsolete)
check_symbol_exists(memalign malloc.h OPJ_HAVE_MEMALIGN)

# Make sure there is Sanitizer support in CMake
find_package(Sanitizers)

#-----------------------------------------------------------------------------
# Build Library
if(BUILD_JPIP_SERVER)
Expand Down
1 change: 1 addition & 0 deletions externals/sanitizers-cmake
Submodule sanitizers-cmake added at 6947cf
1 change: 1 addition & 0 deletions src/bin/jp2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ endif()
# Loop over all executables:
foreach(exe opj_decompress opj_compress opj_dump)
add_executable(${exe} ${exe}.c ${common_SRCS})
add_sanitizers(${exe})
if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
target_compile_options(${exe} PRIVATE ${OPENJP2_COMPILE_OPTIONS})
endif()
Expand Down
1 change: 1 addition & 0 deletions src/bin/jp3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ endif()
# Loop over all executables:
foreach(exe opj_jp3d_compress opj_jp3d_decompress)
add_executable(${exe} ${exe}.c ${common_SRCS})
add_sanitizers(${exe})
target_link_libraries(${exe} openjp3d)
# On unix you need to link to the math library:
if(UNIX)
Expand Down
3 changes: 3 additions & 0 deletions src/bin/jpip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include_directories(

# Tool to embed metadata into JP2 file
add_executable(opj_jpip_addxml opj_jpip_addxml.c)
add_sanitizers(opj_jpip_addxml)
# Install exe
install(TARGETS opj_jpip_addxml
EXPORT OpenJPEGTargets
Expand All @@ -23,6 +24,7 @@ if(BUILD_JPIP_SERVER)

# Build executable
add_executable(opj_server ${OPJ_SERVER_SRCS})
add_sanitizers(opj_server)
target_link_libraries(opj_server ${FCGI_LIBRARIES} openjpip_server)
set_property(
TARGET opj_server
Expand All @@ -49,6 +51,7 @@ set(EXES
)
foreach(exe ${EXES})
add_executable(${exe} ${exe}.c)
add_sanitizers(${exe})
target_link_libraries(${exe} openjpip)
install(TARGETS ${exe}
EXPORT OpenJPEGTargets
Expand Down
1 change: 1 addition & 0 deletions src/bin/jpwl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ foreach(exe decompress compress)
${jpwl_exe}.c
${common_SRCS}
)
add_sanitizers(${jpwl_exe})
set_property(
TARGET ${jpwl_exe}
APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
Expand Down
1 change: 1 addition & 0 deletions src/bin/mj2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ foreach(exe
${MJ2_SRCS}
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
)
add_sanitizers(${exe})
set_property(
TARGET ${exe}
APPEND PROPERTY COMPILE_DEFINITIONS USE_MJ2
Expand Down
1 change: 1 addition & 0 deletions src/bin/wx/OPJViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ set(OPJV_SRCS
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/index.c
)
add_executable(opjviewer ${OPJV_SRCS})
add_sanitizers(opjviewer)
target_link_libraries(opjviewer ${wxWidgets_LIBRARIES} openjpeg)
4 changes: 4 additions & 0 deletions src/lib/openjp2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ else()
if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
# Builds both static and dynamic libs
add_library(${OPENJPEG_LIBRARY_NAME} SHARED ${OPENJPEG_SRCS})
add_sanitizers(${OPENJPEG_LIBRARY_NAME})
add_library(openjp2_static STATIC ${OPENJPEG_SRCS})
add_sanitizers(openjp2_static)
set_target_properties(openjp2_static PROPERTIES OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME})
set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME} openjp2_static)
else()
add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
add_sanitizers(${OPENJPEG_LIBRARY_NAME})
set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME})
endif()
endif()
Expand Down Expand Up @@ -135,6 +138,7 @@ if(BUILD_LUTS_GENERATOR)
# internal utility to generate t1_luts.h (part of the jp2 lib)
# no need to install:
add_executable(t1_generate_luts t1_generate_luts.c)
add_sanitizers(t1_generate_luts)
if(UNIX)
target_link_libraries(t1_generate_luts m)
endif()
Expand Down
1 change: 1 addition & 0 deletions src/lib/openjp3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ endif()

# build jp3d lib:
add_library(${OPENJP3D_LIBRARY_NAME} ${OPENJP3D_SRCS})
add_sanitizers(${OPENJP3D_LIBRARY_NAME})
if(UNIX)
target_link_libraries(${OPENJP3D_LIBRARY_NAME} m)
endif()
Expand Down
2 changes: 2 additions & 0 deletions src/lib/openjpip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if(WIN32)
endif()
endif()
add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS})
add_sanitizers(openjpip)
set_target_properties(openjpip
PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
Expand All @@ -81,6 +82,7 @@ install(TARGETS openjpip

if(BUILD_JPIP_SERVER)
add_library(openjpip_server STATIC ${OPENJPIP_SRCS} ${SERVER_SRCS})
add_sanitizers(openjpip_server)
target_link_libraries(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
set_target_properties(openjpip_server
PROPERTIES COMPILE_FLAGS "-DSERVER")
Expand Down
1 change: 1 addition & 0 deletions src/lib/openjpwl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ if(WIN32)
endif()
endif()
add_library(openjpwl ${JPWL_SRCS} ${OPENJPEG_SRCS})
add_sanitizers(openjpwl)
if(UNIX)
target_link_libraries(openjpwl m)
endif()
Expand Down
1 change: 1 addition & 0 deletions src/lib/openmj2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ endif()

# build mj2 lib:
add_library(${OPENMJ2_LIBRARY_NAME} ${OPENMJ2_SRCS})
add_sanitizers(${OPENMJ2_LIBRARY_NAME})
# FIXME: We are using an openjpeg 1.5 copy:
#target_link_libraries(${OPENMJ2_LIBRARY_NAME} openjp2)
if(UNIX)
Expand Down