Commit 9bc86c2b authored by Tom Finegan's avatar Tom Finegan
Browse files

Add util function for CMake config changes.

- Add change_config_and_warn(), which basically does
  what it says.
- Fixed some indent issues.
- Added doc comment for create_dummy_source_file().

Change-Id: I748eec7ff63bd43af8c7a91be1e734b28f7d43d0
parent de6f072e
...@@ -243,51 +243,33 @@ if (CONFIG_ANALYZER) ...@@ -243,51 +243,33 @@ if (CONFIG_ANALYZER)
include(${wxWidgets_USE_FILE}) include(${wxWidgets_USE_FILE})
if (NOT CONFIG_INSPECTION) if (NOT CONFIG_INSPECTION)
set(CONFIG_INSPECTION 1) change_config_and_warn(CONFIG_INSPECTION 1 CONFIG_ANALYZER)
message(WARNING
"--- Enabled CONFIG_INSPECTION, required for CONFIG_ANALYZER.")
endif () endif ()
endif () endif ()
if (CONFIG_VAR_TX_NO_TX_MODE AND NOT CONFIG_VAR_TX) if (CONFIG_VAR_TX_NO_TX_MODE AND NOT CONFIG_VAR_TX)
message(WARNING change_config_and_warn(CONFIG_VAR_TX 1 CONFIG_VAR_TX_NO_TX_MODE)
"--- CONFIG_VAR_TX_NO_TX_MODE requires CONFIG_VAR_TX, disabling.")
set(CONFIG_VAR_TX_NO_TX_MODE 0)
endif() endif()
if (CONFIG_DAALA_DCT4) if (CONFIG_DAALA_DCT4 AND NOT CONFIG_DCT_ONLY)
if (NOT CONFIG_DCT_ONLY) change_config_and_warn(CONFIG_DCT_ONLY 1 CONFIG_DAALA_DCT4)
message(WARNING
"--- Enabled CONFIG_DCT_ONLY, needed for CONFIG_DAALA_DCT4.")
set(CONFIG_DCT_ONLY 1)
endif()
endif() endif()
if (CONFIG_DAALA_DCT4 OR CONFIG_DAALA_DCT8 OR CONFIG_DAALA_DCT16) if (CONFIG_DAALA_DCT4 OR CONFIG_DAALA_DCT8 OR CONFIG_DAALA_DCT16)
if (HAVE_MMX) if (HAVE_MMX)
message(WARNING change_config_and_warn(HAVE_MMX 0 CONFIG_DAALA_DCTx)
"--- Disabled HAVE_MMX, incompatible with CONFIG_DAALA_DCTx.")
set(HAVE_MMX 0)
endif() endif()
if (CONFIG_RECT_TX) if (CONFIG_RECT_TX)
message(WARNING change_config_and_warn(CONFIG_RECT_TX 0 CONFIG_DAALA_DCTx)
"--- Disabled CONFIG_RECT_TX, incompatible with CONFIG_DAALA_DCTx.")
set(CONFIG_RECT_TX 0)
endif() endif()
if (CONFIG_VAR_TX) if (CONFIG_VAR_TX)
message(WARNING change_config_and_warn(CONFIG_VAR_TX 0 CONFIG_DAALA_DCTx)
"--- Disabled CONFIG_VAR_TX, incompatible with CONFIG_DAALA_DCTx.")
set(CONFIG_VAR_TX 0)
endif() endif()
if (CONFIG_LGT) if (CONFIG_LGT)
message(WARNING change_config_and_warn(CONFIG_LGT 0 CONFIG_DAALA_DCTx)
"--- Disabled CONFIG_LGT, incompatible with CONFIG_DAALA_DCTx.")
set(CONFIG_LGT 0)
endif() endif()
if (NOT CONFIG_LOWBITDEPTH) if (NOT CONFIG_LOWBITDEPTH)
message(WARNING change_config_and_warn(CONFIG_LOWBITDEPTH 1 CONFIG_DAALA_DCTx)
"--- Enabled CONFIG_LOWBITDEPTH, needed for CONFIG_DAALA_DCTx.")
set(CONFIG_LOWBITDEPTH 1)
endif() endif()
endif() endif()
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
if (NOT AOM_BUILD_CMAKE_UTIL_CMAKE_) if (NOT AOM_BUILD_CMAKE_UTIL_CMAKE_)
set(AOM_BUILD_CMAKE_UTIL_CMAKE_ 1) set(AOM_BUILD_CMAKE_UTIL_CMAKE_ 1)
# Creates dummy source file in $AOM_CONFIG_DIR named $basename.$extension and
# returns the full path to the dummy source file via the $out_file_path
# parameter.
function (create_dummy_source_file basename extension out_file_path) function (create_dummy_source_file basename extension out_file_path)
set(dummy_source_file "${AOM_CONFIG_DIR}/${basename}.${extension}") set(dummy_source_file "${AOM_CONFIG_DIR}/${basename}.${extension}")
file(WRITE "${dummy_source_file}" file(WRITE "${dummy_source_file}"
...@@ -26,5 +29,21 @@ function (add_dummy_source_file_to_target target_name extension) ...@@ -26,5 +29,21 @@ function (add_dummy_source_file_to_target target_name extension)
target_sources(${target_name} PRIVATE ${dummy_source_file}) target_sources(${target_name} PRIVATE ${dummy_source_file})
endfunction () endfunction ()
# Sets the value of the variable referenced by $feature to $value, and reports
# the change to the user via call to message(WARNING ...). $cause is expected to
# be a configuration variable that conflicts with $feature in some way.
function (change_config_and_warn feature value cause)
set(${feature} ${value} PARENT_SCOPE)
if (${value} EQUAL 1)
set(verb "Enabled")
set(reason "required for")
else ()
set(verb "Disabled")
set(reason "incompatible with")
endif ()
set(warning_message "${verb} ${feature}, ${reason} ${cause}.")
message(WARNING "--- ${warning_message}")
endfunction ()
endif() # AOM_BUILD_CMAKE_UTIL_CMAKE_ endif() # AOM_BUILD_CMAKE_UTIL_CMAKE_
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment