Skip to content

Change generated header file output location#23217

Merged
opencv-pushbot merged 1 commit intoopencv:4.xfrom
laitingsheng:4.x
Feb 5, 2023
Merged

Change generated header file output location#23217
opencv-pushbot merged 1 commit intoopencv:4.xfrom
laitingsheng:4.x

Conversation

@laitingsheng
Copy link
Copy Markdown
Contributor

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

OPENCV_CONFIG_FILE_INCLUDE_DIR is actually a configurable option, but the rules for some of the generated files are not following this. This PR is intending to fix this minor issue.

@laitingsheng laitingsheng changed the title Change custom_hal.hpp output location Change generated header file output location Feb 3, 2023
@alalek
Copy link
Copy Markdown
Member

alalek commented Feb 5, 2023

OPENCV_CONFIG_FILE_INCLUDE_DIR

It is used for cvconfig.h only:

ocv_update(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")

Going in this way would increase mess of misused variables.


Purpose of these changes are unclear and it is not stated in PR's description.

@laitingsheng
Copy link
Copy Markdown
Contributor Author

laitingsheng commented Feb 5, 2023

It is used for cvconfig.h only

I don't think this is for cvconfig.h only. Actually, in cmake/OpenCVGenHeaders.cmake, there is a line for generating the OpenCV modules which uses the value:

configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv_modules.hpp.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp")

As the variable name is indicating this is the directory for config file(s), I think custom_hal.hpp and opencv_data_config.hpp can both be considered as config files as well, just like the opencv_modules.hpp.

I don't think this will increase any mess. It's more like making the config files generation more consistent and more flexible instead of having two potentially different locations.

If this is not intending to be a configurable option, my suggestion would be changing it to a normal variable. The cache value will be shadowed by the normal variable with the same name and will probably result in CMake generation failure.

Referencing #6098 as this is the proposed solution.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@opencv-pushbot opencv-pushbot merged commit 9eb78ee into opencv:4.x Feb 5, 2023
@asmorkalov asmorkalov mentioned this pull request May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants