Skip to content

Commit

Permalink
Generalize usage of system include dirs for 3rdparties that are known…
Browse files Browse the repository at this point in the history
… to produce warnings
  • Loading branch information
fspindle committed Sep 19, 2024
1 parent 9357ddb commit dc477b2
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 480 deletions.
10 changes: 3 additions & 7 deletions modules/ar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ if(USE_OGRE)
mark_as_advanced(OGRE_SAMPLES_INCLUDEPATH)
#message("OGRE_SAMPLES_INCLUDEPATH: ${OGRE_SAMPLES_INCLUDEPATH}")
if(OGRE_SAMPLES_INCLUDEPATH)
list(APPEND opt_incs ${OGRE_SAMPLES_INCLUDEPATH})
list(APPEND opt_system_incs ${OGRE_SAMPLES_INCLUDEPATH})
endif()

# hack to fix possible presence of NOTFOUND in OGRE_INCLUDE_DIRS
#message("OGRE_INCLUDE_DIRS: ${OGRE_INCLUDE_DIRS}")
foreach(inc_ ${OGRE_INCLUDE_DIRS})
if(NOT ${inc_} MATCHES "NOTFOUND")
list(APPEND opt_incs ${inc_})
list(APPEND opt_system_incs ${inc_})
endif()
endforeach()
if(WIN32)
Expand All @@ -71,7 +71,7 @@ if(USE_OGRE)
endif(USE_OGRE)

if(USE_OIS AND USE_OGRE)
list(APPEND opt_incs ${OIS_INCLUDE_DIR})
list(APPEND opt_system_incs ${OIS_INCLUDE_DIR})
list(APPEND opt_libs ${OIS_LIBRARIES})
if(APPLE)
# With Ogre 1.7.4 and 1.8.1 to be able to link with libOIS.a, Cocoa framework is requested.
Expand Down Expand Up @@ -188,10 +188,6 @@ endif()
vp_add_module(ar visp_core)
vp_glob_module_sources()

if(USE_OGRE)
# Add specific build flag to turn off warnings coming from libogre and libois 3rd party
vp_set_source_file_compile_flag(src/ogre-simulator/vpAROgre.cpp -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-overloaded-virtual -Wno-float-equal -Wno-deprecated-copy -Wno-register)
endif()

vp_module_include_directories(${opt_incs} SYSTEM ${opt_system_incs})
vp_create_module(${opt_libs})
111 changes: 5 additions & 106 deletions modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

# Add optional 3rd parties
set(opt_incs "")
set(opt_system_incs "")
set(opt_libs "")
set(opt_libs_private "")

Expand Down Expand Up @@ -156,6 +157,7 @@ if(USE_OPENCV)
list(APPEND opt_libs ${OpenCV_LIBS})
endif()
if(OpenCV_INCLUDE_DIRS)
# Append OpenCV include dirs as system to avoid warnings coming from OpenCV headers
list(APPEND opt_incs ${OpenCV_INCLUDE_DIRS})
endif()
endif(USE_OPENCV)
Expand Down Expand Up @@ -206,9 +208,9 @@ endif(USE_YARP)
# Math: eigen3, gsl, mkl, openblas, atlas, netlib, OpenCV
if(USE_EIGEN3)
if(EIGEN3_INCLUDE_DIRS)
list(APPEND opt_incs ${EIGEN3_INCLUDE_DIRS})
list(APPEND opt_system_incs ${EIGEN3_INCLUDE_DIRS})
else()
list(APPEND opt_incs ${EIGEN3_INCLUDE_DIR})
list(APPEND opt_system_incs ${EIGEN3_INCLUDE_DIR})
endif()
endif()

Expand Down Expand Up @@ -300,109 +302,6 @@ if(WITH_SIMDLIB)
list(APPEND opt_libs_private ${SIMDLIB_LIBRARIES})
endif()

if(MSVC)
# Disable Visual C++ C4996 warning
# warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead
# warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead
# warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead
if(BUILD_SHARED_LIBS)
vp_set_source_file_compile_flag(src/tools/network/vpClient.cpp /wd4996)
vp_set_source_file_compile_flag(src/tools/network/vpServer.cpp /wd4996)
vp_set_source_file_compile_flag(src/tools/network/vpNetwork.cpp /wd4996)
vp_set_source_file_compile_flag(src/math/random-generator/vpUniRand.cpp /wd4146)
if(BUILD_TESTS)
vp_set_source_file_compile_flag(test/network/testClient.cpp /wd4996)
vp_set_source_file_compile_flag(test/network/testServer.cpp /wd4996)
endif()
else()
vp_warnings_disable(CMAKE_CXX_FLAGS /wd4996)
endif()
endif()

if(USE_EIGEN3)
vp_set_source_file_compile_flag(src/math/matrix/vpMatrix_svd.cpp -Wno-float-equal -Wno-strict-overflow -Wno-misleading-indentation -Wno-int-in-bool-context -Wno-deprecated-copy -Wno-shadow -Wno-maybe-uninitialized)
vp_set_source_file_compile_flag(src/math/matrix/vpMatrix_lu.cpp -Wno-float-equal -Wno-strict-overflow -Wno-misleading-indentation -Wno-int-in-bool-context -Wno-deprecated-copy -Wno-shadow)
vp_set_source_file_compile_flag(src/math/matrix/vpEigenConversion.cpp -Wno-float-equal -Wno-strict-overflow -Wno-misleading-indentation -Wno-int-in-bool-context -Wno-shadow)
vp_set_source_file_compile_flag(test/math/testEigenConversion.cpp -Wno-float-equal -Wno-strict-overflow -Wno-misleading-indentation -Wno-int-in-bool-context -Wno-shadow)
vp_set_source_file_compile_flag(test/math/perfMatrixMultiplication.cpp -Wno-strict-overflow -Wno-misleading-indentation -Wno-float-equal -Wno-deprecated-copy -Wno-int-in-bool-context -Wno-shadow)
vp_set_source_file_compile_flag(test/math/perfMatrixTranspose.cpp -Wno-misleading-indentation -Wno-float-equal -Wno-deprecated-copy -Wno-int-in-bool-context -Wno-shadow)
endif()

vp_set_source_file_compile_flag(src/image/vpImageConvert.cpp -Wno-strict-overflow -Wno-sign-compare -Wno-float-equal)
vp_set_source_file_compile_flag(src/image/vpImageFilter.cpp -Wno-strict-overflow -Wno-float-equal)
vp_set_source_file_compile_flag(src/image/vpImageTools.cpp -Wno-strict-overflow -Wno-float-equal)
vp_set_source_file_compile_flag(src/tools/network/vpServer.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/tools/optimization/vpQuadProg.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/tools/optimization/vpLinProg.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/tools/histogram/vpHistogram.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/image/vpFont.cpp -Wno-float-equal -Wno-strict-overflow)
# To avoid warnings with basisu_miniz.h such as:
# basisu_miniz.h:1184:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
vp_set_source_file_compile_flag(src/tools/file/vpIoTools.cpp -Wno-misleading-indentation -Wno-strict-aliasing -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/munkres/vpMunkres.cpp /wd26812 /wd4244)
vp_set_source_file_compile_flag(test/image/testImageBinarise.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(test/image/testImageOwnership.cpp -Wno-pessimizing-move)
vp_set_source_file_compile_flag(test/network/testClient.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(test/network/testServer.cpp -Wno-strict-overflow)

if(USE_OPENCV)
vp_set_source_file_compile_flag(src/camera/vpColorDepthConversion.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/camera/vpMeterPixelConversion.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/camera/vpPixelMeterConversion.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/display/vpDisplay.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/display/vpDisplay_rgba.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/display/vpDisplay_uchar.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/display/vpFeatureDisplay.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/image/vpGaussianFilter.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/image/vpImageDraw.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/math/matrix/vpMatrix_cholesky.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/tools/convert/vpConvert.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/tools/geometry/vpPolygon.cpp -Wno-float-equal -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/tools/geometry/vpPolygon3D.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/tools/histogram/vpHistogram.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/tracking/moments/vpMomentObject.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/camera/testCameraParametersConversion.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image/testImageResize.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image/testImageMorphology.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testColorConversion.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testConversion.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testCrop.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testCropAdvanced.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testGaussianFilter.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testImageAddSub.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testImageFilter.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testImageComparison.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testImageNormalizedCorrelation.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testImageTemplateMatching.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testImageWarp.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testIoPGM.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testIoPPM.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testReadImage.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testPerformanceLUT.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/testUndistortImage.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/perfImageAddSub.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/perfImageMorphology.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/perfImageResize.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/perfImageWarp.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/perfGaussianFilter.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/perfColorConversion.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image/testImageDraw.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image/testImageDifference.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/math/testMomentAlpha.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/tools/convert/testConvert.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/tools/histogram-with-dataset/testHistogram.cpp -Wno-float-equal)
endif()

if(USE_XML2)
if(MSVC)
vp_set_source_file_compile_flag(src/tools/xml/vpXmlParser.cpp /wd4996)
vp_set_source_file_compile_flag(test/tools/xml/testXmlParser.cpp /wd4996)
else()
vp_set_source_file_compile_flag(src/tools/xml/vpXmlParser.cpp -Wno-deprecated-declarations)
vp_set_source_file_compile_flag(test/tools/xml/testXmlParser.cpp -Wno-deprecated-declarations)
endif()
endif()

vp_add_module(core PRIVATE_OPTIONAL ${opt_libs_private} WRAP java)

#-----------------------------------------------------------------------------
Expand All @@ -421,7 +320,7 @@ endif()
vp_source_group("Src" FILES "${VISP_MODULE_visp_core_BINARY_DIR}/version_string.inc")

vp_glob_module_sources(SOURCES "${VISP_MODULE_visp_core_BINARY_DIR}/version_string.inc")
vp_module_include_directories(${opt_incs})
vp_module_include_directories(${opt_incs} SYSTEM ${opt_system_incs})
vp_create_module(${opt_libs})
vp_create_compat_headers("include/visp3/core/vpConfig.h")
vp_add_tests(CTEST_EXCLUDE_PATH network DEPENDS_ON visp_io visp_gui)
Expand Down
10 changes: 3 additions & 7 deletions modules/detection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@

# Add optional 3rd parties
set(opt_incs "")
set(opt_system_incs "")
set(opt_libs "")

if(USE_ZBAR)
list(APPEND opt_incs ${ZBAR_INCLUDE_DIRS})
list(APPEND opt_system_incs ${ZBAR_INCLUDE_DIRS})
list(APPEND opt_libs ${ZBAR_LIBRARIES})
endif()

Expand All @@ -47,11 +48,6 @@ if(USE_DMTX)
list(APPEND opt_libs ${DMTX_LIBRARIES})
endif()

if(USE_ZBAR)
# Add specific build flag to turn off warnings coming from zbar 3rd party
vp_set_source_file_compile_flag(src/barcode/vpDetectorQRCode.cpp -Wno-unused-parameter -Wno-deprecated-declarations)
endif()

if(WITH_APRILTAG)
# April Tag is private
include_directories(${APRILTAG_INCLUDE_DIRS})
Expand Down Expand Up @@ -195,6 +191,6 @@ endif(USE_OPENCV)

vp_add_module(detection visp_core visp_vision PRIVATE_OPTIONAL ${APRILTAG_LIBRARIES} WRAP java)
vp_glob_module_sources()
vp_module_include_directories(${opt_incs})
vp_module_include_directories(${opt_incs} SYSTEM ${opt_system_incs})
vp_create_module(${opt_libs})
vp_add_tests(DEPENDS_ON visp_detection visp_gui visp_io)
26 changes: 0 additions & 26 deletions modules/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,3 @@ vp_glob_module_sources()
vp_module_include_directories(${opt_incs})
vp_create_module(${opt_libs})
vp_add_tests(DEPENDS_ON visp_io)

if(USE_X11)
vp_set_source_file_compile_flag(src/display/vpDisplayX.cpp -Wno-strict-overflow)
endif()
if(USE_OPENCV)
vp_set_source_file_compile_flag(src/display/vpDisplayOpenCV.cpp -Wno-strict-overflow -Wno-float-equal)
vp_set_source_file_compile_flag(src/forward-projection/vpProjectionDisplay.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/plot/vpPlot.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/plot/vpPlotCurve.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/plot/vpPlotGraph.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/display/testDisplayPolygonLines.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/display/testDisplayRoi.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/display/testDisplays.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/display/testVideoDevice.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/display/testVideoDeviceDual.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/display-with-dataset/testMouseEvent.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/display-with-dataset/testDisplayScaled.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/display-with-dataset/testClick.cpp -Wno-float-equal)
endif()
if(USE_GTK2)
vp_set_source_file_compile_flag(src/display/vpDisplayGTK.cpp -Wno-deprecated-declarations)
endif()
if(USE_PCL)
vp_set_source_file_compile_flag(src/pointcloud/vpDisplayPCL.cpp -Wno-unused-parameter)
vp_set_source_file_compile_flag(src/pointcloud/vpPclViewer.cpp -Wno-unused-parameter)
endif()
16 changes: 0 additions & 16 deletions modules/imgproc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,3 @@ vp_module_include_directories()
vp_create_module()

vp_add_tests(DEPENDS_ON visp_imgproc visp_io)

vp_set_source_file_compile_flag(src/vpCLAHE.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/vpThreshold.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/vpFloodFill.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(test/testContours.cpp -Wno-strict-overflow)

if(USE_OPENCV)
vp_set_source_file_compile_flag(src/vpCLAHE.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/vpImgproc.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/with-dataset/testAutoThreshold.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/with-dataset/testImgproc.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/with-dataset/testConnectedComponents.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/with-dataset/testFloodFill.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/with-dataset/testContours.cpp -Wno-float-equal)
vp_set_source_file_compile_flag( -Wno-float-equal)
endif()
15 changes: 0 additions & 15 deletions modules/io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,5 @@ vp_module_include_directories(${opt_incs})
vp_create_module(${opt_libs})
vp_add_tests()

vp_set_source_file_compile_flag(src/tools/vpParseArgv.cpp -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/image/vpImageIo.cpp -Wno-missing-field-initializers) # since stb_image_write.h update from v1.13 to v1.16
vp_set_source_file_compile_flag(src/image/private/vpImageIoStb.cpp -Wno-missing-field-initializers -Wno-strict-overflow)
vp_set_source_file_compile_flag(src/image/private/vpImageIoTinyEXR.cpp -Wno-strict-overflow -Wno-sign-compare -Wno-type-limits -Wno-unused-but-set-variable)

if(USE_OPENCV)
vp_set_source_file_compile_flag(src/image/private/vpImageIoLibjpeg.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/image/private/vpImageIoLibpng.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/image/private/vpImageIoOpenCV.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/image/private/vpImageIoPortable.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/image/vpImageIo.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/video/vpDiskGrabber.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/video/vpVideoReader.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(src/video/vpVideoWriter.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/video/testVideo.cpp -Wno-float-equal)
vp_set_source_file_compile_flag(test/image-with-dataset/perfImageLoadSave.cpp -Wno-float-equal)
endif()
Loading

0 comments on commit dc477b2

Please sign in to comment.