Commit c34abc8a authored by Tom Finegan's avatar Tom Finegan

Generate libaom_srcs.txt and libaom_srcs.gni via CMake.

BUG=aomedia:474

Change-Id: I42569ab97b5246de98310031e1d2398876283527
parent b6159027
......@@ -641,3 +641,80 @@ add_custom_target(dist
if (ENABLE_DOCS)
add_dependencies(dist docs)
endif ()
# Collect all variables containing libaom source files.
get_cmake_property(all_cmake_vars VARIABLES)
foreach (var ${all_cmake_vars})
if ("${var}" MATCHES "SOURCES$\|_INTRIN_\|_ASM_" AND NOT
"${var}" MATCHES "_APP_\|DOXYGEN\|LIBWEBM\|LIBYUV\|_PKG_\|TEST")
list(APPEND aom_source_vars ${var})
endif ()
endforeach ()
# Libaom_srcs.txt generation.
set(libaom_srcs_txt_file "${AOM_CONFIG_DIR}/libaom_srcs.txt")
file(WRITE "${libaom_srcs_txt_file}" "# This file is generated. DO NOT EDIT.\n")
# Static source file list first.
foreach (aom_source_var ${aom_source_vars})
foreach (file ${${aom_source_var}})
if (NOT "${file}" MATCHES "${AOM_CONFIG_DIR}")
string(REPLACE "${AOM_ROOT}/" "" file "${file}")
file(APPEND "${libaom_srcs_txt_file}" "${file}\n")
endif ()
endforeach ()
endforeach ()
file(APPEND "${libaom_srcs_txt_file}"
"# Files below this line are generated by the libaom build system.\n")
foreach (aom_source_var ${aom_source_vars})
foreach (file ${${aom_source_var}})
if ("${file}" MATCHES "${AOM_CONFIG_DIR}")
string(REPLACE "${AOM_CONFIG_DIR}/" "" file "${file}")
file(APPEND "${libaom_srcs_txt_file}" "${file}\n")
endif ()
endforeach ()
endforeach ()
# Libaom_srcs.gni generation.
set(libaom_srcs_gni_file "${AOM_CONFIG_DIR}/libaom_srcs.gni")
file(WRITE "${libaom_srcs_gni_file}" "# This file is generated. DO NOT EDIT.\n")
foreach (aom_source_var ${aom_source_vars})
if ("${${aom_source_var}}" MATCHES "${AOM_ROOT}")
string(TOLOWER ${aom_source_var} aom_source_var_lowercase)
file(APPEND "${libaom_srcs_gni_file}" "\n${aom_source_var_lowercase} = [\n")
endif ()
foreach (file ${${aom_source_var}})
if (NOT "${file}" MATCHES "${AOM_CONFIG_DIR}")
string(REPLACE "${AOM_ROOT}" "//third_party/aom/src" file "${file}")
file(APPEND "${libaom_srcs_gni_file}" " \"${file}\",\n")
endif ()
endforeach ()
if ("${${aom_source_var}}" MATCHES "${AOM_ROOT}")
file(APPEND "${libaom_srcs_gni_file}" "]\n")
endif ()
endforeach ()
file(APPEND "${libaom_srcs_gni_file}"
"\n# Files below this line are generated by the libaom build system.\n")
foreach (aom_source_var ${aom_source_vars})
if ("${${aom_source_var}}" MATCHES "${AOM_CONFIG_DIR}")
string(TOLOWER ${aom_source_var} aom_source_var_lowercase)
file(APPEND "${libaom_srcs_gni_file}"
"\n${aom_source_var_lowercase}_gen = [\n")
endif ()
foreach (file ${${aom_source_var}})
if (NOT "${file}" MATCHES "${AOM_ROOT}")
string(REPLACE "${AOM_CONFIG_DIR}" "//third_party/aom/src" file "${file}")
file(APPEND "${libaom_srcs_gni_file}" " \"${file}\",\n")
endif ()
endforeach ()
if ("${${aom_source_var}}" MATCHES "${AOM_CONFIG_DIR}")
file(APPEND "${libaom_srcs_gni_file}" "]\n")
endif ()
endforeach ()
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