build: made environment access a separate feature#26331
Merged
asmorkalov merged 1 commit intoopencv:4.xfrom Nov 5, 2024
Merged
build: made environment access a separate feature#26331asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov merged 1 commit intoopencv:4.xfrom
Conversation
a932070 to
04818d6
Compare
asmorkalov
reviewed
Oct 31, 2024
| static int use_legacy = -1; | ||
| if (use_legacy < 0) | ||
| { | ||
| use_legacy = getenv("OPENCV_LEGACY_WAITKEY") != NULL ? 1 : 0; |
Contributor
There was a problem hiding this comment.
I propose to drop it in 5.x
Contributor
Author
There was a problem hiding this comment.
OK, but this PR is for 4.x, so we'll need to remove it after these changes make their way to 5.x.
| } | ||
|
|
||
|
|
||
| static const bool gs_verbose = utils::getConfigurationParameterBool("OPENCV_DSHOW_DEBUG"); |
Contributor
There was a problem hiding this comment.
I propose to use generic logging here with default environment variables.
Comment on lines
+931
to
+932
| const bool debug_option = utils::getConfigurationParameterBool("OPENCV_FFMPEG_DEBUG"); | ||
| std::string level_option = utils::getConfigurationParameterString("OPENCV_FFMPEG_LOGLEVEL"); |
Contributor
There was a problem hiding this comment.
I propose to use generic logging here with default environment variables.
| OCV_OPTION(OPENCV_ENABLE_MEMALIGN "Enable posix_memalign or memalign usage" ON) | ||
| OCV_OPTION(OPENCV_DISABLE_FILESYSTEM_SUPPORT "Disable filesystem support" OFF) | ||
| OCV_OPTION(OPENCV_DISABLE_THREAD_SUPPORT "Build the library without multi-threaded code." OFF) | ||
| OCV_OPTION(OPENCV_DISABLE_ENV_SUPPORT "Disable environment variables access (getenv)" (CMAKE_SYSTEM_NAME MATCHES "Windows(CE|Phone|Store)")) |
Contributor
Author
There was a problem hiding this comment.
I'm not sure, it seems that we have no any specific handling for iOS. Perhaps this platform supports environment variables. If Apple compiler defines NO_GETENV, then it would automatically disable our getenv support even if cmake option is turned OFF.
4 tasks
asmorkalov
approved these changes
Nov 5, 2024
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getConfigurationParameterStringtostd::stringfromconst char*, technically this breaks the ABI, but the function is privatecvtest::addDataSearchEnvfunction to replace repetative blocks withgetenv + addDataSearchPathgetConfigurationParameterStringto the gapi module, this change presumably conflicts with standalone build, but can be fixed if neededvar.isEmpty()should be OK.1,true- turn ON,0,false- turn OFF). This is also changed beokhavior.OPENCV_FFMPEG_DLL_DIR) - it used_wgetenvwithwchar_t*result, but I've changed it to our function returningstd::string, I'm not sure if it affects unicode paths support (they might use UTF-8)OPENCV_DISABLE_ENV_SUPPORTis set toON, just one file will be compiled withNO_GETENVmacro enabled, all 3rdparty libraries will not be affected, I'm not sure if it is OK behavior or not.