From 7fe754beea8e6328ca8190de3b9d74727eccb406 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Thu, 13 Jul 2023 22:34:27 +0200 Subject: [PATCH 01/26] Introduce github action workflow to test windows with clang --- .github/workflows/windows-clang.yaml | 76 ++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/windows-clang.yaml diff --git a/.github/workflows/windows-clang.yaml b/.github/workflows/windows-clang.yaml new file mode 100644 index 0000000000..0b88a921b8 --- /dev/null +++ b/.github/workflows/windows-clang.yaml @@ -0,0 +1,76 @@ +name: Windows - clang +on: + pull_request: + push: + +jobs: + build: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: cmd + strategy: + fail-fast: false + matrix: + name: [windows-latest-clang] + + include: + - name: windows-latest-clang + os: windows-2019 + compiler: clang-cl + + steps: + # https://github.com/marketplace/actions/cancel-workflow-action + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Display the workspace path + working-directory: ${{ github.workspace }} + run: pwd + + - name: Clone visp-images + shell: bash + # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ + run: | + git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images + echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + + - name: Configure ViSP + working-directory: ${{ github.workspace }} + run: | + mkdir build + cd build + cmake .. -G "Visual Studio 16 2019" -T "ClangCl" -A "x64" + type ViSP-third-party.txt + + - name: Build ViSP + working-directory: build + run: | + cmake --build . --config Release + + - name: Install ViSP + working-directory: build + run: | + cmake --build . --config Release --target install + + - name: Check installation folder + working-directory: build + run: | + dir ${{ github.workspace }}\build\install\ + dir ${{ github.workspace }}\build\install\x64\ + dir ${{ github.workspace }}\build\install\x64\vc16\ + dir ${{ github.workspace }}\build\install\x64\vc16\bin + + - name: Test ViSP + working-directory: build + run: | + echo "VISP_INPUT_IMAGE_PATH: ${{ env.VISP_INPUT_IMAGE_PATH }}" + set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc16\bin + echo "PATH: " + echo %PATH% + ctest --output-on-failure -C Release -V From 31a3f9201befe842d1f2cf896c3dd2773a691870 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Thu, 13 Jul 2023 22:35:17 +0200 Subject: [PATCH 02/26] Rename windows workflow and update --- .github/workflows/{windows.yaml => windows-msvc.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{windows.yaml => windows-msvc.yaml} (100%) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows-msvc.yaml similarity index 100% rename from .github/workflows/windows.yaml rename to .github/workflows/windows-msvc.yaml From 04c9ac3a2db8ee0a59b1acc9e8fe85bf903d61fd Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 21:06:17 +0200 Subject: [PATCH 03/26] Fix warning : extra ';' after member function definition --- modules/io/include/visp3/io/vpDiskGrabber.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/io/include/visp3/io/vpDiskGrabber.h b/modules/io/include/visp3/io/vpDiskGrabber.h index 0e515d2005..2925f918d8 100644 --- a/modules/io/include/visp3/io/vpDiskGrabber.h +++ b/modules/io/include/visp3/io/vpDiskGrabber.h @@ -138,11 +138,11 @@ class VISP_EXPORT vpDiskGrabber : public vpFrameGrabber /*! Return the current image number. */ - inline long getImageNumber() const { return m_image_number; }; + inline long getImageNumber() const { return m_image_number; } /*! * Return the name of the file in which the last frame was read. */ - inline std::string getImageName() const { return m_image_name; }; + inline std::string getImageName() const { return m_image_name; } void open(vpImage &I); void open(vpImage &I); From 8acad0c3ece24907d05364e9af9d80129f041670 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 21:15:01 +0200 Subject: [PATCH 04/26] Fix warning detected with clang on windows: empty expression statement has no effect; remove unnecessary ';' to silence this warning --- modules/core/include/visp3/core/vpFrameGrabberException.h | 4 ++-- modules/core/include/visp3/core/vpImageException.h | 4 ++-- modules/core/include/visp3/core/vpIoException.h | 4 ++-- modules/core/include/visp3/core/vpMatrixException.h | 4 ++-- modules/core/include/visp3/core/vpTrackingException.h | 4 ++-- modules/io/include/visp3/io/vpParallelPortException.h | 4 ++-- modules/vision/include/visp3/vision/vpCalibrationException.h | 4 ++-- modules/vision/include/visp3/vision/vpPoseException.h | 4 ++-- .../include/visp3/visual_features/vpFeatureException.h | 4 ++-- modules/vs/include/visp3/vs/vpServoException.h | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/core/include/visp3/core/vpFrameGrabberException.h b/modules/core/include/visp3/core/vpFrameGrabberException.h index 3e8d5f7ebb..3254507e93 100644 --- a/modules/core/include/visp3/core/vpFrameGrabberException.h +++ b/modules/core/include/visp3/core/vpFrameGrabberException.h @@ -84,8 +84,8 @@ class VISP_EXPORT vpFrameGrabberException : public vpException setMessage(format, args); va_end(args); } - vpFrameGrabberException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpFrameGrabberException(int id) : vpException(id) { ; } + vpFrameGrabberException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpFrameGrabberException(int id) : vpException(id) { } }; #endif /* #ifndef _vpFrameGrabberException_h_ */ diff --git a/modules/core/include/visp3/core/vpImageException.h b/modules/core/include/visp3/core/vpImageException.h index c42c446c37..34f6a0cefb 100644 --- a/modules/core/include/visp3/core/vpImageException.h +++ b/modules/core/include/visp3/core/vpImageException.h @@ -91,8 +91,8 @@ class VISP_EXPORT vpImageException : public vpException setMessage(format, args); va_end(args); } - vpImageException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpImageException(int id) : vpException(id) { ; } + vpImageException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpImageException(int id) : vpException(id) { } }; #endif diff --git a/modules/core/include/visp3/core/vpIoException.h b/modules/core/include/visp3/core/vpIoException.h index ec7ea640fd..2d0c202e70 100644 --- a/modules/core/include/visp3/core/vpIoException.h +++ b/modules/core/include/visp3/core/vpIoException.h @@ -89,8 +89,8 @@ class VISP_EXPORT vpIoException : public vpException setMessage(format, args); va_end(args); } - vpIoException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpIoException(int id) : vpException(id) { ; } + vpIoException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpIoException(int id) : vpException(id) { } }; #endif diff --git a/modules/core/include/visp3/core/vpMatrixException.h b/modules/core/include/visp3/core/vpMatrixException.h index 95e6114b05..bf237a4ada 100644 --- a/modules/core/include/visp3/core/vpMatrixException.h +++ b/modules/core/include/visp3/core/vpMatrixException.h @@ -98,8 +98,8 @@ class VISP_EXPORT vpMatrixException : public vpException setMessage(format, args); va_end(args); } - vpMatrixException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpMatrixException(int id) : vpException(id) { ; } + vpMatrixException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpMatrixException(int id) : vpException(id) { } // vpMatrixException() : vpException() { ;} }; diff --git a/modules/core/include/visp3/core/vpTrackingException.h b/modules/core/include/visp3/core/vpTrackingException.h index 89ecd16cc1..d2c090b0bf 100644 --- a/modules/core/include/visp3/core/vpTrackingException.h +++ b/modules/core/include/visp3/core/vpTrackingException.h @@ -88,8 +88,8 @@ class VISP_EXPORT vpTrackingException : public vpException setMessage(format, args); va_end(args); } - vpTrackingException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpTrackingException(int id) : vpException(id) { ; } + vpTrackingException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpTrackingException(int id) : vpException(id) { } }; #endif diff --git a/modules/io/include/visp3/io/vpParallelPortException.h b/modules/io/include/visp3/io/vpParallelPortException.h index 457fff7ef4..33b975a401 100644 --- a/modules/io/include/visp3/io/vpParallelPortException.h +++ b/modules/io/include/visp3/io/vpParallelPortException.h @@ -94,8 +94,8 @@ class VISP_EXPORT vpParallelPortException : public vpException setMessage(format, args); va_end(args); } - vpParallelPortException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpParallelPortException(int id) : vpException(id) { ; } + vpParallelPortException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpParallelPortException(int id) : vpException(id) { } }; #endif diff --git a/modules/vision/include/visp3/vision/vpCalibrationException.h b/modules/vision/include/visp3/vision/vpCalibrationException.h index 786dd3123f..daf94b3abb 100644 --- a/modules/vision/include/visp3/vision/vpCalibrationException.h +++ b/modules/vision/include/visp3/vision/vpCalibrationException.h @@ -96,8 +96,8 @@ class VISP_EXPORT vpCalibrationException : public vpException setMessage(format, args); va_end(args); } - vpCalibrationException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpCalibrationException(int id) : vpException(id) { ; } + vpCalibrationException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpCalibrationException(int id) : vpException(id) { } }; #endif diff --git a/modules/vision/include/visp3/vision/vpPoseException.h b/modules/vision/include/visp3/vision/vpPoseException.h index c1e76dd573..e626cc3f0b 100644 --- a/modules/vision/include/visp3/vision/vpPoseException.h +++ b/modules/vision/include/visp3/vision/vpPoseException.h @@ -89,8 +89,8 @@ class VISP_EXPORT vpPoseException : public vpException setMessage(format, args); va_end(args); } - vpPoseException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpPoseException(int id) : vpException(id) { ; } + vpPoseException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpPoseException(int id) : vpException(id) { } // vpPoseException() : vpException() { ;} }; diff --git a/modules/visual_features/include/visp3/visual_features/vpFeatureException.h b/modules/visual_features/include/visp3/visual_features/vpFeatureException.h index b2f4fcabd5..b188973a9f 100644 --- a/modules/visual_features/include/visp3/visual_features/vpFeatureException.h +++ b/modules/visual_features/include/visp3/visual_features/vpFeatureException.h @@ -90,8 +90,8 @@ class VISP_EXPORT vpFeatureException : public vpException setMessage(format, args); va_end(args); } - vpFeatureException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpFeatureException(int id) : vpException(id) { ; } + vpFeatureException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpFeatureException(int id) : vpException(id) { } }; #endif diff --git a/modules/vs/include/visp3/vs/vpServoException.h b/modules/vs/include/visp3/vs/vpServoException.h index 7b5ca8af89..4aceab9ce6 100644 --- a/modules/vs/include/visp3/vs/vpServoException.h +++ b/modules/vs/include/visp3/vs/vpServoException.h @@ -86,8 +86,8 @@ class VISP_EXPORT vpServoException : public vpException setMessage(format, args); va_end(args); } - vpServoException(int id, const std::string &msg) : vpException(id, msg) { ; } - explicit vpServoException(int id) : vpException(id) { ; } + vpServoException(int id, const std::string &msg) : vpException(id, msg) { } + explicit vpServoException(int id) : vpException(id) { } }; #endif From 335ae96dda370baf35d9a919fc8ab98270fbcfd2 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 21:20:52 +0200 Subject: [PATCH 05/26] Fix documentation indentation --- modules/core/include/visp3/core/vpDebug.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/core/include/visp3/core/vpDebug.h b/modules/core/include/visp3/core/vpDebug.h index 89995a0597..9712030e82 100644 --- a/modules/core/include/visp3/core/vpDebug.h +++ b/modules/core/include/visp3/core/vpDebug.h @@ -149,10 +149,10 @@ class vpTraceOutput public: /*! Constructor. - \param file Should be the name of the file where this constructor was - called. \param line Should be the line in file where this constructor was - called. \param func Should be the name of the function where this - constructor was called. \param error If true, writes to the error stream. + \param file Should be the name of the file where this constructor was called. + \param line Should be the line in file where this constructor was called. + \param func Should be the name of the function where this constructor was called. + \param error If true, writes to the error stream. \param s String to print before any other message (acts like a header). \note Call the constructor with something like vpTraceOutput(__FILE__,__LINE__, __FUNCTION__). From 62e12897151b3db03e029b8fa375b91dc82dd8c6 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 21:24:58 +0200 Subject: [PATCH 06/26] Fix wwarning detected with clang on windows : extra ';' after member function definition --- modules/core/include/visp3/core/vpForceTwistMatrix.h | 6 +++--- modules/core/include/visp3/core/vpQuaternionVector.h | 2 +- modules/core/include/visp3/core/vpRotationVector.h | 6 +++--- modules/core/include/visp3/core/vpRxyzVector.h | 6 +++--- modules/core/include/visp3/core/vpRzyxVector.h | 6 +++--- modules/core/include/visp3/core/vpRzyzVector.h | 6 +++--- modules/core/include/visp3/core/vpThetaUVector.h | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/modules/core/include/visp3/core/vpForceTwistMatrix.h b/modules/core/include/visp3/core/vpForceTwistMatrix.h index 9e137309d5..0b216e72f7 100644 --- a/modules/core/include/visp3/core/vpForceTwistMatrix.h +++ b/modules/core/include/visp3/core/vpForceTwistMatrix.h @@ -182,7 +182,7 @@ class VISP_EXPORT vpForceTwistMatrix : public vpArray2D /*! Destructor. */ - virtual ~vpForceTwistMatrix(){}; + virtual ~vpForceTwistMatrix(){} vpForceTwistMatrix buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R); vpForceTwistMatrix buildFrom(const vpTranslationVector &t, const vpThetaUVector &thetau); @@ -215,7 +215,7 @@ class VISP_EXPORT vpForceTwistMatrix : public vpArray2D (void)ncols; (void)flagNullify; throw(vpException(vpException::fatalError, "Cannot resize a velocity twist matrix")); - }; + } #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) /*! @@ -226,7 +226,7 @@ class VISP_EXPORT vpForceTwistMatrix : public vpArray2D \deprecated Provided only for compat with previous releases. This function does nothing. */ - vp_deprecated void init(){}; + vp_deprecated void init(){} /*! \deprecated You should rather use eye(). */ diff --git a/modules/core/include/visp3/core/vpQuaternionVector.h b/modules/core/include/visp3/core/vpQuaternionVector.h index 75c82895c8..7f8d3393f6 100644 --- a/modules/core/include/visp3/core/vpQuaternionVector.h +++ b/modules/core/include/visp3/core/vpQuaternionVector.h @@ -123,7 +123,7 @@ class VISP_EXPORT vpQuaternionVector : public vpRotationVector explicit vpQuaternionVector(const std::vector &q); //! Destructor. - virtual ~vpQuaternionVector(){}; + virtual ~vpQuaternionVector(){} vpQuaternionVector buildFrom(const double qx, const double qy, const double qz, const double qw); vpQuaternionVector buildFrom(const vpRotationMatrix &R); diff --git a/modules/core/include/visp3/core/vpRotationVector.h b/modules/core/include/visp3/core/vpRotationVector.h index b87770eec6..9b580c47a4 100644 --- a/modules/core/include/visp3/core/vpRotationVector.h +++ b/modules/core/include/visp3/core/vpRotationVector.h @@ -33,8 +33,8 @@ * *****************************************************************************/ -#ifndef vpRotationVECTOR_H -#define vpRotationVECTOR_H +#ifndef _vpRotationVector_h_ +#define _vpRotationVector_h_ /*! \file vpRotationVector.h @@ -112,7 +112,7 @@ class VISP_EXPORT vpRotationVector : public vpArray2D /*! Destructor. */ - virtual ~vpRotationVector(){}; + virtual ~vpRotationVector(){} /** @name Inherited functionalities from vpRotationVector */ //@{ diff --git a/modules/core/include/visp3/core/vpRxyzVector.h b/modules/core/include/visp3/core/vpRxyzVector.h index e99b234e20..c5ecf7a073 100644 --- a/modules/core/include/visp3/core/vpRxyzVector.h +++ b/modules/core/include/visp3/core/vpRxyzVector.h @@ -34,8 +34,8 @@ * *****************************************************************************/ -#ifndef vpRxyzVECTOR_H -#define vpRxyzVECTOR_H +#ifndef _vpRxyzVector_h_ +#define _vpRxyzVector_h_ /*! \file vpRxyzVector.h @@ -192,7 +192,7 @@ class VISP_EXPORT vpRxyzVector : public vpRotationVector explicit vpRxyzVector(const std::vector &rxyz); //! Destructor. - virtual ~vpRxyzVector(){}; + virtual ~vpRxyzVector(){} // convert a rotation matrix into Rxyz vector vpRxyzVector buildFrom(const vpRotationMatrix &R); diff --git a/modules/core/include/visp3/core/vpRzyxVector.h b/modules/core/include/visp3/core/vpRzyxVector.h index 22a7ca33ff..b68f68fab9 100644 --- a/modules/core/include/visp3/core/vpRzyxVector.h +++ b/modules/core/include/visp3/core/vpRzyxVector.h @@ -34,8 +34,8 @@ * *****************************************************************************/ -#ifndef vpRzyxVector_h -#define vpRzyxVector_h +#ifndef _vpRzyxVector_h_ +#define _vpRzyxVector_h_ /*! \file vpRzyxVector.h @@ -194,7 +194,7 @@ class VISP_EXPORT vpRzyxVector : public vpRotationVector explicit vpRzyxVector(const std::vector &rzyx); //! Destructor. - virtual ~vpRzyxVector(){}; + virtual ~vpRzyxVector(){} // convert a rotation matrix into Rzyx vector vpRzyxVector buildFrom(const vpRotationMatrix &R); diff --git a/modules/core/include/visp3/core/vpRzyzVector.h b/modules/core/include/visp3/core/vpRzyzVector.h index 8c695b2136..3c763a78c4 100644 --- a/modules/core/include/visp3/core/vpRzyzVector.h +++ b/modules/core/include/visp3/core/vpRzyzVector.h @@ -34,8 +34,8 @@ * *****************************************************************************/ -#ifndef vpRzyzVector_h -#define vpRzyzVector_h +#ifndef _vpRzyzVector_h_ +#define _vpRzyzVector_h_ /*! \file vpRzyzVector.h @@ -192,7 +192,7 @@ class VISP_EXPORT vpRzyzVector : public vpRotationVector explicit vpRzyzVector(const std::vector &rzyz); //! Destructor. - virtual ~vpRzyzVector(){}; + virtual ~vpRzyzVector(){} // convert a rotation matrix into Rzyz vector vpRzyzVector buildFrom(const vpRotationMatrix &R); diff --git a/modules/core/include/visp3/core/vpThetaUVector.h b/modules/core/include/visp3/core/vpThetaUVector.h index 4e38f7dd86..6487691a0c 100644 --- a/modules/core/include/visp3/core/vpThetaUVector.h +++ b/modules/core/include/visp3/core/vpThetaUVector.h @@ -33,8 +33,8 @@ * *****************************************************************************/ -#ifndef vpTHETAUVECTOR_H -#define vpTHETAUVECTOR_H +#ifndef _vpThetaUVector_h_ +#define _vpThetaUVector_h_ /*! \file vpThetaUVector.h @@ -193,7 +193,7 @@ class VISP_EXPORT vpThetaUVector : public vpRotationVector vpThetaUVector(double tux, double tuy, double tuz); //! Destructor. - virtual ~vpThetaUVector(){}; + virtual ~vpThetaUVector(){} // convert an homogeneous matrix into Theta U vector vpThetaUVector buildFrom(const vpHomogeneousMatrix &M); From db7359dfbd0f8728bc96e8562956513158ba5650 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 21:38:58 +0200 Subject: [PATCH 07/26] Fix warning detected with clang on windows: declaration shadows a field of 'vpImagePoint' --- modules/core/include/visp3/core/vpImagePoint.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/core/include/visp3/core/vpImagePoint.h b/modules/core/include/visp3/core/vpImagePoint.h index 748fba9ab9..b308257214 100644 --- a/modules/core/include/visp3/core/vpImagePoint.h +++ b/modules/core/include/visp3/core/vpImagePoint.h @@ -36,8 +36,8 @@ * *****************************************************************************/ -#ifndef vpImagePoint_H -#define vpImagePoint_H +#ifndef _vpImagePoint_h_ +#define _vpImagePoint_h_ /*! \file vpImagePoint.h @@ -221,18 +221,18 @@ class VISP_EXPORT vpImagePoint { const double line_slope = (end.get_i() - start.get_i()) / (end.get_j() - start.get_j()); if (fabs(end.get_j() - this->j) > fabs(end.get_i() - this->i)) { - double j = (end.get_j() > this->j ? this->j + 1 : this->j - 1); + double j_ = (end.get_j() > this->j ? this->j + 1 : this->j - 1); #if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98) - return {end.get_i() - line_slope * (end.get_j() - j), j}; + return {end.get_i() - line_slope * (end.get_j() - j_), j_}; #else - return vpImagePoint(end.get_i() - line_slope * (end.get_j() - j), j); + return vpImagePoint(end.get_i() - line_slope * (end.get_j() - j_), j_); #endif } else { - double i = (end.get_i() > this->i ? this->i + 1 : this->i - 1); + double i_ = (end.get_i() > this->i ? this->i + 1 : this->i - 1); #if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98) - return {i, end.get_j() - ((end.get_i() - i) / line_slope)}; + return {i_, end.get_j() - ((end.get_i() - i_) / line_slope)}; #else - return vpImagePoint(i, end.get_j() - ((end.get_i() - i) / line_slope)); + return vpImagePoint(i_, end.get_j() - ((end.get_i() - i_) / line_slope)); #endif } } From d6450f15dc7d4a3645178059b380b72c0f0643ca Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 21:58:05 +0200 Subject: [PATCH 08/26] Fix warning detected with clang on windows: enumeration value 'perspectiveProjWithoutDistortion' not explicitly handled in switch --- modules/core/include/visp3/core/vpCameraParameters.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/core/include/visp3/core/vpCameraParameters.h b/modules/core/include/visp3/core/vpCameraParameters.h index f196a30817..5bc255eccf 100644 --- a/modules/core/include/visp3/core/vpCameraParameters.h +++ b/modules/core/include/visp3/core/vpCameraParameters.h @@ -40,8 +40,8 @@ */ -#ifndef vpCameraParameters_H -#define vpCameraParameters_H +#ifndef _vpCameraParameters_h_ +#define _vpCameraParameters_h_ #include @@ -483,6 +483,8 @@ inline void to_json(nlohmann::json &j, const vpCameraParameters &cam) j["dist_coeffs"] = cam.m_dist_coefs; break; } + case vpCameraParameters::perspectiveProjWithoutDistortion: + break; default: break; } From 1984756236033cdf39dab03b2d4efb98e86e2650 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 22:17:36 +0200 Subject: [PATCH 09/26] Fix warning detected with clang on windows: variable 'deltav_py' may be uninitialized when used here --- modules/core/src/image/vpImageTools.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/src/image/vpImageTools.cpp b/modules/core/src/image/vpImageTools.cpp index 8cb40834ed..dcf990084d 100644 --- a/modules/core/src/image/vpImageTools.cpp +++ b/modules/core/src/image/vpImageTools.cpp @@ -357,7 +357,7 @@ void vpImageTools::initUndistortMap(const vpCameraParameters &cam, unsigned int float v0 = static_cast(cam.get_v0()); float px = static_cast(cam.get_px()); float py = static_cast(cam.get_py()); - float kud; + float kud = 0; std::vector dist_coefs; if (!is_KannalaBrandt) @@ -381,8 +381,8 @@ void vpImageTools::initUndistortMap(const vpCameraParameters &cam, unsigned int } float invpx, invpy; - float kud_px2 = 0., kud_py2 = 0., deltau_px, deltav_py; - float fr1, fr2; + float kud_px2 = 0., kud_py2 = 0., deltau_px, deltav_py = 0; + float fr1 = 0, fr2; float deltav, deltau; float u_float, v_float; int u_round, v_round; From 93e9d327c883f3d3e84acff10b6961fe3ea1320b Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 22:29:02 +0200 Subject: [PATCH 10/26] Fix warning detected with clang on windows : 'TARGET_OS_IPHONE' is not defined, evaluates to 0 --- modules/core/include/visp3/core/vpNetwork.h | 4 ++-- modules/core/src/tools/network/vpNetwork.cpp | 6 +++--- modules/core/src/tools/network/vpServer.cpp | 2 +- modules/tracker/mbt/src/klt/vpMbKltTracker.cpp | 6 +++--- modules/tracker/mbt/src/klt/vpMbtDistanceKltCylinder.cpp | 6 +++--- modules/tracker/mbt/src/klt/vpMbtDistanceKltPoints.cpp | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/core/include/visp3/core/vpNetwork.h b/modules/core/include/visp3/core/vpNetwork.h index cc2d39eb19..e1f2427f8f 100644 --- a/modules/core/include/visp3/core/vpNetwork.h +++ b/modules/core/include/visp3/core/vpNetwork.h @@ -291,7 +291,7 @@ template int vpNetwork::receive(T *object, const unsigned int &size } tv.tv_sec = tv_sec; -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE tv.tv_usec = (int)tv_usec; #else tv.tv_usec = tv_usec; @@ -375,7 +375,7 @@ int vpNetwork::receiveFrom(T *object, const unsigned int &receptorEmitting, cons } tv.tv_sec = tv_sec; -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE tv.tv_usec = (int)tv_usec; #else tv.tv_usec = tv_usec; diff --git a/modules/core/src/tools/network/vpNetwork.cpp b/modules/core/src/tools/network/vpNetwork.cpp index e4a90c610c..663181f382 100644 --- a/modules/core/src/tools/network/vpNetwork.cpp +++ b/modules/core/src/tools/network/vpNetwork.cpp @@ -47,7 +47,7 @@ vpNetwork::vpNetwork() tv_sec(0), tv_usec(10), verboseMode(false) { tv.tv_sec = tv_sec; -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE tv.tv_usec = (int)tv_usec; #else tv.tv_usec = tv_usec; @@ -656,7 +656,7 @@ int vpNetwork::_receiveRequestOnce() } tv.tv_sec = tv_sec; -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE tv.tv_usec = (int)tv_usec; #else tv.tv_usec = tv_usec; @@ -743,7 +743,7 @@ int vpNetwork::_receiveRequestOnceFrom(const unsigned int &receptorEmitting) } tv.tv_sec = tv_sec; -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE tv.tv_usec = (int)tv_usec; #else tv.tv_usec = tv_usec; diff --git a/modules/core/src/tools/network/vpServer.cpp b/modules/core/src/tools/network/vpServer.cpp index 7bb0d2e305..c7b92d368c 100644 --- a/modules/core/src/tools/network/vpServer.cpp +++ b/modules/core/src/tools/network/vpServer.cpp @@ -207,7 +207,7 @@ bool vpServer::checkForConnections() } tv.tv_sec = tv_sec; -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE tv.tv_usec = (int)tv_usec; #else tv.tv_usec = tv_usec; diff --git a/modules/tracker/mbt/src/klt/vpMbKltTracker.cpp b/modules/tracker/mbt/src/klt/vpMbKltTracker.cpp index 2b52d09560..05f0bbce43 100644 --- a/modules/tracker/mbt/src/klt/vpMbKltTracker.cpp +++ b/modules/tracker/mbt/src/klt/vpMbKltTracker.cpp @@ -383,7 +383,7 @@ std::map vpMbKltTracker::getKltImagePointsWithId() const long id; float x_tmp, y_tmp; tracker.getFeature((int)i, id, x_tmp, y_tmp); -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE kltPoints[(int)id] = vpImagePoint(y_tmp, x_tmp); #else kltPoints[id] = vpImagePoint(y_tmp, x_tmp); @@ -497,7 +497,7 @@ void vpMbKltTracker::setPose(const vpImage *const I, const vpImag std::map::const_iterator iter = kltpoly->getCurrentPoints().begin(); // nbCur+= (unsigned int)kltpoly->getCurrentPoints().size(); for (; iter != kltpoly->getCurrentPoints().end(); ++iter) { -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE if (std::find(init_ids.begin(), init_ids.end(), (long)(kltpoly->getCurrentPointsInd())[(int)iter->first]) != init_ids.end()) #else @@ -517,7 +517,7 @@ void vpMbKltTracker::setPose(const vpImage *const I, const vpImag cv::Point2f p((float)cdp[0], (float)cdp[1]); init_pts.push_back(p); -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE init_ids.push_back((size_t)(kltpoly->getCurrentPointsInd())[(int)iter->first]); #else init_ids.push_back((size_t)(kltpoly->getCurrentPointsInd())[(size_t)iter->first]); diff --git a/modules/tracker/mbt/src/klt/vpMbtDistanceKltCylinder.cpp b/modules/tracker/mbt/src/klt/vpMbtDistanceKltCylinder.cpp index 0c90f82799..adc7cd4038 100644 --- a/modules/tracker/mbt/src/klt/vpMbtDistanceKltCylinder.cpp +++ b/modules/tracker/mbt/src/klt/vpMbtDistanceKltCylinder.cpp @@ -148,7 +148,7 @@ void vpMbtDistanceKltCylinder::init(const vpKltOpencv &_tracker, const vpHomogen vpPixelMeterConversion::convertPoint(cam, x_tmp, y_tmp, xm, ym); double Z = computeZ(xm, ym); if (!vpMath::isNaN(Z)) { -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE initPoints[(int)id] = vpImagePoint(y_tmp, x_tmp); curPoints[(int)id] = vpImagePoint(y_tmp, x_tmp); curPointsInd[(int)id] = (int)i; @@ -162,7 +162,7 @@ void vpMbtDistanceKltCylinder::init(const vpKltOpencv &_tracker, const vpHomogen vpPoint p; p.setWorldCoordinates(xm * Z, ym * Z, Z); -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE initPoints3D[(int)id] = p; #else initPoints3D[id] = p; @@ -201,7 +201,7 @@ unsigned int vpMbtDistanceKltCylinder::computeNbDetectedCurrent(const vpKltOpenc for (unsigned int i = 0; i < static_cast(_tracker.getNbFeatures()); i++) { _tracker.getFeature((int)i, id, x, y); if (isTrackedFeature((int)id)) { -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE curPoints[(int)id] = vpImagePoint(static_cast(y), static_cast(x)); curPointsInd[(int)id] = (int)i; #else diff --git a/modules/tracker/mbt/src/klt/vpMbtDistanceKltPoints.cpp b/modules/tracker/mbt/src/klt/vpMbtDistanceKltPoints.cpp index d4990cc7af..56bef81a4e 100644 --- a/modules/tracker/mbt/src/klt/vpMbtDistanceKltPoints.cpp +++ b/modules/tracker/mbt/src/klt/vpMbtDistanceKltPoints.cpp @@ -106,7 +106,7 @@ void vpMbtDistanceKltPoints::init(const vpKltOpencv &_tracker, const vpImage(_tracker.getNbFeatures()); i++) { _tracker.getFeature((int)i, id, x, y); if (isTrackedFeature((int)id) && vpMeTracker::inMask(mask, (unsigned int)y, (unsigned int)x)) { -#if TARGET_OS_IPHONE +#ifdef TARGET_OS_IPHONE curPoints[(int)id] = vpImagePoint(static_cast(y), static_cast(x)); curPointsInd[(int)id] = (int)i; #else From fed230f7f40a477206ef75d9808580a473791b69 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 22:39:52 +0200 Subject: [PATCH 11/26] Fix warning detected with clang on windows: 'break' will never be executed --- .../core/src/math/kalman/vpLinearKalmanFilterInstantiation.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/core/src/math/kalman/vpLinearKalmanFilterInstantiation.cpp b/modules/core/src/math/kalman/vpLinearKalmanFilterInstantiation.cpp index f2b0a0c347..fe71a5d43f 100644 --- a/modules/core/src/math/kalman/vpLinearKalmanFilterInstantiation.cpp +++ b/modules/core/src/math/kalman/vpLinearKalmanFilterInstantiation.cpp @@ -806,7 +806,6 @@ void vpLinearKalmanFilterInstantiation::filter(vpColVector &z) case unknown: vpERROR_TRACE("Kalman state model is not set"); throw(vpException(vpException::notInitialized, "Kalman state model is not set")); - break; } iter++; From de427eefade056fc1a6359e2ba6a997e08cc8741 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 22:48:46 +0200 Subject: [PATCH 12/26] Fix build with clang on windows where -avx and -avx2 flags are requested --- 3rdparty/simdlib/CMakeLists.txt | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/3rdparty/simdlib/CMakeLists.txt b/3rdparty/simdlib/CMakeLists.txt index 6260825803..63fa75c78d 100644 --- a/3rdparty/simdlib/CMakeLists.txt +++ b/3rdparty/simdlib/CMakeLists.txt @@ -25,7 +25,7 @@ if(X86 OR X86_64) set(AVX_FLAG "") set(AVX2_FLAG "") - if(MSVC) + if(MSVC AND NOT ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))) if(NOT MSVC64) vp_check_compiler_flag(CXX "/arch:SSE2" HAVE_SSE2_FLAG "${VISP_SOURCE_DIR}/cmake/checks/cpu_sse2.cpp") endif() @@ -136,6 +136,11 @@ if(X86 OR X86_64) if(HAVE_NO_MISSING_FIELD_FLAG) set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -Wno-missing-field-initializers") endif() + + if((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + # Clang under windows needs AVX flags + set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG} ${AVX2_FLAG}") + endif() endif() file(GLOB_RECURSE SIMD_BASE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Simd/SimdBase*.cpp) @@ -148,22 +153,10 @@ if(X86 OR X86_64) set_source_files_properties(${SIMD_SSE41_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${SSE4_2_FLAG}") file(GLOB_RECURSE SIMD_AVX1_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Simd/SimdAvx1*.cpp) - if(MSVC) - set_source_files_properties(${SIMD_AVX1_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG}") - elseif((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) - set_source_files_properties(${SIMD_AVX1_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG}") - else() - set_source_files_properties(${SIMD_AVX1_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG}") - endif() + set_source_files_properties(${SIMD_AVX1_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG}") file(GLOB_RECURSE SIMD_AVX2_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Simd/SimdAvx2*.cpp) - if(MSVC) - set_source_files_properties(${SIMD_AVX2_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}") - elseif((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) - set_source_files_properties(${SIMD_AVX2_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}") - else() - set_source_files_properties(${SIMD_AVX2_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}") - endif() + set_source_files_properties(${SIMD_AVX2_SRC} PROPERTIES COMPILE_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}") set(SIMD_LIB_FLAGS "${COMMON_CXX_FLAGS} ${AVX2_FLAG}") set(SIMD_ALG_SRC ${SIMD_BASE_SRC} ${SIMD_SSE2_SRC} ${SIMD_SSE41_SRC} ${SIMD_AVX1_SRC} ${SIMD_AVX2_SRC}) From 47c9a8bcd4a64eae395d338b7eb9437e9d6e0c0c Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 22:49:45 +0200 Subject: [PATCH 13/26] Mute warning detected with clang on windows --- 3rdparty/clapack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/clapack/CMakeLists.txt b/3rdparty/clapack/CMakeLists.txt index b8f4699e88..21e86557a7 100644 --- a/3rdparty/clapack/CMakeLists.txt +++ b/3rdparty/clapack/CMakeLists.txt @@ -37,7 +37,7 @@ if(NOT BUILD_SHARED_LIBS) vp_install_target(${LAPACK_LIBRARY} EXPORT VISPModules ARCHIVE DESTINATION ${VISP_3P_LIB_INSTALL_PATH} COMPONENT dev) endif() -if(MSVC) +if(MSVC AND NOT ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))) # Disable Visual C++ warnings foreach(f ${lib_srcs}) vp_set_source_file_compile_flag(${f} /wd4244 /wd4267 /wd4273 /wd4554 /wd4723 /wd4996) From 2806f9e32b45857bb96a5c2bf25f5bd147d7f0c0 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 22:51:25 +0200 Subject: [PATCH 14/26] Remove clang -dumpmachine flag usage on windows This flag is not recognized --- cmake/VISPDetectPlatform.cmake | 36 ++++++++----------- .../templates/VISPConfig.root-WIN32.cmake.in | 6 +--- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/cmake/VISPDetectPlatform.cmake b/cmake/VISPDetectPlatform.cmake index 99ad52ef51..e4f7466bdb 100644 --- a/cmake/VISPDetectPlatform.cmake +++ b/cmake/VISPDetectPlatform.cmake @@ -70,21 +70,9 @@ if(MSVC AND CMAKE_C_COMPILER MATCHES "icc|icl") set(CV_ICC __INTEL_COMPILER_FOR_WINDOWS) endif() -if(CMAKE_COMPILER_IS_GNUCXX) - if(WIN32) - execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine - OUTPUT_VARIABLE VISP_GCC_TARGET_MACHINE - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(VISP_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") - set(MINGW64 1) - endif() - endif() -endif() - -if(MSVC64 OR MINGW64) - set(X86_64 1) -elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING)) - set(X86 1) +message(STATUS "Detected processor: ${CMAKE_SYSTEM_PROCESSOR}") +if(VISP_SKIP_SYSTEM_PROCESSOR_DETECTION) + # custom setup: required variables are passed through cache / CMake's command-line elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") set(X86_64 1) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*") @@ -101,13 +89,21 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips.*|MIPS.*)") set(MIPS 1) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv.*|RISCV.*)") set(RISCV 1) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(loongarch64.*|LOONGARCH64.*)") + set(LOONGARCH64 1) +else() + if(NOT VISP_SUPPRESS_MESSAGE_UNRECOGNIZED_SYSTEM_PROCESSOR) + message(WARNING "ViSP: unrecognized target processor configuration") + endif() endif() # Workaround for 32-bit operating systems on 64-bit x86_64 processor if(X86_64 AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT FORCE_X86_64) message(STATUS "sizeof(void) = 4 on x86 / x86_64 processor. Assume 32-bit compilation mode (X86=1)") - unset(X86_64) - set(X86 1) + if (X86_64) + unset(X86_64) + set(X86 1) + endif() endif() # Workaround for 32-bit operating systems on aarch64 processor if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND AARCH64 AND NOT FORCE_AARCH64) @@ -165,11 +161,7 @@ elseif(MSVC) elseif(MINGW) set(VISP_RUNTIME mingw) - execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine - OUTPUT_VARIABLE VISP_GCC_TARGET_MACHINE - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(VISP_GCC_TARGET_MACHINE MATCHES "64") - set(MINGW64 1) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") set(VISP_ARCH x64) else() set(VISP_ARCH x86) diff --git a/cmake/templates/VISPConfig.root-WIN32.cmake.in b/cmake/templates/VISPConfig.root-WIN32.cmake.in index 989f80c67d..d038ba76a2 100644 --- a/cmake/templates/VISPConfig.root-WIN32.cmake.in +++ b/cmake/templates/VISPConfig.root-WIN32.cmake.in @@ -102,11 +102,7 @@ elseif(MSVC) elseif(MINGW) set(VISP_RUNTIME mingw) - execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine - OUTPUT_VARIABLE VISP_GCC_TARGET_MACHINE - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(VISP_GCC_TARGET_MACHINE MATCHES "64") - set(MINGW64 1) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") set(VISP_ARCH x64) else() set(VISP_ARCH x86) From ad1592dbe06664e1c017927571b9b5d28c481934 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sat, 15 Jul 2023 22:52:36 +0200 Subject: [PATCH 15/26] Mute warnings detected with clang on windows --- cmake/AddExtraCompilationFlags.cmake | 56 +++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/cmake/AddExtraCompilationFlags.cmake b/cmake/AddExtraCompilationFlags.cmake index b6cfa7b8ee..0f35b9848e 100644 --- a/cmake/AddExtraCompilationFlags.cmake +++ b/cmake/AddExtraCompilationFlags.cmake @@ -126,7 +126,9 @@ if(BUILD_COVERAGE) endif() if(CMAKE_COMPILER_IS_GNUCXX) - add_extra_compiler_option(-fvisibility=hidden) + if(WIN32 AND NOT ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))) + add_extra_compiler_option(-fvisibility=hidden) + endif() if(ENABLE_AVX AND X86_64) add_extra_compiler_option(-mavx) @@ -178,6 +180,58 @@ if(MSVC) # Avoid build error C1128 list(APPEND VISP_EXTRA_CXX_FLAGS "/bigobj") endif() + if((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + add_extra_compiler_option("-Wno-c++98-compat") # turn off warning due to json + add_extra_compiler_option("-Wno-c++98-compat-pedantic") + add_extra_compiler_option("-Wno-c11-extensions") + add_extra_compiler_option("-Wno-covered-switch-default") + add_extra_compiler_option("-Wno-unused-template") # turn off warning due to eigen + add_extra_compiler_option("-Wno-deprecated-copy-with-dtor") + add_extra_compiler_option("-Wno-anon-enum-enum-conversion") # turn off warning due to opencv + add_extra_compiler_option("-Wno-cast-align") + add_extra_compiler_option("-Wno-cast-qual") + add_extra_compiler_option("-Wno-covered-switch-default") + add_extra_compiler_option("-Wno-deprecated-copy-with-user-provided-dtor") + add_extra_compiler_option("-Wno-documentation") + add_extra_compiler_option("-Wno-documentation-deprecated-sync") + add_extra_compiler_option("-Wno-documentation-unknown-command") + add_extra_compiler_option("-Wno-double-promotion") + add_extra_compiler_option("-Wno-enum-enum-conversion") + add_extra_compiler_option("-Wno-exit-time-destructors") + add_extra_compiler_option("-Wno-extra-semi") + add_extra_compiler_option("-Wno-extra-semi-stmt") + add_extra_compiler_option("-Wno-float-equal") + add_extra_compiler_option("-Wno-implicit-int-float-conversion") + add_extra_compiler_option("-Wno-implicit-float-conversion") + add_extra_compiler_option("-Wno-inconsistent-missing-destructor-override") + add_extra_compiler_option("-Wno-language-extension-token") + add_extra_compiler_option("-Wno-microsoft-enum-value") + add_extra_compiler_option("-Wno-newline-eof") + add_extra_compiler_option("-Wno-old-style-cast") + add_extra_compiler_option("-Wno-reserved-identifier") + add_extra_compiler_option("-Wno-shift-sign-overflow") + add_extra_compiler_option("-Wno-sign-conversion") + add_extra_compiler_option("-Wno-undefined-reinterpret-cast") + add_extra_compiler_option("-Wno-zero-as-null-pointer-constant") + add_extra_compiler_option("-Wno-cast-function-type") # ViSP + add_extra_compiler_option("-Wno-comma") + add_extra_compiler_option("-Wno-deprecated-dynamic-exception-spec") + add_extra_compiler_option("-Wno-format-nonliteral") + add_extra_compiler_option("-Wno-global-constructors") + add_extra_compiler_option("-Wno-implicit-int-conversion") + add_extra_compiler_option("-Wno-implicit-fallthrough") + add_extra_compiler_option("-Wno-missing-noreturn") + add_extra_compiler_option("-Wno-missing-variable-declarations") + add_extra_compiler_option("-Wno-missing-prototypes") + add_extra_compiler_option("-Wno-nonportable-system-include-path") + add_extra_compiler_option("-Wno-shadow") + add_extra_compiler_option("-Wno-suggest-destructor-override") + add_extra_compiler_option("-Wno-suggest-override") + add_extra_compiler_option("-Wno-switch-enum") + add_extra_compiler_option("-Wno-unreachable-code") + add_extra_compiler_option("-Wno-unused-macros") + add_extra_compiler_option("-Wno-unused-member-function") + endif() endif() # adjust -Wl,-rpath-link From 7aba004d3eb5a31606d3837add889d6389cafd3e Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sun, 16 Jul 2023 10:28:45 +0200 Subject: [PATCH 16/26] Fix warning detected with clang on windows : macro name is a reserved identifier --- modules/core/include/visp3/core/vpMath.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/core/include/visp3/core/vpMath.h b/modules/core/include/visp3/core/vpMath.h index 10dfd1c4fc..1813357f97 100644 --- a/modules/core/include/visp3/core/vpMath.h +++ b/modules/core/include/visp3/core/vpMath.h @@ -51,8 +51,10 @@ // Define _USE_MATH_DEFINES before including to expose these macro // definitions for common math constants. These are placed under an #ifdef // since these commonly-defined names are not part of the C or C++ standards +#ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif +#endif #include #include From 4c03fd54b3aee7eb20018f2dd8ff265ad78ffd73 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Sun, 16 Jul 2023 10:58:22 +0200 Subject: [PATCH 17/26] Update VISP_INPUT_IMAGE_PATH in ci to be more explicit pointing to the visp-images folder --- .github/workflows/macos-ustk.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/other-arch.yml | 2 +- .github/workflows/ubuntu-dep-apt.yml | 2 +- .github/workflows/ubuntu-dep-src.yml | 2 +- .github/workflows/ubuntu-sanitizers.yml | 2 +- .github/workflows/ubuntu-ustk.yml | 2 +- .github/workflows/valgrind.yml | 2 +- .github/workflows/windows-clang.yaml | 3 ++- .github/workflows/windows-msvc.yaml | 5 +++-- 10 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/macos-ustk.yml b/.github/workflows/macos-ustk.yml index beabcfc71f..eeee203e77 100644 --- a/.github/workflows/macos-ustk.yml +++ b/.github/workflows/macos-ustk.yml @@ -42,7 +42,7 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV echo ${VISP_INPUT_IMAGE_PATH} - name: Clone ustk-dataset diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index da6a0f65ba..ecd5537926 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -49,7 +49,7 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV echo ${VISP_INPUT_IMAGE_PATH} - name: Clone visp_sample diff --git a/.github/workflows/other-arch.yml b/.github/workflows/other-arch.yml index 11478403c1..e45cab8a58 100644 --- a/.github/workflows/other-arch.yml +++ b/.github/workflows/other-arch.yml @@ -64,7 +64,7 @@ jobs: apt-get update && apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - export VISP_INPUT_IMAGE_PATH=$HOME + export VISP_INPUT_IMAGE_PATH=$HOME/visp-images echo ${VISP_INPUT_IMAGE_PATH} pwd diff --git a/.github/workflows/ubuntu-dep-apt.yml b/.github/workflows/ubuntu-dep-apt.yml index 99dffa743b..df6cbce732 100644 --- a/.github/workflows/ubuntu-dep-apt.yml +++ b/.github/workflows/ubuntu-dep-apt.yml @@ -50,7 +50,7 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV echo ${VISP_INPUT_IMAGE_PATH} - name: Clone visp_sample diff --git a/.github/workflows/ubuntu-dep-src.yml b/.github/workflows/ubuntu-dep-src.yml index 4f0fc97c16..a4f3ce68b8 100644 --- a/.github/workflows/ubuntu-dep-src.yml +++ b/.github/workflows/ubuntu-dep-src.yml @@ -118,7 +118,7 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV echo ${VISP_INPUT_IMAGE_PATH} - name: Configure CMake diff --git a/.github/workflows/ubuntu-sanitizers.yml b/.github/workflows/ubuntu-sanitizers.yml index fd77b7bd2b..7f823105af 100644 --- a/.github/workflows/ubuntu-sanitizers.yml +++ b/.github/workflows/ubuntu-sanitizers.yml @@ -47,7 +47,7 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV echo ${VISP_INPUT_IMAGE_PATH} - name: Configure CMake diff --git a/.github/workflows/ubuntu-ustk.yml b/.github/workflows/ubuntu-ustk.yml index ff25b9f3a9..58f892f24f 100644 --- a/.github/workflows/ubuntu-ustk.yml +++ b/.github/workflows/ubuntu-ustk.yml @@ -48,7 +48,7 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV echo ${VISP_INPUT_IMAGE_PATH} - name: Clone ustk-dataset diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index b93a729297..493dee0990 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -36,7 +36,7 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV echo ${VISP_INPUT_IMAGE_PATH} - name: Configure CMake diff --git a/.github/workflows/windows-clang.yaml b/.github/workflows/windows-clang.yaml index 0b88a921b8..0ba038d05a 100644 --- a/.github/workflows/windows-clang.yaml +++ b/.github/workflows/windows-clang.yaml @@ -38,7 +38,8 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH: ${{ env.VISP_INPUT_IMAGE_PATH }}" - name: Configure ViSP working-directory: ${{ github.workspace }} diff --git a/.github/workflows/windows-msvc.yaml b/.github/workflows/windows-msvc.yaml index 99d091fa02..aa9fda4433 100644 --- a/.github/workflows/windows-msvc.yaml +++ b/.github/workflows/windows-msvc.yaml @@ -37,14 +37,15 @@ jobs: # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images - echo "VISP_INPUT_IMAGE_PATH=$HOME" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV + echo "VISP_INPUT_IMAGE_PATH: ${{ env.VISP_INPUT_IMAGE_PATH }}" - name: Configure ViSP working-directory: ${{ github.workspace }} run: | mkdir build cd build - cmake .. -G "Visual Studio 16 2019" -A "x64" -DCMAKE_GENERATOR_PLATFORM=x64 + cmake .. -G "Visual Studio 16 2019" -A "x64" type ViSP-third-party.txt - name: Build ViSP From a8b18a813ea0c6c6ea79de1f687754edcfcbfc6b Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Mon, 17 Jul 2023 00:25:43 +0200 Subject: [PATCH 18/26] Set VISP_INPUT_IMAGE_PATH explicitely --- .github/workflows/windows-clang.yaml | 4 +++- .github/workflows/windows-msvc.yaml | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows-clang.yaml b/.github/workflows/windows-clang.yaml index 0ba038d05a..908a6c1a51 100644 --- a/.github/workflows/windows-clang.yaml +++ b/.github/workflows/windows-clang.yaml @@ -70,7 +70,9 @@ jobs: - name: Test ViSP working-directory: build run: | - echo "VISP_INPUT_IMAGE_PATH: ${{ env.VISP_INPUT_IMAGE_PATH }}" + set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }} + echo "VISP_INPUT_IMAGE_PATH: " + echo %VISP_INPUT_IMAGE_PATH% set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc16\bin echo "PATH: " echo %PATH% diff --git a/.github/workflows/windows-msvc.yaml b/.github/workflows/windows-msvc.yaml index aa9fda4433..d1fd145741 100644 --- a/.github/workflows/windows-msvc.yaml +++ b/.github/workflows/windows-msvc.yaml @@ -38,7 +38,6 @@ jobs: run: | git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV - echo "VISP_INPUT_IMAGE_PATH: ${{ env.VISP_INPUT_IMAGE_PATH }}" - name: Configure ViSP working-directory: ${{ github.workspace }} @@ -66,7 +65,9 @@ jobs: - name: Test ViSP working-directory: build run: | - echo "VISP_INPUT_IMAGE_PATH: ${{ env.VISP_INPUT_IMAGE_PATH }}" + set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }} + echo "VISP_INPUT_IMAGE_PATH: " + echo %VISP_INPUT_IMAGE_PATH% set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc16\bin echo "PATH: " echo %PATH% From a4acf653d0af97427a85c706729715aa6119a0a8 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Mon, 17 Jul 2023 00:33:22 +0200 Subject: [PATCH 19/26] Improve add_extra_compiler_option cmake macro (inspired from OpenCV) --- cmake/VISPUtils.cmake | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/cmake/VISPUtils.cmake b/cmake/VISPUtils.cmake index a027269087..32a8803f1e 100644 --- a/cmake/VISPUtils.cmake +++ b/cmake/VISPUtils.cmake @@ -928,12 +928,34 @@ macro(vp_check_compiler_flag LANG FLAG RESULT) else() set(__msg "") endif() + if(CMAKE_REQUIRED_LIBRARIES) + set(__link_libs LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(__link_libs) + endif() + set(__cmake_flags "") + if(CMAKE_EXE_LINKER_FLAGS) # CMP0056 do this on new CMake + list(APPEND __cmake_flags "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}") + endif() + + # CMP0067 do this on new CMake + if(DEFINED CMAKE_CXX_STANDARD) + list(APPEND __cmake_flags "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}") + endif() + if(DEFINED CMAKE_CXX_STANDARD_REQUIRED) + list(APPEND __cmake_flags "-DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}") + endif() + if(DEFINED CMAKE_CXX_EXTENSIONS) + list(APPEND __cmake_flags "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") + endif() + message(STATUS "Performing Test ${RESULT}${__msg}") try_compile(${RESULT} "${CMAKE_BINARY_DIR}" "${_fname}" - CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}" # CMP0056 do this on new CMake + CMAKE_FLAGS ${__cmake_flags} COMPILE_DEFINITIONS "${FLAG}" + ${__link_libs} OUTPUT_VARIABLE OUTPUT) if(${RESULT}) @@ -993,8 +1015,10 @@ macro(vp_check_flag_support lang flag varname base_options) endif() string(TOUPPER "${flag}" ${varname}) string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}") - string(REGEX REPLACE " -|-|=| |\\." "_" ${varname} "${${varname}}") - vp_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN}) + string(REGEX REPLACE " -|-|=| |\\.|," "_" ${varname} "${${varname}}") + if(DEFINED CMAKE_${_lang}_COMPILER) + vp_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN}) + endif() endmacro() # turns off warnings From 9295490ded7786bfc465b8fb15db7ffd6ffae869 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Mon, 17 Jul 2023 00:34:32 +0200 Subject: [PATCH 20/26] Fix previous changes around -fvisibility=hidden that is required on osx ci --- cmake/AddExtraCompilationFlags.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmake/AddExtraCompilationFlags.cmake b/cmake/AddExtraCompilationFlags.cmake index 0f35b9848e..b999cce86d 100644 --- a/cmake/AddExtraCompilationFlags.cmake +++ b/cmake/AddExtraCompilationFlags.cmake @@ -42,14 +42,14 @@ macro(add_extra_compiler_option option) if(CMAKE_BUILD_TYPE) set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE}) endif() - vp_check_flag_support(CXX "${option}" _varname "") + vp_check_flag_support(CXX "${option}" _varname "${VISP_EXTRA_CXX_FLAGS} ${ARGN}") if(_varname) - list(APPEND VISP_EXTRA_CXX_FLAGS ${option}) + set(VISP_EXTRA_CXX_FLAGS "${VISP_EXTRA_CXX_FLAGS} ${option}") endif() - vp_check_flag_support(C "${option}" _varname "") + vp_check_flag_support(C "${option}" _varname "${VISP_EXTRA_C_FLAGS} ${ARGN}") if(_varname) - list(APPEND VISP_EXTRA_C_FLAGS ${option}) + set(VISP_EXTRA_C_FLAGS "${VISP_EXTRA_C_FLAGS} ${option}") endif() endmacro() @@ -126,7 +126,7 @@ if(BUILD_COVERAGE) endif() if(CMAKE_COMPILER_IS_GNUCXX) - if(WIN32 AND NOT ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))) + if(NOT (WIN32 AND ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))) add_extra_compiler_option(-fvisibility=hidden) endif() @@ -215,6 +215,7 @@ if(MSVC) add_extra_compiler_option("-Wno-zero-as-null-pointer-constant") add_extra_compiler_option("-Wno-cast-function-type") # ViSP add_extra_compiler_option("-Wno-comma") + add_extra_compiler_option("-Wno-deprecated-copy-dtor") add_extra_compiler_option("-Wno-deprecated-dynamic-exception-spec") add_extra_compiler_option("-Wno-format-nonliteral") add_extra_compiler_option("-Wno-global-constructors") From 2fa9fa043514f79292cde561b536e8ac4bd7b278 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Mon, 17 Jul 2023 07:14:59 +0200 Subject: [PATCH 21/26] Atempt to fix macos ci removing flags introduced to mute clang on windows warnings --- cmake/AddExtraCompilationFlags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/AddExtraCompilationFlags.cmake b/cmake/AddExtraCompilationFlags.cmake index b999cce86d..a0bf3b085b 100644 --- a/cmake/AddExtraCompilationFlags.cmake +++ b/cmake/AddExtraCompilationFlags.cmake @@ -180,7 +180,7 @@ if(MSVC) # Avoid build error C1128 list(APPEND VISP_EXTRA_CXX_FLAGS "/bigobj") endif() - if((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + if(REMOVE_FS AND (CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) add_extra_compiler_option("-Wno-c++98-compat") # turn off warning due to json add_extra_compiler_option("-Wno-c++98-compat-pedantic") add_extra_compiler_option("-Wno-c11-extensions") From 7791d45cc6986f7cff10d734e58ba6b186979477 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Mon, 17 Jul 2023 10:00:26 +0200 Subject: [PATCH 22/26] New attempt by commenting lines --- cmake/AddExtraCompilationFlags.cmake | 110 +++++++++++++-------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/cmake/AddExtraCompilationFlags.cmake b/cmake/AddExtraCompilationFlags.cmake index a0bf3b085b..7f761ede09 100644 --- a/cmake/AddExtraCompilationFlags.cmake +++ b/cmake/AddExtraCompilationFlags.cmake @@ -126,9 +126,9 @@ if(BUILD_COVERAGE) endif() if(CMAKE_COMPILER_IS_GNUCXX) - if(NOT (WIN32 AND ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))) + #if(NOT (WIN32 AND ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))) add_extra_compiler_option(-fvisibility=hidden) - endif() + #endif() if(ENABLE_AVX AND X86_64) add_extra_compiler_option(-mavx) @@ -180,59 +180,59 @@ if(MSVC) # Avoid build error C1128 list(APPEND VISP_EXTRA_CXX_FLAGS "/bigobj") endif() - if(REMOVE_FS AND (CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) - add_extra_compiler_option("-Wno-c++98-compat") # turn off warning due to json - add_extra_compiler_option("-Wno-c++98-compat-pedantic") - add_extra_compiler_option("-Wno-c11-extensions") - add_extra_compiler_option("-Wno-covered-switch-default") - add_extra_compiler_option("-Wno-unused-template") # turn off warning due to eigen - add_extra_compiler_option("-Wno-deprecated-copy-with-dtor") - add_extra_compiler_option("-Wno-anon-enum-enum-conversion") # turn off warning due to opencv - add_extra_compiler_option("-Wno-cast-align") - add_extra_compiler_option("-Wno-cast-qual") - add_extra_compiler_option("-Wno-covered-switch-default") - add_extra_compiler_option("-Wno-deprecated-copy-with-user-provided-dtor") - add_extra_compiler_option("-Wno-documentation") - add_extra_compiler_option("-Wno-documentation-deprecated-sync") - add_extra_compiler_option("-Wno-documentation-unknown-command") - add_extra_compiler_option("-Wno-double-promotion") - add_extra_compiler_option("-Wno-enum-enum-conversion") - add_extra_compiler_option("-Wno-exit-time-destructors") - add_extra_compiler_option("-Wno-extra-semi") - add_extra_compiler_option("-Wno-extra-semi-stmt") - add_extra_compiler_option("-Wno-float-equal") - add_extra_compiler_option("-Wno-implicit-int-float-conversion") - add_extra_compiler_option("-Wno-implicit-float-conversion") - add_extra_compiler_option("-Wno-inconsistent-missing-destructor-override") - add_extra_compiler_option("-Wno-language-extension-token") - add_extra_compiler_option("-Wno-microsoft-enum-value") - add_extra_compiler_option("-Wno-newline-eof") - add_extra_compiler_option("-Wno-old-style-cast") - add_extra_compiler_option("-Wno-reserved-identifier") - add_extra_compiler_option("-Wno-shift-sign-overflow") - add_extra_compiler_option("-Wno-sign-conversion") - add_extra_compiler_option("-Wno-undefined-reinterpret-cast") - add_extra_compiler_option("-Wno-zero-as-null-pointer-constant") - add_extra_compiler_option("-Wno-cast-function-type") # ViSP - add_extra_compiler_option("-Wno-comma") - add_extra_compiler_option("-Wno-deprecated-copy-dtor") - add_extra_compiler_option("-Wno-deprecated-dynamic-exception-spec") - add_extra_compiler_option("-Wno-format-nonliteral") - add_extra_compiler_option("-Wno-global-constructors") - add_extra_compiler_option("-Wno-implicit-int-conversion") - add_extra_compiler_option("-Wno-implicit-fallthrough") - add_extra_compiler_option("-Wno-missing-noreturn") - add_extra_compiler_option("-Wno-missing-variable-declarations") - add_extra_compiler_option("-Wno-missing-prototypes") - add_extra_compiler_option("-Wno-nonportable-system-include-path") - add_extra_compiler_option("-Wno-shadow") - add_extra_compiler_option("-Wno-suggest-destructor-override") - add_extra_compiler_option("-Wno-suggest-override") - add_extra_compiler_option("-Wno-switch-enum") - add_extra_compiler_option("-Wno-unreachable-code") - add_extra_compiler_option("-Wno-unused-macros") - add_extra_compiler_option("-Wno-unused-member-function") - endif() + #if((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + # add_extra_compiler_option("-Wno-c++98-compat") # turn off warning due to json + # add_extra_compiler_option("-Wno-c++98-compat-pedantic") + # add_extra_compiler_option("-Wno-c11-extensions") + # add_extra_compiler_option("-Wno-covered-switch-default") + # add_extra_compiler_option("-Wno-unused-template") # turn off warning due to eigen + # add_extra_compiler_option("-Wno-deprecated-copy-with-dtor") + # add_extra_compiler_option("-Wno-anon-enum-enum-conversion") # turn off warning due to opencv + # add_extra_compiler_option("-Wno-cast-align") + # add_extra_compiler_option("-Wno-cast-qual") + # add_extra_compiler_option("-Wno-covered-switch-default") + # add_extra_compiler_option("-Wno-deprecated-copy-with-user-provided-dtor") + # add_extra_compiler_option("-Wno-documentation") + # add_extra_compiler_option("-Wno-documentation-deprecated-sync") + # add_extra_compiler_option("-Wno-documentation-unknown-command") + # add_extra_compiler_option("-Wno-double-promotion") + # add_extra_compiler_option("-Wno-enum-enum-conversion") + # add_extra_compiler_option("-Wno-exit-time-destructors") + # add_extra_compiler_option("-Wno-extra-semi") + # add_extra_compiler_option("-Wno-extra-semi-stmt") + # add_extra_compiler_option("-Wno-float-equal") + # add_extra_compiler_option("-Wno-implicit-int-float-conversion") + # add_extra_compiler_option("-Wno-implicit-float-conversion") + # add_extra_compiler_option("-Wno-inconsistent-missing-destructor-override") + # add_extra_compiler_option("-Wno-language-extension-token") + # add_extra_compiler_option("-Wno-microsoft-enum-value") + # add_extra_compiler_option("-Wno-newline-eof") + # add_extra_compiler_option("-Wno-old-style-cast") + # add_extra_compiler_option("-Wno-reserved-identifier") + # add_extra_compiler_option("-Wno-shift-sign-overflow") + # add_extra_compiler_option("-Wno-sign-conversion") + # add_extra_compiler_option("-Wno-undefined-reinterpret-cast") + # add_extra_compiler_option("-Wno-zero-as-null-pointer-constant") + # add_extra_compiler_option("-Wno-cast-function-type") # ViSP + # add_extra_compiler_option("-Wno-comma") + # add_extra_compiler_option("-Wno-deprecated-copy-dtor") + # add_extra_compiler_option("-Wno-deprecated-dynamic-exception-spec") + # add_extra_compiler_option("-Wno-format-nonliteral") + # add_extra_compiler_option("-Wno-global-constructors") + # add_extra_compiler_option("-Wno-implicit-int-conversion") + # add_extra_compiler_option("-Wno-implicit-fallthrough") + # add_extra_compiler_option("-Wno-missing-noreturn") + # add_extra_compiler_option("-Wno-missing-variable-declarations") + # add_extra_compiler_option("-Wno-missing-prototypes") + # add_extra_compiler_option("-Wno-nonportable-system-include-path") + # add_extra_compiler_option("-Wno-shadow") + # add_extra_compiler_option("-Wno-suggest-destructor-override") + # add_extra_compiler_option("-Wno-suggest-override") + # add_extra_compiler_option("-Wno-switch-enum") + # add_extra_compiler_option("-Wno-unreachable-code") + # add_extra_compiler_option("-Wno-unused-macros") + # add_extra_compiler_option("-Wno-unused-member-function") + #endif() endif() # adjust -Wl,-rpath-link From a09e8872b35d9b8aeb298966a5577510cbc2dccc Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Mon, 17 Jul 2023 11:05:57 +0200 Subject: [PATCH 23/26] Try to use msvc17 --- .github/workflows/windows-clang.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-clang.yaml b/.github/workflows/windows-clang.yaml index 908a6c1a51..49a75fc937 100644 --- a/.github/workflows/windows-clang.yaml +++ b/.github/workflows/windows-clang.yaml @@ -16,7 +16,7 @@ jobs: include: - name: windows-latest-clang - os: windows-2019 + os: windows-2022 compiler: clang-cl steps: @@ -46,7 +46,7 @@ jobs: run: | mkdir build cd build - cmake .. -G "Visual Studio 16 2019" -T "ClangCl" -A "x64" + cmake .. -G "Visual Studio 17 2022" -T "ClangCl" -A "x64" type ViSP-third-party.txt - name: Build ViSP From 7414a1de234076d70fc01d9648135c9f71e6d9fc Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Mon, 17 Jul 2023 11:06:11 +0200 Subject: [PATCH 24/26] Add ctest verbosity --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index ecd5537926..24978a0467 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -76,7 +76,7 @@ jobs: - name: Run unit tests working-directory: build - run: ctest -j$(sysctl -n hw.logicalcpu) --output-on-failure + run: ctest -j$(sysctl -n hw.logicalcpu) --output-on-failure -V - name: ViSP as 3rdparty with cmake run: | From 28379997294d249bd9ccb5b6928ffec57aa7813f Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Mon, 17 Jul 2023 13:42:37 +0200 Subject: [PATCH 25/26] Set VISP_INPUT_IMAGE_PATH before cmake configure --- .github/workflows/windows-clang.yaml | 9 ++++++--- .github/workflows/windows-msvc.yaml | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows-clang.yaml b/.github/workflows/windows-clang.yaml index 49a75fc937..7868044bf9 100644 --- a/.github/workflows/windows-clang.yaml +++ b/.github/workflows/windows-clang.yaml @@ -44,6 +44,9 @@ jobs: - name: Configure ViSP working-directory: ${{ github.workspace }} run: | + set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }} + echo "VISP_INPUT_IMAGE_PATH: " + echo %VISP_INPUT_IMAGE_PATH% mkdir build cd build cmake .. -G "Visual Studio 17 2022" -T "ClangCl" -A "x64" @@ -64,8 +67,8 @@ jobs: run: | dir ${{ github.workspace }}\build\install\ dir ${{ github.workspace }}\build\install\x64\ - dir ${{ github.workspace }}\build\install\x64\vc16\ - dir ${{ github.workspace }}\build\install\x64\vc16\bin + dir ${{ github.workspace }}\build\install\x64\vc17\ + dir ${{ github.workspace }}\build\install\x64\vc17\bin - name: Test ViSP working-directory: build @@ -73,7 +76,7 @@ jobs: set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }} echo "VISP_INPUT_IMAGE_PATH: " echo %VISP_INPUT_IMAGE_PATH% - set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc16\bin + set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc17\bin echo "PATH: " echo %PATH% ctest --output-on-failure -C Release -V diff --git a/.github/workflows/windows-msvc.yaml b/.github/workflows/windows-msvc.yaml index d1fd145741..4a3b846ce3 100644 --- a/.github/workflows/windows-msvc.yaml +++ b/.github/workflows/windows-msvc.yaml @@ -42,6 +42,9 @@ jobs: - name: Configure ViSP working-directory: ${{ github.workspace }} run: | + set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }} + echo "VISP_INPUT_IMAGE_PATH: " + echo %VISP_INPUT_IMAGE_PATH% mkdir build cd build cmake .. -G "Visual Studio 16 2019" -A "x64" From 7459a05728984e72a28d8246af5353016ab04e7f Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 19 Jul 2023 14:31:24 +0200 Subject: [PATCH 26/26] Add avx flags to common flags only when msvc + clang - otherwise it breaks ci on github macos workflow - follows commit de427eefade056fc1a6359e2ba6a997e08cc8741 --- 3rdparty/simdlib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/simdlib/CMakeLists.txt b/3rdparty/simdlib/CMakeLists.txt index 63fa75c78d..b3a56b4f80 100644 --- a/3rdparty/simdlib/CMakeLists.txt +++ b/3rdparty/simdlib/CMakeLists.txt @@ -137,7 +137,7 @@ if(X86 OR X86_64) set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -Wno-missing-field-initializers") endif() - if((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + if(MSVC AND ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))) # Clang under windows needs AVX flags set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} ${AVX_FLAG} ${AVX2_FLAG}") endif()