Commit 285dedba authored by Tom Finegan's avatar Tom Finegan

Expand cmake assembler support.

- Stop acting as if Yasm is the only assembler.
- Kill generation and report error when yasm is not found for x86
  and x86_64 (remove the generic fallback).
- Use $AOM_AS_FLAGS to pass assembler specific flags.
- Add include guard in aom_optimization.cmake.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: Ic68d6c81071c24a8ceb6806d04ab8959be97d876
parent 0397eda0
......@@ -27,6 +27,7 @@ endforeach()
string(STRIP "${AOM_CMAKE_CONFIG}" AOM_CMAKE_CONFIG)
include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake")
include("${AOM_ROOT}/build/cmake/aom_optimization.cmake")
include("${AOM_ROOT}/build/cmake/compiler_flags.cmake")
include("${AOM_ROOT}/build/cmake/compiler_tests.cmake")
......@@ -80,11 +81,16 @@ if (NOT EXISTS "${AOM_ROOT}/build/cmake/targets/${AOM_TARGET_CPU}.cmake")
endif ()
if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL "x86_64")
find_program(YASM_EXECUTABLE yasm $ENV{YASM_PATH})
if (NOT YASM_EXECUTABLE)
message(WARNING "Unable to find yasm, using generic as target CPU.")
set(AOM_TARGET_CPU "generic")
# TODO(tomfinegan): Support nasm at least as well as the existing build
# system.
find_program(AS_EXECUTABLE yasm $ENV{YASM_PATH})
if (NOT AS_EXECUTABLE)
message(FATAL_ERROR "Unable to find yasm. To build without optimizations, "
"add -DAOM_TARGET_CPU=generic to your cmake command line.")
endif ()
get_asm_obj_format("objformat")
set(AOM_AS_FLAGS -f ${objformat} ${AOM_AS_FLAGS})
string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS)
endif ()
include("${AOM_ROOT}/build/cmake/targets/${AOM_TARGET_CPU}.cmake")
......
......@@ -8,6 +8,8 @@
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
if (NOT AOM_BUILD_CMAKE_AOM_OPTIMIZATION_CMAKE_)
set(AOM_BUILD_CMAKE_AOM_OPTIMIZATION_CMAKE_ 1)
# Translate $flag to one which MSVC understands, and write the new flag to the
# variable named by $translated_flag (or unset it, when MSVC needs no flag).
......@@ -112,15 +114,12 @@ function (add_asm_library lib_name asm_sources dependent_target)
# consumers of the AOM cmake build.
add_library(${lib_name} STATIC ${${asm_sources}})
get_asm_obj_format("objformat")
foreach (asm_source ${${asm_sources}})
get_filename_component(asm_source_name "${asm_source}" NAME)
set(asm_object "${asm_lib_obj_dir}/${asm_source_name}.o")
add_custom_command(OUTPUT "${asm_object}"
COMMAND ${YASM_EXECUTABLE}
COMMAND ${AS_EXECUTABLE}
ARGS ${AOM_AS_FLAGS}
-f ${objformat}
-I${AOM_ROOT} -I${AOM_CONFIG_DIR}
-o "${asm_object}" "${asm_source}"
DEPENDS "${asm_source}"
......@@ -148,3 +147,5 @@ function (add_asm_library lib_name asm_sources dependent_target)
list(APPEND AOM_LIB_TARGETS ${lib_name})
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
endfunction ()
endif () # AOM_BUILD_CMAKE_AOM_OPTIMIZATION_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