Commit 84d35995 authored by Tom Finegan's avatar Tom Finegan
Browse files

Improve support for AOMAnalyzer in the CMake build.

- Add utility function for appending link flags to targets.
- Use it to set linker only opts for emscripten inspect target.
- Update with emscripten instructions.
- Build everything with -O3 when no build type is specified.

Change-Id: I69a2083369d2880335a8162132f190377a4a85fb
parent f1da6318
......@@ -254,14 +254,17 @@ if (CONFIG_AV1_DECODER)
add_compiler_flag_if_supported("-s TOTAL_MEMORY=134217728")
add_compiler_flag_if_supported("-s MODULARIZE=1")
add_compiler_flag_if_supported("-s EXPORT_NAME=\"\'DecoderModule\'\"")
add_compiler_flag_if_supported("--memory-init-file 0")
append_link_flag_to_target("inspect" "-s TOTAL_MEMORY=134217728")
append_link_flag_to_target("inspect" "-s MODULARIZE=1")
"-s EXPORT_NAME=\"\'DecoderModule\'\"")
append_link_flag_to_target("inspect" "--memory-init-file 0")
# Default to -O3 when no build type specified.
endif ()
em_link_post_js(inspect "${AOM_ROOT}/tools/inspect-post.js")
endif ()
endif ()
......@@ -11,6 +11,8 @@
recent version of [nasm](
5. Building the documentation requires [doxygen](
6. Building the unit tests requires [Python](
7. Emscripten builds require the portable
### Basic build
......@@ -115,6 +117,49 @@ demonstrates generating an Xcode project:
$ cmake path/to/aom -G Xcode
### Emscripten builds
Building the AV1 codec library with Emscripten is supported. Typically this is
used to hook into the AOMAnalyzer GUI application. These instructions focus on
using the inspector with AOMAnalyzer, but all tools can be built with
It is assumed here that you have already downloaded and installed the EMSDK,
installed and activated at least one toolchain, and setup your environment
appropriately using the emsdk\_env script.
1. Download [AOMAnalyzer](
2. Configure the build:
$ cmake path/to/aom \
-DAOM_TARGET_CPU=generic \
3. Build it: run make if that's your generator of choice:
$ make inspect
4. Run the analyzer:
# inspect.js is in the examples sub directory of the directory in which you
# executed cmake.
$ path/to/AOMAnalyzer path/to/examples/inspect.js path/to/av1/input/file
## Testing the AV1 codec
......@@ -198,3 +243,4 @@ please email for help.
Bug reports can be filed in the Alliance for Open Media
[issue tracker](
......@@ -220,4 +220,25 @@ function (append_exe_linker_flag flag)
endif ()
endfunction ()
# Adds $flag to the link flags for $target.
function (append_link_flag_to_target target flags)
get_target_property(target_link_flags ${target} LINK_FLAGS)
if (target_link_flags)
string(FIND "${target_link_flags}" "${flags}" link_flag_found)
if (NOT ${link_flag_found} EQUAL -1)
endif ()
set(target_link_flags "${target_link_flags} ${flags}")
else ()
set(target_link_flags "${flags}")
endif ()
set_target_properties(${target} PROPERTIES LINK_FLAGS ${target_link_flags})
endfunction ()
Supports Markdown
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